Annotation of loncom/interface/statistics/lonstudentassessment.pm, revision 1.74

1.1       stredwic    1: # The LearningOnline Network with CAPA
                      2: #
1.74    ! matthew     3: # $Id: lonstudentassessment.pm,v 1.73 2003/10/29 16:20:14 matthew Exp $
1.1       stredwic    4: #
                      5: # Copyright Michigan State University Board of Trustees
                      6: #
                      7: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
                      8: # LON-CAPA is free software; you can redistribute it and/or modify
                      9: # it under the terms of the GNU General Public License as published by
                     10: # the Free Software Foundation; either version 2 of the License, or
                     11: # (at your option) any later version.
                     12: #
                     13: # LON-CAPA is distributed in the hope that it will be useful,
                     14: # but WITHOUT ANY WARRANTY; without even the implied warranty of
                     15: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     16: # GNU General Public License for more details.
                     17: #
                     18: # You should have received a copy of the GNU General Public License
                     19: # along with LON-CAPA; if not, write to the Free Software
                     20: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                     21: #
                     22: # /home/httpd/html/adm/gpl.txt
                     23: #
                     24: # http://www.lon-capa.org/
                     25: #
                     26: # (Navigate problems for statistical reports
1.28      matthew    27: #
                     28: #######################################################
                     29: #######################################################
                     30: 
                     31: =pod
                     32: 
                     33: =head1 NAME
                     34: 
                     35: lonstudentassessment
                     36: 
                     37: =head1 SYNOPSIS
                     38: 
                     39: Presents assessment data about a student or a group of students.
                     40: 
                     41: =head1 Subroutines
                     42: 
                     43: =over 4 
                     44: 
                     45: =cut
                     46: 
                     47: #######################################################
                     48: #######################################################
1.1       stredwic   49: 
1.21      minaeibi   50: package Apache::lonstudentassessment;
1.1       stredwic   51: 
                     52: use strict;
1.28      matthew    53: use Apache::lonstatistics;
1.1       stredwic   54: use Apache::lonhtmlcommon;
                     55: use Apache::loncoursedata;
1.28      matthew    56: use Apache::lonnet; # for logging porpoises
1.31      matthew    57: use Spreadsheet::WriteExcel;
                     58: 
                     59: #######################################################
                     60: #######################################################
                     61: =pod
                     62: 
                     63: =item Package Variables
                     64: 
                     65: =over 4
                     66: 
                     67: =item $Statistics Hash ref to store student data.  Indexed by symb,
                     68:       contains hashes with keys 'score' and 'max'.
                     69: 
                     70: =cut
                     71: 
                     72: #######################################################
                     73: #######################################################
1.1       stredwic   74: 
1.30      matthew    75: my $Statistics;
                     76: 
1.28      matthew    77: #######################################################
                     78: #######################################################
                     79: 
                     80: =pod
                     81: 
1.31      matthew    82: =item $show_links 'yes' or 'no' for linking to student performance data
                     83: 
                     84: =item $output_mode 'html', 'excel', or 'csv' for output mode
                     85: 
1.32      matthew    86: =item $show 'all', 'totals', or 'scores' determines how much data is output
1.31      matthew    87: 
1.54      matthew    88: =item $data  determines what performance data is shown
                     89: 
                     90: =item $datadescription A short description of the output data selected.
                     91: 
                     92: =item $base 'tries' or 'scores' determines the base of the performance shown
                     93: 
1.49      matthew    94: =item $single_student_mode evaluates to true if we are showing only one
                     95: student.
                     96: 
1.31      matthew    97: =cut
                     98: 
                     99: #######################################################
                    100: #######################################################
                    101: my $show_links;
                    102: my $output_mode;
1.54      matthew   103: my $data;
                    104: my $base;
                    105: my $datadescription;
1.49      matthew   106: my $single_student_mode;
1.28      matthew   107: 
1.31      matthew   108: #######################################################
                    109: #######################################################
                    110: # End of package variable declarations
1.28      matthew   111: 
1.31      matthew   112: =pod
1.28      matthew   113: 
1.31      matthew   114: =back
1.28      matthew   115: 
1.31      matthew   116: =cut
1.28      matthew   117: 
1.31      matthew   118: #######################################################
                    119: #######################################################
1.28      matthew   120: 
1.31      matthew   121: =pod
1.28      matthew   122: 
1.31      matthew   123: =item &BuildStudentAssessmentPage()
1.28      matthew   124: 
1.31      matthew   125: Inputs: 
1.4       stredwic  126: 
1.31      matthew   127: =over 4
1.28      matthew   128: 
                    129: =item $r Apache Request
                    130: 
                    131: =item $c Apache Connection 
                    132: 
                    133: =back
                    134: 
                    135: =cut
                    136: 
                    137: #######################################################
                    138: #######################################################
1.1       stredwic  139: sub BuildStudentAssessmentPage {
1.30      matthew   140:     my ($r,$c)=@_;
1.74    ! matthew   141:     #
1.30      matthew   142:     undef($Statistics);
1.66      matthew   143:     undef($show_links);
                    144:     undef($output_mode);
                    145:     undef($data);
                    146:     undef($base);
                    147:     undef($datadescription);
                    148:     undef($single_student_mode);
1.74    ! matthew   149:     #
        !           150:     my %Saveable_Parameters = ('Status' => 'scalar',
        !           151:                                'chartoutputmode' => 'scalar',
        !           152:                                'chartoutputdata' => 'scalar',
        !           153:                                'Section' => 'array',
        !           154:                                'StudentData' => 'array',
        !           155:                                'Maps' => 'array');
        !           156:     &Apache::loncommon::store_course_settings('chart',\%Saveable_Parameters);
        !           157:     &Apache::loncommon::restore_course_settings('chart',\%Saveable_Parameters);
        !           158:     #
        !           159:     &Apache::lonstatistics::PrepareClasslist();
        !           160:     #
1.65      matthew   161:     $single_student_mode = 0;
1.49      matthew   162:     $single_student_mode = 1 if ($ENV{'form.SelectedStudent'});
1.59      matthew   163:     if ($ENV{'form.selectstudent'}) {
                    164:         &Apache::lonstatistics::DisplayClasslist($r);
                    165:         return;
                    166:     }
1.30      matthew   167:     #
1.31      matthew   168:     # Print out the HTML headers for the interface
                    169:     #    This also parses the output mode selector
1.54      matthew   170:     #    This step must *always* be done.
1.30      matthew   171:     $r->print(&CreateInterface());
1.31      matthew   172:     $r->print('<input type="hidden" name="notfirstrun" value="true" />');
1.49      matthew   173:     $r->print('<input type="hidden" name="sort" value="'.
                    174:               $ENV{'form.sort'}.'" />');
1.7       stredwic  175:     $r->rflush();
1.58      matthew   176:     #
1.49      matthew   177:     if (! exists($ENV{'form.notfirstrun'}) && ! $single_student_mode) {
1.31      matthew   178:         return;
                    179:     }
                    180:     #
                    181:     my $initialize     = \&html_initialize;
                    182:     my $output_student = \&html_outputstudent;
                    183:     my $finish         = \&html_finish;
                    184:     #
                    185:     if ($output_mode eq 'excel') {
                    186:         $initialize     = \&excel_initialize;
                    187:         $output_student = \&excel_outputstudent;
                    188:         $finish         = \&excel_finish;
                    189:     } elsif ($output_mode eq 'csv') {
                    190:         $initialize     = \&csv_initialize;
                    191:         $output_student = \&csv_outputstudent;
                    192:         $finish         = \&csv_finish;
                    193:     }
1.30      matthew   194:     #
                    195:     if($c->aborted()) {  return ; }
1.31      matthew   196:     #
1.49      matthew   197:     # Determine which students we want to look at
                    198:     my @Students;
                    199:     if ($single_student_mode) {
                    200:         @Students = (&Apache::lonstatistics::current_student());
                    201:         $r->print(&next_and_previous_buttons());
                    202:         $r->rflush();
                    203:     } else {
                    204:         @Students = @Apache::lonstatistics::Students;
                    205:     }
1.56      matthew   206:     #
                    207:     # Perform generic initialization tasks
                    208:     #       Since we use lonnet::EXT to retrieve problem weights,
                    209:     #       to ensure current data we must clear the caches out.
                    210:     #       This makes sure that parameter changes at the student level
                    211:     #       are immediately reflected in the chart.
                    212:     &Apache::lonnet::clear_EXT_cache_status();
1.69      matthew   213:     #
                    214:     # Clean out loncoursedata's package data, just to be safe.
                    215:     &Apache::loncoursedata::clear_internal_caches();
1.49      matthew   216:     #
1.31      matthew   217:     # Call the initialize routine selected above
                    218:     $initialize->($r);
1.49      matthew   219:     foreach my $student (@Students) {
1.31      matthew   220:         if($c->aborted()) { 
                    221:             $finish->($r);
                    222:             return ; 
1.1       stredwic  223:         }
1.31      matthew   224:         # Call the output_student routine selected above
                    225:         $output_student->($r,$student);
                    226:     }
                    227:     # Call the "finish" routine selected above
                    228:     $finish->($r);
                    229:     #
                    230:     return;
                    231: }
                    232: 
                    233: #######################################################
                    234: #######################################################
1.49      matthew   235: sub next_and_previous_buttons {
                    236:     my $Str = '';
                    237:     $Str .= '<input type="hidden" name="SelectedStudent" value="'.
                    238:         $ENV{'form.SelectedStudent'}.'" />';
                    239:     #
                    240:     # Build the previous student link
                    241:     my $previous = &Apache::lonstatistics::previous_student();
                    242:     my $previousbutton = '';
                    243:     if (defined($previous)) {
                    244:         my $sname = $previous->{'username'}.':'.$previous->{'domain'};
                    245:         $previousbutton .= '<input type="button" value="'.
                    246:             'Previous Student ('.
                    247:             $previous->{'username'}.'@'.$previous->{'domain'}.')'.
                    248:             '" onclick="document.Statistics.SelectedStudent.value='.
                    249:             "'".$sname."'".';'.
                    250:             'document.Statistics.submit();" />';
                    251:     } else {
                    252:         $previousbutton .= '<input type="button" value="'.
                    253:             'Previous student (none)'.'" />';
                    254:     }
                    255:     #
                    256:     # Build the next student link
                    257:     my $next = &Apache::lonstatistics::next_student();
                    258:     my $nextbutton = '';
                    259:     if (defined($next)) {
                    260:         my $sname = $next->{'username'}.':'.$next->{'domain'};
                    261:         $nextbutton .= '<input type="button" value="'.
                    262:             'Next Student ('.
                    263:             $next->{'username'}.'@'.$next->{'domain'}.')'.
                    264:             '" onclick="document.Statistics.SelectedStudent.value='.
                    265:             "'".$sname."'".';'.
                    266:             'document.Statistics.submit();" />';
                    267:     } else {
                    268:         $nextbutton .= '<input type="button" value="'.
                    269:             'Next student (none)'.'" />';
                    270:     }
                    271:     #
                    272:     # Build the 'all students' button
                    273:     my $all = '';
                    274:     $all .= '<input type="button" value="All Students" '.
                    275:             '" onclick="document.Statistics.SelectedStudent.value='.
                    276:             "''".';'.'document.Statistics.submit();" />';
                    277:     $Str .= $previousbutton.('&nbsp;'x5).$all.('&nbsp;'x5).$nextbutton;
                    278:     return $Str;
                    279: }
                    280: 
                    281: #######################################################
                    282: #######################################################
1.30      matthew   283: 
1.31      matthew   284: sub get_student_fields_to_show {
                    285:     my @to_show = @Apache::lonstatistics::SelectedStudentData;
                    286:     foreach (@to_show) {
                    287:         if ($_ eq 'all') {
                    288:             @to_show = @Apache::lonstatistics::StudentDataOrder;
                    289:             last;
                    290:         }
                    291:     }
                    292:     return @to_show;
                    293: }
                    294: 
1.28      matthew   295: #######################################################
                    296: #######################################################
                    297: 
                    298: =pod
1.2       stredwic  299: 
1.28      matthew   300: =item &CreateInterface()
1.21      minaeibi  301: 
1.28      matthew   302: Called by &BuildStudentAssessmentPage to create the top part of the
                    303: page which displays the chart.
                    304: 
1.30      matthew   305: Inputs: None
1.28      matthew   306: 
                    307: Returns:  A string containing the HTML for the headers and top table for 
                    308: the chart page.
                    309: 
                    310: =cut
                    311: 
                    312: #######################################################
                    313: #######################################################
1.2       stredwic  314: sub CreateInterface {
1.4       stredwic  315:     my $Str = '';
1.30      matthew   316: #    $Str .= &CreateLegend();
                    317:     $Str .= '<table cellspacing="5">'."\n";
                    318:     $Str .= '<tr>';
                    319:     $Str .= '<td align="center"><b>Sections</b></td>';
                    320:     $Str .= '<td align="center"><b>Student Data</b></td>';
1.46      matthew   321:     $Str .= '<td align="center"><b>Enrollment Status</b></td>';
1.41      matthew   322:     $Str .= '<td align="center"><b>Sequences and Folders</b></td>';
1.58      matthew   323:     $Str .= '<td align="center"><b>Output Format</b>'.
                    324:         &Apache::loncommon::help_open_topic("Chart_Output_Formats").
                    325:         '</td>';
                    326:     $Str .= '<td align="center"><b>Output Data</b>'.
                    327:         &Apache::loncommon::help_open_topic("Chart_Output_Data").
                    328:         '</td>';
1.30      matthew   329:     $Str .= '</tr>'."\n";
                    330:     #
1.4       stredwic  331:     $Str .= '<tr><td align="center">'."\n";
1.29      matthew   332:     $Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5);
1.4       stredwic  333:     $Str .= '</td><td align="center">';
1.30      matthew   334:     my $only_seq_with_assessments = sub { 
                    335:         my $s=shift;
                    336:         if ($s->{'num_assess'} < 1) { 
                    337:             return 0;
                    338:         } else { 
                    339:             return 1;
                    340:         }
                    341:     };
                    342:     $Str .= &Apache::lonstatistics::StudentDataSelect('StudentData','multiple',
                    343:                                                       5,undef);
1.46      matthew   344:     $Str .= '</td><td>'."\n";
                    345:     $Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5);
1.4       stredwic  346:     $Str .= '</td><td>'."\n";
1.30      matthew   347:     $Str .= &Apache::lonstatistics::MapSelect('Maps','multiple,all',5,
                    348:                                               $only_seq_with_assessments);
1.31      matthew   349:     $Str .= '</td><td>'."\n";
                    350:     $Str .= &CreateAndParseOutputSelector();
1.54      matthew   351:     $Str .= '</td><td>'."\n";
                    352:     $Str .= &CreateAndParseOutputDataSelector();
1.30      matthew   353:     $Str .= '</td></tr>'."\n";
                    354:     $Str .= '</table>'."\n";
1.55      matthew   355:     $Str .= '<input type="submit" value="Generate Chart" />';
1.59      matthew   356:     $Str .= '&nbsp;'x5;
                    357:     $Str .= '<input type="submit" name="selectstudent" '.
                    358:                                   'value="Select One Student" />';
                    359:     $Str .= '&nbsp;'x5;
                    360:     $Str .= '<input type="submit" name="ClearCache" value="Clear Caches" />';
1.61      www       361:     $Str .= '&nbsp;'x5;
                    362:     $Str .= '<br />';
1.4       stredwic  363:     return $Str;
1.1       stredwic  364: }
1.30      matthew   365: 
                    366: #######################################################
                    367: #######################################################
                    368: 
                    369: =pod
                    370: 
1.31      matthew   371: =item &CreateAndParseOutputSelector()
1.30      matthew   372: 
                    373: =cut
                    374: 
                    375: #######################################################
                    376: #######################################################
1.32      matthew   377: my @OutputOptions = 
                    378:     ({ name  => 'HTML, with links',
                    379:        value => 'html, with links',
1.33      matthew   380:        description => 'Output HTML with each symbol linked to the problem '.
1.35      matthew   381: 	   'which generated it.',
                    382:        mode => 'html',
                    383:        show_links => 'yes',
                    384:        },
1.47      matthew   385:      { name  => 'HTML, with all links',
                    386:        value => 'html, with all links',
                    387:        description => 'Output HTML with each symbol linked to the problem '.
                    388: 	   'which generated it.  '.
                    389:            'This includes links for unattempted problems.',
                    390:        mode => 'html',
                    391:        show_links => 'all',
                    392:        },
1.32      matthew   393:      { name  => 'HTML, without links',
                    394:        value => 'html, without links',
1.33      matthew   395:        description => 'Output HTML.  By not including links, the size of the'.
                    396: 	   ' web page is greatly reduced.  If your browser crashes on the '.
1.35      matthew   397: 	   'full display, try this.',
                    398:        mode => 'html',
                    399:        show_links => 'no',
                    400:            },
1.54      matthew   401:      { name  => 'Excel',
                    402:        value => 'excel',
                    403:        description => 'Output an Excel file (compatable with Excel 95).',
1.35      matthew   404:        mode => 'excel',
                    405:        show_links => 'no',
1.54      matthew   406:    },
                    407:      { name  => 'CSV',
                    408:        value => 'csv',
                    409:        description => 'Output a comma seperated values file suitable for '.
1.57      matthew   410:            'import into a spreadsheet program.  Using this method as opposed '.
                    411:            'to Excel output allows you to organize your data before importing'.
                    412:            ' it into a spreadsheet program.',
1.35      matthew   413:        mode => 'csv',
                    414:        show_links => 'no',
                    415:            },
1.32      matthew   416:      );
                    417: 
1.33      matthew   418: sub OutputDescriptions {
                    419:     my $Str = '';
1.58      matthew   420:     $Str .= "<h2>Output Formats</h2>\n";
1.33      matthew   421:     $Str .= "<dl>\n";
                    422:     foreach my $outputmode (@OutputOptions) {
                    423: 	$Str .="    <dt>".$outputmode->{'name'}."</dt>\n";
                    424: 	$Str .="        <dd>".$outputmode->{'description'}."</dd>\n";
                    425:     }
                    426:     $Str .= "</dl>\n";
                    427:     return $Str;
                    428: }
                    429: 
1.31      matthew   430: sub CreateAndParseOutputSelector {
                    431:     my $Str = '';
1.44      matthew   432:     my $elementname = 'chartoutputmode';
1.73      matthew   433:     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                    434:                                             [$elementname]);
1.31      matthew   435:     #
                    436:     # Format for output options is 'mode, restrictions';
1.50      matthew   437:     my $selected = 'html, without links';
1.31      matthew   438:     if (exists($ENV{'form.'.$elementname})) {
                    439:         if (ref($ENV{'form.'.$elementname} eq 'ARRAY')) {
                    440:             $selected = $ENV{'form.'.$elementname}->[0];
                    441:         } else {
                    442:             $selected = $ENV{'form.'.$elementname};
                    443:         }
                    444:     }
                    445:     #
                    446:     # Set package variables describing output mode
                    447:     $show_links  = 'no';
                    448:     $output_mode = 'html';
1.35      matthew   449:     foreach my $option (@OutputOptions) {
                    450:         next if ($option->{'value'} ne $selected);
                    451:         $output_mode = $option->{'mode'};
                    452:         $show_links  = $option->{'show_links'};
1.31      matthew   453:     }
1.35      matthew   454: 
1.31      matthew   455:     #
                    456:     # Build the form element
                    457:     $Str = qq/<select size="5" name="$elementname">/;
1.32      matthew   458:     foreach my $option (@OutputOptions) {
                    459:         $Str .= "\n".'    <option value="'.$option->{'value'}.'"';
                    460:         $Str .= " selected " if ($option->{'value'} eq $selected);
                    461:         $Str .= ">".$option->{'name'}."<\/option>";
1.31      matthew   462:     }
                    463:     $Str .= "\n</select>";
                    464:     return $Str;
                    465: }
1.30      matthew   466: 
1.54      matthew   467: ##
                    468: ## Data selector stuff
                    469: ##
                    470: my @OutputDataOptions =
1.57      matthew   471:     (
1.72      matthew   472:      { name  => 'Scores Summary',
1.57      matthew   473:        base  => 'scores',
                    474:        value => 'sum and total',
                    475:        shortdesc => 'Total Score and Maximum Possible for each '.
                    476:            'Sequence or Folder',
                    477:        longdesc => 'The score of each student as well as the '.
                    478:            ' maximum possible on each Sequence or Folder.',
                    479:        },
1.71      matthew   480:      { name  => 'Scores Per Problem',
1.57      matthew   481:        base  => 'scores',
1.71      matthew   482:        value => 'scores',
                    483:        shortdesc => 'Score on each Problem Part',
                    484:        longdesc =>'The students score on each problem part, computed as'.
                    485:            'the part weight * part awarded',
1.57      matthew   486:        },
1.71      matthew   487: #     { name  => 'Scores Sum',
                    488: #       base  => 'scores',
                    489: #       value => 'sum only',
                    490: #       shortdesc => 'Sum of Scores on each Problem Part',
                    491: #       longdesc =>'The total of the scores of the student on each problem'.
                    492: #           ' part in the sequences or folders selected.',
                    493: #       },
                    494: #     { name  => 'Scores Summary Table Only',
                    495: #       base  => 'scores',
                    496: #       value => 'final table scores',
                    497: #       shortdesc => 'Summary of Scores',
                    498: #       longdesc  => 'The average score on each sequence or folder for the '.
                    499: #           'selected students.',
                    500: #       },
1.57      matthew   501:      { name  =>'Tries',
                    502:        base  =>'tries',
                    503:        value => 'tries',
                    504:        shortdesc => 'Number of Tries before success on each Problem Part',
                    505:        longdesc =>'The number of tries before success on each problem part.',
                    506:        },
                    507:      { name  =>'Parts Correct',
                    508:        base  =>'tries',
                    509:        value => 'parts correct total',
                    510:        shortdesc => 'Number of Problem Parts completed successfully.',
                    511:        longdesc => 'The Number of Problem Parts completed successfully and '.
                    512:            'the maximum possible for each student',
                    513:        },
1.71      matthew   514: #     { name  =>'Parts Correct',
                    515: #       base  =>'tries',
                    516: #       value => 'parts correct',
                    517: #       shortdesc => 'Number of Problem Parts completed successfully.',
                    518: #       longdesc => 'The Number of Problem Parts completed successfully'.
                    519: #           ' on each sequence or folder.',
                    520: #       },
                    521: #     { name  => 'Parts Summary Table Only',
                    522: #       base  => 'tries',
                    523: #       value => 'final table parts',
                    524: #       shortdesc => 'Summary of Parts Correct',
                    525: #       longdesc  => 'A summary table of the average number of problem parts '.
                    526: #           'students were able to get correct on each sequence.',
                    527: #       },
1.57      matthew   528:      );
                    529: 
                    530: sub HTMLifyOutputDataDescriptions {
                    531:     my $Str = '';
1.58      matthew   532:     $Str .= "<h2>Output Data</h2>\n";
1.57      matthew   533:     $Str .= "<dl>\n";
                    534:     foreach my $option (@OutputDataOptions) {
                    535:         $Str .= '    <dt>'.$option->{'name'}.'</dt>';
                    536:         $Str .= '<dd>'.$option->{'longdesc'}.'</dd>'."\n";
                    537:     }
                    538:     $Str .= "</dl>\n";
                    539:     return $Str;
                    540: }
1.54      matthew   541: 
                    542: sub CreateAndParseOutputDataSelector {
                    543:     my $Str = '';
                    544:     my $elementname = 'chartoutputdata';
                    545:     #
                    546:     my $selected = 'scores';
                    547:     if (exists($ENV{'form.'.$elementname})) {
                    548:         if (ref($ENV{'form.'.$elementname} eq 'ARRAY')) {
                    549:             $selected = $ENV{'form.'.$elementname}->[0];
                    550:         } else {
                    551:             $selected = $ENV{'form.'.$elementname};
                    552:         }
                    553:     }
                    554:     #
                    555:     $data = 'scores';
                    556:     foreach my $option (@OutputDataOptions) {
                    557:         if ($option->{'value'} eq $selected) {
                    558:             $data = $option->{'value'};
                    559:             $base = $option->{'base'};
                    560:             $datadescription = $option->{'shortdesc'};
                    561:         }
                    562:     }
                    563:     #
                    564:     # Build the form element
                    565:     $Str = qq/<select size="5" name="$elementname">/;
                    566:     foreach my $option (@OutputDataOptions) {
                    567:         $Str .= "\n".'    <option value="'.$option->{'value'}.'"';
                    568:         $Str .= " selected " if ($option->{'value'} eq $data);
                    569:         $Str .= ">".$option->{'name'}."<\/option>";
                    570:     }
                    571:     $Str .= "\n</select>";
                    572:     return $Str;
                    573: 
                    574: }
                    575: 
1.28      matthew   576: #######################################################
                    577: #######################################################
1.1       stredwic  578: 
1.28      matthew   579: =pod
                    580: 
1.31      matthew   581: =head2 HTML output routines
1.28      matthew   582: 
1.31      matthew   583: =item &html_initialize($r)
1.28      matthew   584: 
1.31      matthew   585: Create labels for the columns of student data to show.
1.28      matthew   586: 
1.31      matthew   587: =item &html_outputstudent($r,$student)
1.28      matthew   588: 
1.31      matthew   589: Return a line of the chart for a student.
1.28      matthew   590: 
1.31      matthew   591: =item &html_finish($r)
1.28      matthew   592: 
                    593: =cut
                    594: 
                    595: #######################################################
                    596: #######################################################
1.31      matthew   597: {
                    598:     my $padding;
                    599:     my $count;
                    600: 
1.39      matthew   601:     my $nodata_count; # The number of students for which there is no data
                    602:     my %prog_state;   # progress state used by loncommon PrgWin routines
                    603: 
1.31      matthew   604: sub html_initialize {
                    605:     my ($r) = @_;
1.30      matthew   606:     #
                    607:     $padding = ' 'x3;
1.35      matthew   608:     $count = 0;
1.39      matthew   609:     $nodata_count = 0;
1.66      matthew   610:     undef(%prog_state);
1.30      matthew   611:     #
1.38      matthew   612:     $r->print("<h3>".$ENV{'course.'.$ENV{'request.course.id'}.'.description'}.
                    613:               "&nbsp;&nbsp;".localtime(time)."</h3>");
1.39      matthew   614: 
1.55      matthew   615:     if ($data !~ /^final table/) {
                    616:         $r->print("<h3>".$datadescription."</h3>");        
                    617:     }
1.39      matthew   618:     #
                    619:     # Set up progress window for 'final table' display only
1.54      matthew   620:     if ($data =~ /^final table/) {
1.39      matthew   621:         my $studentcount = scalar(@Apache::lonstatistics::Students); 
                    622:         %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
                    623:             ($r,'Summary Table Status',
                    624:              'Summary Table Compilation Progress', $studentcount);
                    625:     }
1.31      matthew   626:     my $Str = "<pre>\n";
1.30      matthew   627:     # First, the @StudentData fields need to be listed
1.31      matthew   628:     my @to_show = &get_student_fields_to_show();
1.30      matthew   629:     foreach my $field (@to_show) {
                    630:         my $title=$Apache::lonstatistics::StudentData{$field}->{'title'};
                    631:         my $base =$Apache::lonstatistics::StudentData{$field}->{'base_width'};
                    632:         my $width=$Apache::lonstatistics::StudentData{$field}->{'width'};
                    633:         $Str .= $title.' 'x($width-$base).$padding;
                    634:     }
                    635:     # Now the selected sequences need to be listed
1.40      matthew   636:     foreach my $sequence (&Apache::lonstatistics::Sequences_with_Assess()){
1.31      matthew   637:         my $title = $sequence->{'title'};
                    638:         my $base  = $sequence->{'base_width'};
                    639:         my $width = $sequence->{'width'};
                    640:         $Str .= $title.' 'x($width-$base).$padding;
1.30      matthew   641:     }
1.54      matthew   642:     $Str .= "total</pre>\n";
1.31      matthew   643:     $Str .= "<pre>";
1.39      matthew   644:     #
                    645:     # Check for suppression of output
1.54      matthew   646:     if ($data =~ /^final table/) {
1.39      matthew   647:         $Str = '';
                    648:     }
1.31      matthew   649:     $r->print($Str);
                    650:     $r->rflush();
                    651:     return;
1.30      matthew   652: }
                    653: 
1.31      matthew   654: sub html_outputstudent {
                    655:     my ($r,$student) = @_;
1.2       stredwic  656:     my $Str = '';
1.35      matthew   657:     #
1.55      matthew   658:     if($count++ % 5 == 0 && $count > 0 && $data !~ /^final table/) {
1.35      matthew   659:         $r->print("</pre><pre>");
                    660:     }
1.30      matthew   661:     # First, the @StudentData fields need to be listed
1.31      matthew   662:     my @to_show = &get_student_fields_to_show();
1.30      matthew   663:     foreach my $field (@to_show) {
                    664:         my $title=$student->{$field};
1.31      matthew   665:         my $base = length($title);
1.30      matthew   666:         my $width=$Apache::lonstatistics::StudentData{$field}->{'width'};
                    667:         $Str .= $title.' 'x($width-$base).$padding;
                    668:     }
                    669:     # Get ALL the students data
                    670:     my %StudentsData;
                    671:     my @tmp = &Apache::loncoursedata::get_current_state
                    672:         ($student->{'username'},$student->{'domain'},undef,
                    673:          $ENV{'request.course.id'});
                    674:     if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:/)) {
                    675:         %StudentsData = @tmp;
                    676:     }
                    677:     if (scalar(@tmp) < 1) {
1.39      matthew   678:         $nodata_count++;
1.54      matthew   679:         return if ($data =~ /^final table/);
1.30      matthew   680:         $Str .= '<font color="blue">No Course Data</font>'."\n";
1.31      matthew   681:         $r->print($Str);
                    682:         $r->rflush();
                    683:         return;
1.30      matthew   684:     }
                    685:     #
                    686:     # By sequence build up the data
                    687:     my $studentstats;
1.31      matthew   688:     my $PerformanceStr = '';
1.40      matthew   689:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
1.54      matthew   690:         my ($performance,$performance_length,$score,$seq_max,$rawdata);
                    691:         if ($base eq 'tries') {
                    692:             ($performance,$performance_length,$score,$seq_max,$rawdata) =
                    693:                 &StudentTriesOnSequence($student,\%StudentsData,
                    694:                                         $seq,$show_links);
                    695:         } else {
                    696:             ($performance,$performance_length,$score,$seq_max,$rawdata) =
                    697:                 &StudentPerformanceOnSequence($student,\%StudentsData,
                    698:                                               $seq,$show_links);
                    699:         }
                    700:         my $ratio = sprintf("%3d",$score).'/'.sprintf("%3d",$seq_max);
1.31      matthew   701:         #
1.54      matthew   702:         if ($data eq 'sum and total' || $data eq 'parts correct total') {
                    703:             $performance  = $ratio;
                    704:             $performance .= ' 'x($seq->{'width'}-length($ratio));
                    705:         } elsif ($data eq 'sum only' || $data eq 'parts correct') {
                    706:             $performance  = $score;
                    707:             $performance .= ' 'x($seq->{'width'}-length($score));
1.31      matthew   708:         } else {
                    709:             # Pad with extra spaces
1.51      matthew   710:             $performance .= ' 'x($seq->{'width'}-$performance_length-
1.31      matthew   711:                                  length($ratio)
                    712:                                  ).$ratio;
1.30      matthew   713:         }
1.31      matthew   714:         #
                    715:         $Str .= $performance.$padding;
                    716:         #
                    717:         $studentstats->{$seq->{'symb'}}->{'score'}= $score;
                    718:         $studentstats->{$seq->{'symb'}}->{'max'}  = $seq_max;
1.30      matthew   719:     }
                    720:     #
                    721:     # Total it up and store the statistics info.
                    722:     my ($score,$max) = (0,0);
                    723:     while (my ($symb,$seq_stats) = each (%{$studentstats})) {
                    724:         $Statistics->{$symb}->{'score'} += $seq_stats->{'score'};
1.54      matthew   725:         if ($Statistics->{$symb}->{'max'} < $seq_stats->{'max'}) {
                    726:             $Statistics->{$symb}->{'max'} = $seq_stats->{'max'};
                    727:         }
1.30      matthew   728:         $score += $seq_stats->{'score'};
                    729:         $max   += $seq_stats->{'max'};
                    730:     }
1.31      matthew   731:     $Str .= ' '.' 'x(length($max)-length($score)).$score.'/'.$max;
1.30      matthew   732:     $Str .= " \n";
1.39      matthew   733:     #
                    734:     # Check for suppressed output and update the progress window if so...
1.54      matthew   735:     if ($data =~ /^final table/) {
1.39      matthew   736:         $Str = '';
                    737:         &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
                    738:                                                  'last student');
                    739:     }
                    740:     #
1.31      matthew   741:     $r->print($Str);
                    742:     #
                    743:     $r->rflush();
                    744:     return;
1.30      matthew   745: }    
1.2       stredwic  746: 
1.31      matthew   747: sub html_finish {
                    748:     my ($r) = @_;
1.39      matthew   749:     #
                    750:     # Check for suppressed output and close the progress window if so
1.54      matthew   751:     if ($data =~ /^final table/) {
1.39      matthew   752:         &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
                    753:     } else {
                    754:         $r->print("</pre>\n"); 
                    755:     }
1.49      matthew   756:     if ($single_student_mode) {
                    757:         $r->print(&SingleStudentTotal());
                    758:     } else {
                    759:         $r->print(&StudentAverageTotal());
                    760:     }
1.31      matthew   761:     $r->rflush();
                    762:     return;
                    763: }
                    764: 
1.39      matthew   765: sub StudentAverageTotal {
                    766:     my $Str = "<h3>Summary Tables</h3>\n";
                    767:     my $num_students = scalar(@Apache::lonstatistics::Students);
                    768:     my $total_ave = 0;
                    769:     my $total_max = 0;
                    770:     $Str .= '<table border=2 cellspacing="1">'."\n";
                    771:     $Str .= "<tr><th>Title</th><th>Average</th><th>Maximum</th></tr>\n";
1.40      matthew   772:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
1.42      matthew   773:         my $ave;
                    774:         if ($num_students > $nodata_count) {
                    775:             $ave = int(100*($Statistics->{$seq->{'symb'}}->{'score'}/
                    776:                             ($num_students-$nodata_count)))/100;
                    777:         } else {
                    778:             $ave = 0;
                    779:         }
1.39      matthew   780:         $total_ave += $ave;
1.54      matthew   781:         my $max = $Statistics->{$seq->{'symb'}}->{'max'};
1.39      matthew   782:         $total_max += $max;
                    783:         if ($ave == 0) {
                    784:             $ave = "0.00";
                    785:         }
                    786:         $ave .= '&nbsp;';
                    787:         $max .= '&nbsp;&nbsp;&nbsp;';
                    788:         $Str .= '<tr><td>'.$seq->{'title'}.'</td>'.
                    789:             '<td align="right">'.$ave.'</td>'.
                    790:                 '<td align="right">'.$max.'</td></tr>'."\n";
                    791:     }
                    792:     $total_ave = int(100*$total_ave)/100; # only two digit
                    793:     $Str .= "</table>\n";
                    794:     $Str .= '<table border=2 cellspacing="1">'."\n";
                    795:     $Str .= '<tr><th>Number of Students</th><th>Average</th>'.
                    796:         "<th>Maximum</th></tr>\n";
                    797:     $Str .= '<tr><td>'.($num_students-$nodata_count).'</td>'.
                    798:         '<td>'.$total_ave.'</td><td>'.$total_max.'</td>';
                    799:     $Str .= "</table>\n";
                    800:     return $Str;
                    801: }
                    802: 
1.49      matthew   803: sub SingleStudentTotal {
                    804:     my $student = &Apache::lonstatistics::current_student();
1.52      matthew   805:     my $Str = "<h3>Summary table for ".$student->{'fullname'}." ".
                    806:         $student->{'username'}.'@'.$student->{'domain'}."</h3>\n";
1.49      matthew   807:     $Str .= '<table border=2 cellspacing="1">'."\n";
                    808:     $Str .= 
                    809:         "<tr><th>Sequence or Folder</th><th>Score</th><th>Maximum</th></tr>\n";
                    810:     my $total = 0;
                    811:     my $total_max = 0;
                    812:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
                    813:         my $value = $Statistics->{$seq->{'symb'}}->{'score'};
                    814:         my $max = $Statistics->{$seq->{'symb'}}->{'max'};
                    815:         $Str .= '<tr><td>'.$seq->{'title'}.'</td>'.
                    816:             '<td align="right">'.$value.'</td>'.
                    817:                 '<td align="right">'.$max.'</td></tr>'."\n";
                    818:         $total += $value;
                    819:         $total_max +=$max;
                    820:     }
                    821:     $Str .= '<tr><td><b>Total</b></td>'.
                    822:         '<td align="right">'.$total.'</td>'.
                    823:         '<td align="right">'.$total_max."</td></tr>\n";
                    824:     $Str .= "</table>\n";
                    825:     return $Str;
                    826: }
                    827: 
1.31      matthew   828: }
                    829: 
                    830: #######################################################
                    831: #######################################################
                    832: 
                    833: =pod
                    834: 
                    835: =head2 EXCEL subroutines
                    836: 
                    837: =item &excel_initialize($r)
                    838: 
                    839: =item &excel_outputstudent($r,$student)
                    840: 
                    841: =item &excel_finish($r)
                    842: 
                    843: =cut
                    844: 
                    845: #######################################################
                    846: #######################################################
                    847: {
                    848: 
                    849: my $excel_sheet;
1.32      matthew   850: my $excel_workbook;
                    851: 
                    852: my $filename;
                    853: my $rows_output;
                    854: my $cols_output;
                    855: 
1.36      matthew   856: my %prog_state; # progress window state
1.54      matthew   857: my $request_aborted;
1.31      matthew   858: 
                    859: sub excel_initialize {
                    860:     my ($r) = @_;
                    861:     #
1.66      matthew   862:     undef ($excel_sheet);
                    863:     undef ($excel_workbook);
                    864:     undef ($filename);
                    865:     undef ($rows_output);
                    866:     undef ($cols_output);
                    867:     undef (%prog_state);
                    868:     undef ($request_aborted);
                    869:     #
1.54      matthew   870:     my $total_columns = scalar(&get_student_fields_to_show());
                    871:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
                    872:         # Add 2 because we need a 'sum' and 'total' column for each
                    873:         $total_columns += $seq->{'num_assess_parts'}+2;
                    874:     }
                    875:     if ($data eq 'tries' && $total_columns > 255) {
                    876:         $r->print(<<END);
                    877: <h2>Unable to Complete Request</h2>
                    878: <p>
                    879: LON-CAPA is unable to produce your Excel spreadsheet because your selections
                    880: will result in more than 255 columns.  Excel allows only 255 columns in a
                    881: spreadsheet.
                    882: </p><p>
                    883: You may consider reducing the number of <b>Sequences or Folders</b> you
                    884: have selected.  
                    885: </p><p>
                    886: LON-CAPA can produce <b>CSV</b> files of this data or Excel files of the
                    887: summary data (<b>Parts Correct</b> or <b>Parts Correct & Totals</b>).
                    888: </p>
                    889: END
                    890:        $request_aborted = 1;
                    891:     }
                    892:     if ($data eq 'scores' && $total_columns > 255) {
                    893:         $r->print(<<END);
                    894: <h2>Unable to Complete Request</h2>
                    895: <p>
                    896: LON-CAPA is unable to produce your Excel spreadsheet because your selections
                    897: will result in more than 255 columns.  Excel allows only 255 columns in a
                    898: spreadsheet.
                    899: </p><p>
                    900: You may consider reducing the number of <b>Sequences or Folders</b> you
                    901: have selected.  
                    902: </p><p>
                    903: LON-CAPA can produce <b>CSV</b> files of this data or Excel files of the
                    904: summary data (<b>Scores Sum</b> or <b>Scores Sum & Totals</b>).
                    905: </p>
                    906: END
                    907:        $request_aborted = 1;
                    908:     }
                    909:     if ($data =~ /^final table/) {
                    910:         $r->print(<<END);
                    911: <h2>Unable to Complete Request</h2>
                    912: <p>
                    913: The <b>Summary Table (Scores)</b> option is not available for non-HTML output.
                    914: </p>
                    915: END
                    916:        $request_aborted = 1;
                    917:     }
                    918:     return if ($request_aborted);
                    919:     #
1.32      matthew   920:     $filename = '/prtspool/'.
1.31      matthew   921:         $ENV{'user.name'}.'_'.$ENV{'user.domain'}.'_'.
                    922:             time.'_'.rand(1000000000).'.xls';
1.32      matthew   923:     #
                    924:     $excel_workbook = undef;
                    925:     $excel_sheet = undef;
                    926:     #
                    927:     $rows_output = 0;
                    928:     $cols_output = 0;
                    929:     #
                    930:     # Create sheet
                    931:     $excel_workbook = Spreadsheet::WriteExcel->new('/home/httpd'.$filename);
                    932:     #
                    933:     # Check for errors
                    934:     if (! defined($excel_workbook)) {
1.31      matthew   935:         $r->log_error("Error creating excel spreadsheet $filename: $!");
                    936:         $r->print("Problems creating new Excel file.  ".
                    937:                   "This error has been logged.  ".
                    938:                   "Please alert your LON-CAPA administrator");
1.32      matthew   939:         return ;
1.31      matthew   940:     }
                    941:     #
                    942:     # The excel spreadsheet stores temporary data in files, then put them
                    943:     # together.  If needed we should be able to disable this (memory only).
                    944:     # The temporary directory must be specified before calling 'addworksheet'.
                    945:     # File::Temp is used to determine the temporary directory.
1.32      matthew   946:     $excel_workbook->set_tempdir($Apache::lonnet::tmpdir);
                    947:     #
                    948:     # Add a worksheet
1.33      matthew   949:     my $sheetname = $ENV{'course.'.$ENV{'request.course.id'}.'.description'};
1.67      matthew   950:     $sheetname = &Apache::loncommon::clean_excel_name($sheetname);
1.33      matthew   951:     $excel_sheet = $excel_workbook->addworksheet($sheetname);
1.32      matthew   952:     #
1.34      matthew   953:     # Put the course description in the header
                    954:     $excel_sheet->write($rows_output,$cols_output++,
                    955:                    $ENV{'course.'.$ENV{'request.course.id'}.'.description'});
                    956:     $cols_output += 3;
                    957:     #
                    958:     # Put a description of the sections listed
                    959:     my $sectionstring = '';
                    960:     my @Sections = @Apache::lonstatistics::SelectedSections;
                    961:     if (scalar(@Sections) > 1) {
                    962:         if (scalar(@Sections) > 2) {
                    963:             my $last = pop(@Sections);
                    964:             $sectionstring = "Sections ".join(', ',@Sections).', and '.$last;
                    965:         } else {
                    966:             $sectionstring = "Sections ".join(' and ',@Sections);
                    967:         }
                    968:     } else {
                    969:         if ($Sections[0] eq 'all') {
                    970:             $sectionstring = "All sections";
                    971:         } else {
                    972:             $sectionstring = "Section ".$Sections[0];
                    973:         }
                    974:     }
                    975:     $excel_sheet->write($rows_output,$cols_output++,$sectionstring);
                    976:     $cols_output += scalar(@Sections);
                    977:     #
                    978:     # Put the date in there too
1.54      matthew   979:     $excel_sheet->write($rows_output++,$cols_output++,
1.34      matthew   980:                         'Compiled on '.localtime(time));
                    981:     #
1.54      matthew   982:     $cols_output = 0;
                    983:     $excel_sheet->write($rows_output++,$cols_output++,$datadescription);
                    984:     #
                    985:     if ($data eq 'tries' || $data eq 'scores') {
                    986:         $rows_output++;
                    987:     }
1.34      matthew   988:     #
1.32      matthew   989:     # Add the student headers
1.34      matthew   990:     $cols_output = 0;
1.32      matthew   991:     foreach my $field (&get_student_fields_to_show()) {
1.34      matthew   992:         $excel_sheet->write($rows_output,$cols_output++,$field);
1.32      matthew   993:     }
1.54      matthew   994:     my $row_offset = 0;
                    995:     if ($data eq 'tries' || $data eq 'scores') {
                    996:         $row_offset = -1;
                    997:     }
1.32      matthew   998:     #
1.54      matthew   999:     # Add the remaining column headers
1.40      matthew  1000:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
1.54      matthew  1001:         $excel_sheet->write($rows_output+$row_offset,
                   1002:                             $cols_output,$seq->{'title'});
                   1003:         if ($data eq 'tries' || $data eq 'scores') {
                   1004:             foreach my $res (@{$seq->{'contents'}}) {
                   1005:                 next if ($res->{'type'} ne 'assessment');
                   1006:                 if (scalar(@{$res->{'parts'}}) > 1) {
                   1007:                     foreach my $part (@{$res->{'parts'}}) {
                   1008:                         $excel_sheet->write($rows_output,
                   1009:                                             $cols_output++,
                   1010:                                             $res->{'title'}.' part '.$part);
                   1011:                     }
                   1012:                 } else {
                   1013:                     $excel_sheet->write($rows_output,
                   1014:                                         $cols_output++,
                   1015:                                         $res->{'title'});
                   1016:                 }
                   1017:             }
                   1018:             $excel_sheet->write($rows_output,$cols_output++,'score');
                   1019:             $excel_sheet->write($rows_output,$cols_output++,'maximum');
                   1020:         } elsif ($data eq 'sum and total' || $data eq 'parts correct total') {
1.34      matthew  1021:             $excel_sheet->write($rows_output+1,$cols_output,'score');
                   1022:             $excel_sheet->write($rows_output+1,$cols_output+1,'maximum');
1.32      matthew  1023:             $cols_output += 2;
                   1024:         } else {
                   1025:             $cols_output++;
                   1026:         }
                   1027:     }
                   1028:     #
                   1029:     # Bookkeeping
1.54      matthew  1030:     if ($data eq 'sum and total' || $data eq 'parts correct total') {
1.34      matthew  1031:         $rows_output += 2;
1.32      matthew  1032:     } else {
1.34      matthew  1033:         $rows_output += 1;
1.45      matthew  1034:     }
                   1035:     #
                   1036:     # Output a row for MAX
1.54      matthew  1037:     $cols_output = 0;
                   1038:     foreach my $field (&get_student_fields_to_show()) {
                   1039:         if ($field eq 'username' || $field eq 'fullname' || 
                   1040:             $field eq 'id') {
                   1041:             $excel_sheet->write($rows_output,$cols_output++,'Maximum');
                   1042:         } else {
                   1043:             $excel_sheet->write($rows_output,$cols_output++,'');
                   1044:         }
                   1045:     }
                   1046:     #
                   1047:     # Add the maximums for each sequence or assessment
                   1048:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
                   1049:         my $weight;
                   1050:         my $max = 0;
                   1051:         foreach my $resource (@{$seq->{'contents'}}) {
                   1052:             next if ($resource->{'type'} ne 'assessment');
                   1053:             foreach my $part (@{$resource->{'parts'}}) {
                   1054:                 $weight = 1;
                   1055:                 if ($base eq 'scores') {
                   1056:                     $weight = &Apache::lonnet::EXT
                   1057:                         ('resource.'.$part.'.weight',$resource->{'symb'},
                   1058:                          undef,undef,undef);
                   1059:                     if (!defined($weight) || ($weight eq '')) { 
                   1060:                         $weight=1;
                   1061:                     }
                   1062:                 }
                   1063:                 if ($data eq 'scores') {
                   1064:                     $excel_sheet->write($rows_output,$cols_output++,$weight);
                   1065:                 } elsif ($data eq 'tries') {
                   1066:                     $excel_sheet->write($rows_output,$cols_output++,'');
                   1067:                 }
                   1068:                 $max += $weight;
1.45      matthew  1069:             }
1.54      matthew  1070:         } 
                   1071:         if (! ($data eq 'sum only' || $data eq 'parts correct')) {
                   1072:             $excel_sheet->write($rows_output,$cols_output++,'');
1.45      matthew  1073:         }
1.54      matthew  1074:         $excel_sheet->write($rows_output,$cols_output++,$max);
1.32      matthew  1075:     }
1.54      matthew  1076:     $rows_output++;
1.32      matthew  1077:     #
                   1078:     # Let the user know what we are doing
                   1079:     my $studentcount = scalar(@Apache::lonstatistics::Students); 
                   1080:     $r->print("<h1>Compiling Excel spreadsheet for ".
                   1081:               $studentcount.' student');
                   1082:     $r->print('s') if ($studentcount > 1);
                   1083:     $r->print("</h1>\n");
                   1084:     $r->rflush();
1.31      matthew  1085:     #
1.36      matthew  1086:     # Initialize progress window
                   1087:     %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
                   1088:         ($r,'Excel File Compilation Status',
                   1089:          'Excel File Compilation Progress', $studentcount);
                   1090:     #
1.62      matthew  1091:     &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,
                   1092:                                           'Processing first student');
1.31      matthew  1093:     return;
                   1094: }
                   1095: 
                   1096: sub excel_outputstudent {
                   1097:     my ($r,$student) = @_;
1.54      matthew  1098:     return if ($request_aborted);
1.32      matthew  1099:     return if (! defined($excel_sheet));
                   1100:     $cols_output=0;
                   1101:     #
                   1102:     # Write out student data
                   1103:     my @to_show = &get_student_fields_to_show();
                   1104:     foreach my $field (@to_show) {
                   1105:         $excel_sheet->write($rows_output,$cols_output++,$student->{$field});
                   1106:     }
                   1107:     #
                   1108:     # Get student assessment data
                   1109:     my %StudentsData;
                   1110:     my @tmp = &Apache::loncoursedata::get_current_state($student->{'username'},
                   1111:                                                         $student->{'domain'},
                   1112:                                                         undef,
                   1113:                                                    $ENV{'request.course.id'});
                   1114:     if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:/)) {
                   1115:         %StudentsData = @tmp;
                   1116:     }
                   1117:     #
                   1118:     # Write out sequence scores and totals data
1.40      matthew  1119:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
1.54      matthew  1120:         my ($performance,$performance_length,$score,$seq_max,$rawdata);
                   1121:         if ($base eq 'tries') {
                   1122:             ($performance,$performance_length,$score,$seq_max,$rawdata) =
                   1123:                 &StudentTriesOnSequence($student,\%StudentsData,
                   1124:                                         $seq,'no');
                   1125:         } else {
                   1126:             ($performance,$performance_length,$score,$seq_max,$rawdata) =
                   1127:                 &StudentPerformanceOnSequence($student,\%StudentsData,
                   1128:                                               $seq,'no');
                   1129:         }
                   1130:         if ($data eq 'tries' || $data eq 'scores') {
                   1131:             foreach my $value (@$rawdata) {
                   1132:                 $excel_sheet->write($rows_output,$cols_output++,$value);
                   1133:             }
                   1134:             $excel_sheet->write($rows_output,$cols_output++,$score);
                   1135:             $excel_sheet->write($rows_output,$cols_output++,$seq_max);
                   1136:         } elsif ($data eq 'sum and total' || $data eq 'sum only' || 
                   1137:             $data eq 'parts correct' || $data eq 'parts correct total') {
1.32      matthew  1138:             $excel_sheet->write($rows_output,$cols_output++,$score);
                   1139:         }
1.54      matthew  1140:         if ($data eq 'sum and total' || $data eq 'parts correct total') {
1.32      matthew  1141:             $excel_sheet->write($rows_output,$cols_output++,$seq_max);
                   1142:         }
                   1143:     }
                   1144:     #
                   1145:     # Bookkeeping
                   1146:     $rows_output++; 
                   1147:     $cols_output=0;
                   1148:     #
1.36      matthew  1149:     # Update the progress window
                   1150:     &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,'last student');
1.32      matthew  1151:     return;
1.31      matthew  1152: }
                   1153: 
                   1154: sub excel_finish {
                   1155:     my ($r) = @_;
1.54      matthew  1156:     return if ($request_aborted);
1.32      matthew  1157:     return if (! defined($excel_sheet));
                   1158:     #
                   1159:     # Write the excel file
                   1160:     $excel_workbook->close();
                   1161:     my $c = $r->connection();
                   1162:     #
                   1163:     return if($c->aborted());
                   1164:     #
1.36      matthew  1165:     # Close the progress window
                   1166:     &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
                   1167:     #
1.32      matthew  1168:     # Tell the user where to get their excel file
1.36      matthew  1169:     $r->print('<br />'.
1.32      matthew  1170:               '<a href="'.$filename.'">Your Excel spreadsheet.</a>'."\n");
                   1171:     $r->rflush();
                   1172:     return;
1.31      matthew  1173: }
                   1174: 
                   1175: }
1.30      matthew  1176: #######################################################
                   1177: #######################################################
                   1178: 
                   1179: =pod
                   1180: 
1.31      matthew  1181: =head2 CSV output routines
                   1182: 
                   1183: =item &csv_initialize($r)
                   1184: 
                   1185: =item &csv_outputstudent($r,$student)
                   1186: 
                   1187: =item &csv_finish($r)
1.30      matthew  1188: 
                   1189: =cut
                   1190: 
                   1191: #######################################################
                   1192: #######################################################
1.31      matthew  1193: {
                   1194: 
1.37      matthew  1195: my $outputfile;
                   1196: my $filename;
1.54      matthew  1197: my $request_aborted;
1.37      matthew  1198: my %prog_state; # progress window state
                   1199: 
1.31      matthew  1200: sub csv_initialize{
                   1201:     my ($r) = @_;
1.37      matthew  1202:     # 
                   1203:     # Clean up
1.66      matthew  1204:     undef($outputfile);
                   1205:     undef($filename);
                   1206:     undef($request_aborted);
1.37      matthew  1207:     undef(%prog_state);
                   1208:     #
1.54      matthew  1209:     # Deal with unimplemented requests
                   1210:     $request_aborted = undef;
                   1211:     if ($data =~ /final table/) {
                   1212:         $r->print(<<END);
                   1213: <h2>Unable to Complete Request</h2>
                   1214: <p>
                   1215: The <b>Summary Table (Scores)</b> option is not available for non-HTML output.
                   1216: </p>
                   1217: END
                   1218:        $request_aborted = 1;
                   1219:     }
                   1220:     return if ($request_aborted);
                   1221: 
                   1222:     #
1.37      matthew  1223:     # Open a file
                   1224:     $filename = '/prtspool/'.
                   1225:         $ENV{'user.name'}.'_'.$ENV{'user.domain'}.'_'.
                   1226:             time.'_'.rand(1000000000).'.csv';
                   1227:     unless ($outputfile = Apache::File->new('>/home/httpd'.$filename)) {
                   1228:         $r->log_error("Couldn't open $filename for output $!");
                   1229:         $r->print("Problems occured in writing the csv file.  ".
                   1230:                   "This error has been logged.  ".
                   1231:                   "Please alert your LON-CAPA administrator.");
                   1232:         $outputfile = undef;
                   1233:     }
1.38      matthew  1234:     #
                   1235:     # Datestamp
                   1236:     my $description = $ENV{'course.'.$ENV{'request.course.id'}.'.description'};
                   1237:     print $outputfile '"'.&Apache::loncommon::csv_translate($description).'",'.
                   1238:         '"'.&Apache::loncommon::csv_translate(scalar(localtime(time))).'"'.
                   1239:             "\n";
1.37      matthew  1240:     #
                   1241:     # Print out the headings
                   1242:     my $Str = '';
                   1243:     my $Str2 = undef;
                   1244:     foreach my $field (&get_student_fields_to_show()) {
1.54      matthew  1245:         if ($data eq 'sum only') {
1.37      matthew  1246:             $Str .= '"'.&Apache::loncommon::csv_translate($field).'",';
1.54      matthew  1247:         } elsif ($data eq 'sum and total' || $data eq 'parts correct total') {
1.37      matthew  1248:             $Str .= '"",'; # first row empty on the student fields
                   1249:             $Str2 .= '"'.&Apache::loncommon::csv_translate($field).'",';
1.54      matthew  1250:         } elsif ($data eq 'scores' || $data eq 'tries' || 
                   1251:                  $data eq 'parts correct') {
1.53      matthew  1252:             $Str  .= '"",';
                   1253:             $Str2 .= '"'.&Apache::loncommon::csv_translate($field).'",';
1.37      matthew  1254:         }
                   1255:     }
1.40      matthew  1256:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
1.54      matthew  1257:         if ($data eq 'sum only' || $data eq 'parts correct') {
1.37      matthew  1258:             $Str .= '"'.&Apache::loncommon::csv_translate($seq->{'title'}).
                   1259:                 '",';
1.54      matthew  1260:         } elsif ($data eq 'sum and total' || $data eq 'parts correct total') {
1.37      matthew  1261:             $Str  .= '"'.&Apache::loncommon::csv_translate($seq->{'title'}).
                   1262:                 '","",';
                   1263:             $Str2 .= '"score","total possible",';
1.54      matthew  1264:         } elsif ($data eq 'scores' || $data eq 'tries') {
1.37      matthew  1265:             $Str  .= '"'.&Apache::loncommon::csv_translate($seq->{'title'}).
                   1266:                 '",';
1.53      matthew  1267:             $Str .= '"",'x($seq->{'num_assess_parts'}-1+2);
                   1268:             foreach my $res (@{$seq->{'contents'}}) {
1.54      matthew  1269:                 next if ($res->{'type'} ne 'assessment');
1.53      matthew  1270:                 foreach my $part (@{$res->{'parts'}}) {
                   1271:                     $Str2 .= '"'.&Apache::loncommon::csv_translate($res->{'title'}.', Part '.$part).'",';
                   1272:                 }
                   1273:             }
                   1274:             $Str2 .= '"score","total possible",';
1.37      matthew  1275:         }
                   1276:     }
                   1277:     chop($Str);
                   1278:     $Str .= "\n";
                   1279:     print $outputfile $Str;
                   1280:     if (defined($Str2)) {
                   1281:         chop($Str2);
                   1282:         $Str2 .= "\n";
                   1283:         print $outputfile $Str2;
                   1284:     }
                   1285:     #
                   1286:     # Initialize progress window
                   1287:     my $studentcount = scalar(@Apache::lonstatistics::Students);
                   1288:     %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
                   1289:         ($r,'CSV File Compilation Status',
                   1290:          'CSV File Compilation Progress', $studentcount);
1.31      matthew  1291:     return;
                   1292: }
                   1293: 
                   1294: sub csv_outputstudent {
                   1295:     my ($r,$student) = @_;
1.54      matthew  1296:     return if ($request_aborted);
1.37      matthew  1297:     return if (! defined($outputfile));
                   1298:     my $Str = '';
                   1299:     #
                   1300:     # Output student fields
                   1301:     my @to_show = &get_student_fields_to_show();
                   1302:     foreach my $field (@to_show) {
                   1303:         $Str .= '"'.&Apache::loncommon::csv_translate($student->{$field}).'",';
                   1304:     }
                   1305:     #
                   1306:     # Get student assessment data
                   1307:     my %StudentsData;
                   1308:     my @tmp = &Apache::loncoursedata::get_current_state($student->{'username'},
                   1309:                                                         $student->{'domain'},
                   1310:                                                         undef,
                   1311:                                                    $ENV{'request.course.id'});
                   1312:     if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:/)) {
                   1313:         %StudentsData = @tmp;
                   1314:     }
                   1315:     #
                   1316:     # Output performance data
1.40      matthew  1317:     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
1.54      matthew  1318:         my ($performance,$performance_length,$score,$seq_max,$rawdata);
                   1319:         if ($base eq 'tries') {
                   1320:             ($performance,$performance_length,$score,$seq_max,$rawdata) =
                   1321:                 &StudentTriesOnSequence($student,\%StudentsData,
                   1322:                                         $seq,'no');
                   1323:         } else {
                   1324:             ($performance,$performance_length,$score,$seq_max,$rawdata) =
                   1325:                 &StudentPerformanceOnSequence($student,\%StudentsData,
                   1326:                                               $seq,'no');
                   1327:         }
                   1328:         if ($data eq 'sum only' || $data eq 'parts correct') {
1.37      matthew  1329:             $Str .= '"'.$score.'",';
1.54      matthew  1330:         } elsif ($data eq 'sum and total' || $data eq 'parts correct total') {
1.37      matthew  1331:             $Str  .= '"'.$score.'","'.$seq_max.'",';
1.54      matthew  1332:         } elsif ($data eq 'scores' || $data eq 'tries') {
                   1333:             $Str .= '"'.join('","',(@$rawdata,$score,$seq_max)).'",';
1.37      matthew  1334:         }
                   1335:     }
                   1336:     chop($Str);
                   1337:     $Str .= "\n";
                   1338:     print $outputfile $Str;
                   1339:     #
                   1340:     # Update the progress window
                   1341:     &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,'last student');
                   1342:     return;
1.31      matthew  1343: }
                   1344: 
                   1345: sub csv_finish {
                   1346:     my ($r) = @_;
1.54      matthew  1347:     return if ($request_aborted);
1.37      matthew  1348:     return if (! defined($outputfile));
                   1349:     close($outputfile);
                   1350:     #
                   1351:     my $c = $r->connection();
                   1352:     return if ($c->aborted());
                   1353:     #
                   1354:     # Close the progress window
                   1355:     &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
                   1356:     #
                   1357:     # Tell the user where to get their csv file
                   1358:     $r->print('<br />'.
                   1359:               '<a href="'.$filename.'">Your csv file.</a>'."\n");
                   1360:     $r->rflush();
                   1361:     return;
                   1362:     
1.31      matthew  1363: }
1.2       stredwic 1364: 
                   1365: }
                   1366: 
1.28      matthew  1367: #######################################################
                   1368: #######################################################
                   1369: 
1.2       stredwic 1370: =pod
                   1371: 
1.54      matthew  1372: =item &StudentTriesOnSequence()
1.2       stredwic 1373: 
1.30      matthew  1374: Inputs:
1.2       stredwic 1375: 
                   1376: =over 4
                   1377: 
1.30      matthew  1378: =item $student
1.28      matthew  1379: 
1.30      matthew  1380: =item $studentdata Hash ref to all student data
1.2       stredwic 1381: 
1.30      matthew  1382: =item $seq Hash ref, the sequence we are working on
1.2       stredwic 1383: 
1.30      matthew  1384: =item $links if defined we will output links to each resource.
1.2       stredwic 1385: 
1.28      matthew  1386: =back
1.2       stredwic 1387: 
                   1388: =cut
1.1       stredwic 1389: 
1.28      matthew  1390: #######################################################
                   1391: #######################################################
1.54      matthew  1392: sub StudentTriesOnSequence {
1.32      matthew  1393:     my ($student,$studentdata,$seq,$links) = @_;
1.31      matthew  1394:     $links = 'no' if (! defined($links));
1.1       stredwic 1395:     my $Str = '';
1.30      matthew  1396:     my ($sum,$max) = (0,0);
1.51      matthew  1397:     my $performance_length = 0;
1.54      matthew  1398:     my @TriesData = ();
                   1399:     my $tries;
1.30      matthew  1400:     foreach my $resource (@{$seq->{'contents'}}) {
                   1401:         next if ($resource->{'type'} ne 'assessment');
                   1402:         my $resource_data = $studentdata->{$resource->{'symb'}};
                   1403:         my $value = '';
                   1404:         foreach my $partnum (@{$resource->{'parts'}}) {
1.54      matthew  1405:             $tries = undef;
1.30      matthew  1406:             $max++;
1.51      matthew  1407:             $performance_length++;
1.30      matthew  1408:             my $symbol = ' '; # default to space
                   1409:             #
                   1410:             if (exists($resource_data->{'resource.'.$partnum.'.solved'})) {
                   1411:                 my $status = $resource_data->{'resource.'.$partnum.'.solved'};
                   1412:                 if ($status eq 'correct_by_override') {
                   1413:                     $symbol = '+';
                   1414:                     $sum++;
                   1415:                 } elsif ($status eq 'incorrect_by_override') {
                   1416:                     $symbol = '-';
                   1417:                 } elsif ($status eq 'ungraded_attempted') {
                   1418:                     $symbol = '#';
                   1419:                 } elsif ($status eq 'incorrect_attempted')  {
                   1420:                     $symbol = '.';
                   1421:                 } elsif ($status eq 'excused') {
                   1422:                     $symbol = 'x';
                   1423:                     $max--;
1.68      matthew  1424:                 } elsif (($status eq 'correct_by_scantron' ||
                   1425:                           $status eq 'correct_by_student') &&
1.30      matthew  1426:                     exists($resource_data->{'resource.'.$partnum.'.tries'})){
1.54      matthew  1427:                     $tries = $resource_data->{'resource.'.$partnum.'.tries'};
                   1428:                     if ($tries > 9) {
1.30      matthew  1429:                         $symbol = '*';
1.54      matthew  1430:                     } elsif ($tries > 0) {
                   1431:                         $symbol = $tries;
1.30      matthew  1432:                     } else {
                   1433:                         $symbol = ' ';
                   1434:                     }
                   1435:                     $sum++;
1.43      matthew  1436:                 } elsif (exists($resource_data->{'resource.'.
                   1437:                                                      $partnum.'.tries'})){
                   1438:                     $symbol = '.';
1.30      matthew  1439:                 } else {
                   1440:                     $symbol = ' ';
1.2       stredwic 1441:                 }
1.30      matthew  1442:             } else {
                   1443:                 # Unsolved.  Did they try?
                   1444:                 if (exists($resource_data->{'resource.'.$partnum.'.tries'})){
                   1445:                     $symbol = '.';
                   1446:                 } else {
                   1447:                     $symbol = ' ';
1.18      matthew  1448:                 }
1.2       stredwic 1449:             }
1.54      matthew  1450:             #
                   1451:             if (! defined($tries)) {
                   1452:                 $tries = $symbol;
                   1453:             }
                   1454:             push (@TriesData,$tries);
1.30      matthew  1455:             #
1.47      matthew  1456:             if ( ($links eq 'yes' && $symbol ne ' ') ||
                   1457:                  ($links eq 'all')) {
1.49      matthew  1458:                 if (length($symbol) > 1) {
                   1459:                     &Apache::lonnet::logthis('length of symbol "'.$symbol.'" > 1');
                   1460:                 }
1.30      matthew  1461:                 $symbol = '<a href="/adm/grades'.
                   1462:                     '?symb='.&Apache::lonnet::escape($resource->{'symb'}).
                   1463:                         '&student='.$student->{'username'}.
1.64      albertel 1464:                             '&userdom='.$student->{'domain'}.
1.30      matthew  1465:                                 '&command=submission">'.$symbol.'</a>';
                   1466:             }
                   1467:             $value .= $symbol;
1.2       stredwic 1468:         }
1.30      matthew  1469:         $Str .= $value;
1.17      minaeibi 1470:     }
1.51      matthew  1471:     if ($seq->{'randompick'}) {
                   1472:         $max = $seq->{'randompick'};
                   1473:     }
1.54      matthew  1474:     return ($Str,$performance_length,$sum,$max,\@TriesData);
                   1475: }
                   1476: 
                   1477: #######################################################
                   1478: #######################################################
                   1479: 
                   1480: =pod
                   1481: 
                   1482: =item &StudentPerformanceOnSequence()
                   1483: 
                   1484: Inputs:
                   1485: 
                   1486: =over 4
                   1487: 
                   1488: =item $student
                   1489: 
                   1490: =item $studentdata Hash ref to all student data
                   1491: 
                   1492: =item $seq Hash ref, the sequence we are working on
                   1493: 
                   1494: =item $links if defined we will output links to each resource.
                   1495: 
                   1496: =back
                   1497: 
                   1498: =cut
                   1499: 
                   1500: #######################################################
                   1501: #######################################################
                   1502: sub StudentPerformanceOnSequence {
                   1503:     my ($student,$studentdata,$seq,$links) = @_;
                   1504:     $links = 'no' if (! defined($links));
                   1505:     my $Str = ''; # final result string
                   1506:     my ($score,$max) = (0,0);
                   1507:     my $performance_length = 0;
                   1508:     my $symbol;
                   1509:     my @ScoreData = ();
                   1510:     my $partscore;
                   1511:     foreach my $resource (@{$seq->{'contents'}}) {
                   1512:         next if ($resource->{'type'} ne 'assessment');
                   1513:         my $resource_data = $studentdata->{$resource->{'symb'}};
                   1514:         foreach my $part (@{$resource->{'parts'}}) {
                   1515:             $partscore = undef;
                   1516:             my $weight = &Apache::lonnet::EXT('resource.'.$part.'.weight',
                   1517:                                               $resource->{'symb'},
                   1518:                                               $student->{'domain'},
                   1519:                                               $student->{'username'},
                   1520:                                               $student->{'section'});
                   1521:             if (!defined($weight) || ($weight eq '')) { 
                   1522:                 $weight=1;
                   1523:             }
                   1524:             #
                   1525:             $max += $weight; # see the 'excused' branch below...
                   1526:             $performance_length++; # one character per part
                   1527:             $symbol = ' '; # default to space
                   1528:             #
                   1529:             my $awarded = 0;
                   1530:             if (exists($resource_data->{'resource.'.$part.'.awarded'})) {
                   1531:                 $awarded = $resource_data->{'resource.'.$part.'.awarded'};
1.67      matthew  1532:                 $awarded = 0 if (! $awarded);
1.54      matthew  1533:             }
                   1534:             #
                   1535:             $partscore = $weight*$awarded;
                   1536:             $score += $partscore;
1.63      matthew  1537:             $symbol = $partscore; 
1.70      matthew  1538:             if (abs($symbol - sprintf("%.0f",$symbol)) < 0.001) {
                   1539:                 $symbol = sprintf("%.0f",$symbol);
                   1540:             }
1.54      matthew  1541:             if (length($symbol) > 1) {
                   1542:                 $symbol = '*';
                   1543:             }
                   1544:             if (exists($resource_data->{'resource.'.$part.'.solved'})) {
                   1545:                 my $status = $resource_data->{'resource.'.$part.'.solved'};
                   1546:                 if ($status eq 'excused') {
                   1547:                     $symbol = 'x';
                   1548:                     $max -= $weight; # Do not count 'excused' problems.
                   1549:                 }
                   1550:             } else {
                   1551:                 # Unsolved.  Did they try?
                   1552:                 if (exists($resource_data->{'resource.'.$part.'.tries'})){
                   1553:                     $symbol = '.';
                   1554:                 } else {
                   1555:                     $symbol = ' ';
                   1556:                 }
                   1557:             }
                   1558:             #
1.60      matthew  1559:             if (! defined($partscore)) {
                   1560:                 $partscore = $symbol;
                   1561:             }
                   1562:             push (@ScoreData,$partscore);
                   1563:             #
1.54      matthew  1564:             if ( ($links eq 'yes' && $symbol ne ' ') || ($links eq 'all')) {
                   1565:                 $symbol = '<a href="/adm/grades'.
                   1566:                     '?symb='.&Apache::lonnet::escape($resource->{'symb'}).
                   1567:                     '&student='.$student->{'username'}.
1.64      albertel 1568:                     '&userdom='.$student->{'domain'}.
1.54      matthew  1569:                     '&command=submission">'.$symbol.'</a>';
                   1570:             }
1.60      matthew  1571:             $Str .= $symbol;
1.54      matthew  1572:         }
                   1573:     }
                   1574:     return ($Str,$performance_length,$score,$max,\@ScoreData);
1.1       stredwic 1575: }
1.23      minaeibi 1576: 
1.28      matthew  1577: #######################################################
                   1578: #######################################################
1.23      minaeibi 1579: 
1.2       stredwic 1580: =pod
                   1581: 
                   1582: =item &CreateLegend()
                   1583: 
                   1584: This function returns a formatted string containing the legend for the
                   1585: chart.  The legend describes the symbols used to represent grades for
                   1586: problems.
                   1587: 
                   1588: =cut
                   1589: 
1.28      matthew  1590: #######################################################
                   1591: #######################################################
1.2       stredwic 1592: sub CreateLegend {
                   1593:     my $Str = "<p><pre>".
1.13      minaeibi 1594:               "   1  correct by student in 1 try\n".
                   1595:               "   7  correct by student in 7 tries\n".
1.12      minaeibi 1596:               "   *  correct by student in more than 9 tries\n".
1.20      minaeibi 1597: 	      "   +  correct by hand grading or override\n".
1.12      minaeibi 1598:               "   -  incorrect by override\n".
                   1599: 	      "   .  incorrect attempted\n".
                   1600: 	      "   #  ungraded attempted\n".
1.13      minaeibi 1601:               "      not attempted (blank field)\n".
1.12      minaeibi 1602: 	      "   x  excused".
1.17      minaeibi 1603:               "</pre><p>";
1.2       stredwic 1604:     return $Str;
                   1605: }
                   1606: 
1.28      matthew  1607: #######################################################
                   1608: #######################################################
                   1609: 
1.30      matthew  1610: =pod 
1.2       stredwic 1611: 
                   1612: =back
                   1613: 
                   1614: =cut
                   1615: 
1.28      matthew  1616: #######################################################
                   1617: #######################################################
1.2       stredwic 1618: 
1.28      matthew  1619: 1;
1.2       stredwic 1620: 
1.1       stredwic 1621: __END__

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>