Annotation of loncom/interface/statistics/lonstudentassessment.pm, revision 1.163
1.1 stredwic 1: # The LearningOnline Network with CAPA
2: #
1.163 ! www 3: # $Id: lonstudentassessment.pm,v 1.162 2010/06/09 14:55:27 bisitz 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.136 albertel 53: use Apache::lonstatistics();
1.163 ! www 54: use Apache::lonquickgrades();
1.136 albertel 55: use Apache::lonhtmlcommon();
1.77 matthew 56: use Apache::loncommon();
1.1 stredwic 57: use Apache::loncoursedata;
1.28 matthew 58: use Apache::lonnet; # for logging porpoises
1.75 matthew 59: use Apache::lonlocal;
1.136 albertel 60: use Apache::grades();
61: use Apache::lonmsgdisplay();
1.112 matthew 62: use Time::HiRes;
1.31 matthew 63: use Spreadsheet::WriteExcel;
1.76 matthew 64: use Spreadsheet::WriteExcel::Utility();
1.140 www 65: use lib '/home/httpd/lib/perl/';
66: use LONCAPA;
67:
1.31 matthew 68:
69: #######################################################
70: #######################################################
71: =pod
72:
73: =item Package Variables
74:
75: =over 4
76:
77: =item $Statistics Hash ref to store student data. Indexed by symb,
78: contains hashes with keys 'score' and 'max'.
79:
80: =cut
81:
82: #######################################################
83: #######################################################
1.1 stredwic 84:
1.30 matthew 85: my $Statistics;
86:
1.28 matthew 87: #######################################################
88: #######################################################
89:
90: =pod
91:
1.31 matthew 92: =item $show_links 'yes' or 'no' for linking to student performance data
93:
94: =item $output_mode 'html', 'excel', or 'csv' for output mode
95:
1.32 matthew 96: =item $show 'all', 'totals', or 'scores' determines how much data is output
1.31 matthew 97:
1.49 matthew 98: =item $single_student_mode evaluates to true if we are showing only one
99: student.
100:
1.31 matthew 101: =cut
102:
103: #######################################################
104: #######################################################
105: my $show_links;
106: my $output_mode;
1.87 matthew 107: my $chosen_output;
1.49 matthew 108: my $single_student_mode;
1.28 matthew 109:
1.31 matthew 110: #######################################################
111: #######################################################
112: # End of package variable declarations
1.28 matthew 113:
1.31 matthew 114: =pod
1.28 matthew 115:
1.31 matthew 116: =back
1.28 matthew 117:
1.31 matthew 118: =cut
1.28 matthew 119:
1.31 matthew 120: #######################################################
121: #######################################################
1.28 matthew 122:
1.31 matthew 123: =pod
1.28 matthew 124:
1.31 matthew 125: =item &BuildStudentAssessmentPage()
1.28 matthew 126:
1.31 matthew 127: Inputs:
1.4 stredwic 128:
1.31 matthew 129: =over 4
1.28 matthew 130:
131: =item $r Apache Request
132:
133: =item $c Apache Connection
134:
135: =back
136:
137: =cut
138:
139: #######################################################
140: #######################################################
1.1 stredwic 141: sub BuildStudentAssessmentPage {
1.30 matthew 142: my ($r,$c)=@_;
1.74 matthew 143: #
1.30 matthew 144: undef($Statistics);
1.66 matthew 145: undef($show_links);
146: undef($output_mode);
1.87 matthew 147: undef($chosen_output);
1.66 matthew 148: undef($single_student_mode);
1.74 matthew 149: #
150: my %Saveable_Parameters = ('Status' => 'scalar',
151: 'chartoutputmode' => 'scalar',
152: 'chartoutputdata' => 'scalar',
153: 'Section' => 'array',
1.139 raeburn 154: 'Groups' => 'array',
1.74 matthew 155: 'StudentData' => 'array',
156: 'Maps' => 'array');
157: &Apache::loncommon::store_course_settings('chart',\%Saveable_Parameters);
158: &Apache::loncommon::restore_course_settings('chart',\%Saveable_Parameters);
159: #
160: &Apache::lonstatistics::PrepareClasslist();
161: #
1.65 matthew 162: $single_student_mode = 0;
1.121 albertel 163: $single_student_mode = 1 if ($env{'form.SelectedStudent'});
1.100 matthew 164: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
165: ['selectstudent']);
1.121 albertel 166: if ($env{'form.selectstudent'}) {
1.59 matthew 167: &Apache::lonstatistics::DisplayClasslist($r);
168: return;
169: }
1.163 ! www 170: $r->print(&Apache::lonhtmlcommon::breadcrumbs('Chart','Chart_Description:Chart_Sections:Chart_Student_Data:Chart_Enrollment_Status:Chart_Sequences:Chart_Output_Formats:Chart_Output_Data'));
! 171: &Apache::lonquickgrades::startGradeScreen($r,'chart');
! 172:
1.30 matthew 173: #
1.31 matthew 174: # Print out the HTML headers for the interface
175: # This also parses the output mode selector
1.54 matthew 176: # This step must *always* be done.
1.30 matthew 177: $r->print(&CreateInterface());
1.31 matthew 178: $r->print('<input type="hidden" name="notfirstrun" value="true" />');
1.49 matthew 179: $r->print('<input type="hidden" name="sort" value="'.
1.121 albertel 180: $env{'form.sort'}.'" />');
1.7 stredwic 181: $r->rflush();
1.58 matthew 182: #
1.121 albertel 183: if (! exists($env{'form.notfirstrun'}) && ! $single_student_mode) {
1.31 matthew 184: return;
185: }
1.119 matthew 186: $r->print('<h4>'.
187: &Apache::lonstatistics::section_and_enrollment_description().
188: '</h4>');
1.31 matthew 189: #
190: my $initialize = \&html_initialize;
191: my $output_student = \&html_outputstudent;
192: my $finish = \&html_finish;
193: #
194: if ($output_mode eq 'excel') {
195: $initialize = \&excel_initialize;
196: $output_student = \&excel_outputstudent;
197: $finish = \&excel_finish;
198: } elsif ($output_mode eq 'csv') {
199: $initialize = \&csv_initialize;
200: $output_student = \&csv_outputstudent;
201: $finish = \&csv_finish;
202: }
1.30 matthew 203: #
204: if($c->aborted()) { return ; }
1.31 matthew 205: #
1.49 matthew 206: # Determine which students we want to look at
207: my @Students;
208: if ($single_student_mode) {
209: @Students = (&Apache::lonstatistics::current_student());
210: $r->print(&next_and_previous_buttons());
211: $r->rflush();
212: } else {
213: @Students = @Apache::lonstatistics::Students;
214: }
1.56 matthew 215: #
216: # Perform generic initialization tasks
217: # Since we use lonnet::EXT to retrieve problem weights,
218: # to ensure current data we must clear the caches out.
219: # This makes sure that parameter changes at the student level
220: # are immediately reflected in the chart.
221: &Apache::lonnet::clear_EXT_cache_status();
1.69 matthew 222: #
223: # Clean out loncoursedata's package data, just to be safe.
224: &Apache::loncoursedata::clear_internal_caches();
1.49 matthew 225: #
1.31 matthew 226: # Call the initialize routine selected above
227: $initialize->($r);
1.49 matthew 228: foreach my $student (@Students) {
1.31 matthew 229: if($c->aborted()) {
230: $finish->($r);
231: return ;
1.1 stredwic 232: }
1.31 matthew 233: # Call the output_student routine selected above
234: $output_student->($r,$student);
235: }
236: # Call the "finish" routine selected above
1.163 ! www 237: &Apache::lonquickgrades::endGradeScreen($r);
1.31 matthew 238: $finish->($r);
239: #
240: return;
241: }
242:
243: #######################################################
244: #######################################################
1.49 matthew 245: sub next_and_previous_buttons {
246: my $Str = '';
247: $Str .= '<input type="hidden" name="SelectedStudent" value="'.
1.121 albertel 248: $env{'form.SelectedStudent'}.'" />';
1.49 matthew 249: #
250: # Build the previous student link
251: my $previous = &Apache::lonstatistics::previous_student();
252: my $previousbutton = '';
253: if (defined($previous)) {
254: my $sname = $previous->{'username'}.':'.$previous->{'domain'};
255: $previousbutton .= '<input type="button" value="'.
1.155 bisitz 256: &mt('Previous Student ([_1])',
257: $previous->{'username'}.':'.$previous->{'domain'}).
1.49 matthew 258: '" onclick="document.Statistics.SelectedStudent.value='.
259: "'".$sname."'".';'.
260: 'document.Statistics.submit();" />';
261: } else {
262: $previousbutton .= '<input type="button" value="'.
1.155 bisitz 263: &mt('Previous Student').'" disabled="disabled" />';
1.49 matthew 264: }
265: #
266: # Build the next student link
267: my $next = &Apache::lonstatistics::next_student();
268: my $nextbutton = '';
269: if (defined($next)) {
270: my $sname = $next->{'username'}.':'.$next->{'domain'};
271: $nextbutton .= '<input type="button" value="'.
1.155 bisitz 272: &mt('Next Student ([_1])',
273: $next->{'username'}.':'.$next->{'domain'}).
1.49 matthew 274: '" onclick="document.Statistics.SelectedStudent.value='.
275: "'".$sname."'".';'.
276: 'document.Statistics.submit();" />';
277: } else {
278: $nextbutton .= '<input type="button" value="'.
1.155 bisitz 279: &mt('Next Student').'" disabled="disabled" />';
1.49 matthew 280: }
281: #
282: # Build the 'all students' button
283: my $all = '';
1.155 bisitz 284: $all .= '<input type="button" value="'.&mt('All Students').'" '.
1.49 matthew 285: '" onclick="document.Statistics.SelectedStudent.value='.
286: "''".';'.'document.Statistics.submit();" />';
287: $Str .= $previousbutton.(' 'x5).$all.(' 'x5).$nextbutton;
288: return $Str;
289: }
290:
291: #######################################################
292: #######################################################
1.30 matthew 293:
1.31 matthew 294: sub get_student_fields_to_show {
295: my @to_show = @Apache::lonstatistics::SelectedStudentData;
296: foreach (@to_show) {
297: if ($_ eq 'all') {
298: @to_show = @Apache::lonstatistics::StudentDataOrder;
299: last;
300: }
301: }
302: return @to_show;
303: }
304:
1.28 matthew 305: #######################################################
306: #######################################################
307:
308: =pod
1.2 stredwic 309:
1.28 matthew 310: =item &CreateInterface()
1.21 minaeibi 311:
1.28 matthew 312: Called by &BuildStudentAssessmentPage to create the top part of the
313: page which displays the chart.
314:
1.30 matthew 315: Inputs: None
1.28 matthew 316:
317: Returns: A string containing the HTML for the headers and top table for
318: the chart page.
319:
320: =cut
321:
322: #######################################################
323: #######################################################
1.2 stredwic 324: sub CreateInterface {
1.4 stredwic 325: my $Str = '';
1.30 matthew 326: $Str .= '<table cellspacing="5">'."\n";
327: $Str .= '<tr>';
1.141 albertel 328: $Str .= '<td align="center"><b>'.&mt('Sections').'</b>'.
329: &Apache::loncommon::help_open_topic("Chart_Sections").
330: '</td>';
331: $Str .= '<td align="center"><b>'.&mt('Groups').'</b>'.
332: '</td>';
1.157 bisitz 333: $Str .= '<td align="center"><b>'.&mt('Student Data').'</b>'.
1.141 albertel 334: &Apache::loncommon::help_open_topic("Chart_Student_Data").
335: '</td>';
1.143 raeburn 336: $Str .= '<td align="center"><b>'.&mt('Access Status').'</b>'.
1.141 albertel 337: &Apache::loncommon::help_open_topic("Chart_Enrollment_Status").
338: '</td>';
339: $Str .= '<td align="center"><b>'.&mt('Sequences and Folders').'</b>'.
340: &Apache::loncommon::help_open_topic("Chart_Sequences").
341: '</td>';
1.75 matthew 342: $Str .= '<td align="center"><b>'.&mt('Output Format').'</b>'.
1.58 matthew 343: &Apache::loncommon::help_open_topic("Chart_Output_Formats").
344: '</td>';
1.75 matthew 345: $Str .= '<td align="center"><b>'.&mt('Output Data').'</b>'.
1.58 matthew 346: &Apache::loncommon::help_open_topic("Chart_Output_Data").
347: '</td>';
1.30 matthew 348: $Str .= '</tr>'."\n";
349: #
1.4 stredwic 350: $Str .= '<tr><td align="center">'."\n";
1.29 matthew 351: $Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5);
1.4 stredwic 352: $Str .= '</td><td align="center">';
1.139 raeburn 353: $Str .= &Apache::lonstatistics::GroupSelect('Group','multiple',5);
354: $Str .= '</td><td align="center">';
1.30 matthew 355: $Str .= &Apache::lonstatistics::StudentDataSelect('StudentData','multiple',
356: 5,undef);
1.46 matthew 357: $Str .= '</td><td>'."\n";
358: $Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5);
1.4 stredwic 359: $Str .= '</td><td>'."\n";
1.112 matthew 360: $Str .= &Apache::lonstatistics::map_select('Maps','multiple,all',5);
1.31 matthew 361: $Str .= '</td><td>'."\n";
362: $Str .= &CreateAndParseOutputSelector();
1.54 matthew 363: $Str .= '</td><td>'."\n";
364: $Str .= &CreateAndParseOutputDataSelector();
1.30 matthew 365: $Str .= '</td></tr>'."\n";
366: $Str .= '</table>'."\n";
1.156 bisitz 367: $Str .= '<p>'
368: .&mt('Status:').' '
369: .'<input type="text" name="stats_status" size="60" value="" readonly="readonly" />'
370: .'</p>';
1.75 matthew 371: $Str .= '<input type="submit" name="selectstudent" value="'.
372: &mt('Select One Student').'" />';
1.59 matthew 373: $Str .= ' 'x5;
1.75 matthew 374: $Str .= '<input type="submit" name="ClearCache" value="'.
375: &mt('Clear Caches').'" />';
1.156 bisitz 376: $Str .= '<p>'
377: .'<input type="submit" name="Generate Chart"'
378: .' value="'.&mt('Generate Chart').'" />'
379: .'</p>';
1.4 stredwic 380: return $Str;
1.1 stredwic 381: }
1.30 matthew 382:
383: #######################################################
384: #######################################################
385:
386: =pod
387:
1.31 matthew 388: =item &CreateAndParseOutputSelector()
1.30 matthew 389:
390: =cut
391:
392: #######################################################
393: #######################################################
1.32 matthew 394: my @OutputOptions =
395: ({ name => 'HTML, with links',
396: value => 'html, with links',
1.33 matthew 397: description => 'Output HTML with each symbol linked to the problem '.
1.35 matthew 398: 'which generated it.',
399: mode => 'html',
400: show_links => 'yes',
401: },
1.47 matthew 402: { name => 'HTML, with all links',
403: value => 'html, with all links',
404: description => 'Output HTML with each symbol linked to the problem '.
405: 'which generated it. '.
406: 'This includes links for unattempted problems.',
407: mode => 'html',
408: show_links => 'all',
409: },
1.32 matthew 410: { name => 'HTML, without links',
411: value => 'html, without links',
1.33 matthew 412: description => 'Output HTML. By not including links, the size of the'.
413: ' web page is greatly reduced. If your browser crashes on the '.
1.35 matthew 414: 'full display, try this.',
415: mode => 'html',
416: show_links => 'no',
417: },
1.54 matthew 418: { name => 'Excel',
419: value => 'excel',
420: description => 'Output an Excel file (compatable with Excel 95).',
1.35 matthew 421: mode => 'excel',
422: show_links => 'no',
1.54 matthew 423: },
424: { name => 'CSV',
425: value => 'csv',
1.96 www 426: description => 'Output a comma separated values file suitable for '.
1.57 matthew 427: 'import into a spreadsheet program. Using this method as opposed '.
428: 'to Excel output allows you to organize your data before importing'.
429: ' it into a spreadsheet program.',
1.35 matthew 430: mode => 'csv',
431: show_links => 'no',
432: },
1.32 matthew 433: );
434:
1.33 matthew 435: sub OutputDescriptions {
436: my $Str = '';
1.58 matthew 437: $Str .= "<h2>Output Formats</h2>\n";
1.33 matthew 438: $Str .= "<dl>\n";
439: foreach my $outputmode (@OutputOptions) {
440: $Str .=" <dt>".$outputmode->{'name'}."</dt>\n";
441: $Str .=" <dd>".$outputmode->{'description'}."</dd>\n";
442: }
443: $Str .= "</dl>\n";
444: return $Str;
445: }
446:
1.31 matthew 447: sub CreateAndParseOutputSelector {
448: my $Str = '';
1.44 matthew 449: my $elementname = 'chartoutputmode';
1.73 matthew 450: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
451: [$elementname]);
1.31 matthew 452: #
453: # Format for output options is 'mode, restrictions';
1.122 albertel 454: my $selected = (&Apache::loncommon::get_env_multiple('form.'.$elementname))[0];
455: $selected = 'html, without links' if (!$selected);
456:
1.31 matthew 457: #
458: # Set package variables describing output mode
459: $show_links = 'no';
460: $output_mode = 'html';
1.35 matthew 461: foreach my $option (@OutputOptions) {
462: next if ($option->{'value'} ne $selected);
463: $output_mode = $option->{'mode'};
464: $show_links = $option->{'show_links'};
1.31 matthew 465: }
1.35 matthew 466:
1.31 matthew 467: #
468: # Build the form element
469: $Str = qq/<select size="5" name="$elementname">/;
1.32 matthew 470: foreach my $option (@OutputOptions) {
471: $Str .= "\n".' <option value="'.$option->{'value'}.'"';
472: $Str .= " selected " if ($option->{'value'} eq $selected);
1.75 matthew 473: $Str .= ">".&mt($option->{'name'})."<\/option>";
1.31 matthew 474: }
475: $Str .= "\n</select>";
476: return $Str;
477: }
1.30 matthew 478:
1.54 matthew 479: ##
480: ## Data selector stuff
481: ##
482: my @OutputDataOptions =
1.57 matthew 483: (
1.72 matthew 484: { name => 'Scores Summary',
1.57 matthew 485: base => 'scores',
486: value => 'sum and total',
1.87 matthew 487: scores => 1,
488: tries => 0,
489: every_problem => 0,
490: sequence_sum => 1,
491: sequence_max => 1,
492: grand_total => 1,
1.101 matthew 493: grand_maximum => 1,
1.89 matthew 494: summary_table => 1,
1.90 matthew 495: maximum_row => 1,
1.129 bowersj2 496: ignore_weight => 0,
1.57 matthew 497: shortdesc => 'Total Score and Maximum Possible for each '.
498: 'Sequence or Folder',
499: longdesc => 'The score of each student as well as the '.
500: ' maximum possible on each Sequence or Folder.',
501: },
1.71 matthew 502: { name => 'Scores Per Problem',
1.57 matthew 503: base => 'scores',
1.71 matthew 504: value => 'scores',
1.87 matthew 505: scores => 1,
506: tries => 0,
507: correct => 0,
508: every_problem => 1,
509: sequence_sum => 1,
510: sequence_max => 1,
511: grand_total => 1,
1.101 matthew 512: grand_maximum => 1,
1.89 matthew 513: summary_table => 1,
1.90 matthew 514: maximum_row => 1,
1.129 bowersj2 515: ignore_weight => 0,
1.71 matthew 516: shortdesc => 'Score on each Problem Part',
517: longdesc =>'The students score on each problem part, computed as'.
518: 'the part weight * part awarded',
1.57 matthew 519: },
520: { name =>'Tries',
521: base =>'tries',
522: value => 'tries',
1.87 matthew 523: scores => 0,
524: tries => 1,
525: correct => 0,
526: every_problem => 1,
527: sequence_sum => 0,
528: sequence_max => 0,
529: grand_total => 0,
1.101 matthew 530: grand_maximum => 0,
1.90 matthew 531: summary_table => 0,
532: maximum_row => 0,
1.129 bowersj2 533: ignore_weight => 0,
1.57 matthew 534: shortdesc => 'Number of Tries before success on each Problem Part',
535: longdesc =>'The number of tries before success on each problem part.',
1.109 matthew 536: non_html_notes => 'negative values indicate an incorrect problem',
1.57 matthew 537: },
538: { name =>'Parts Correct',
539: base =>'tries',
540: value => 'parts correct total',
1.87 matthew 541: scores => 0,
542: tries => 0,
543: correct => 1,
544: every_problem => 1,
545: sequence_sum => 1,
546: sequence_max => 1,
547: grand_total => 1,
1.101 matthew 548: grand_maximum => 1,
1.89 matthew 549: summary_table => 1,
1.90 matthew 550: maximum_row => 0,
1.129 bowersj2 551: ignore_weight => 1,
1.157 bisitz 552: shortdesc => 'Number of Problem Parts completed successfully',
1.57 matthew 553: longdesc => 'The Number of Problem Parts completed successfully and '.
554: 'the maximum possible for each student',
555: },
556: );
557:
558: sub HTMLifyOutputDataDescriptions {
559: my $Str = '';
1.160 raeburn 560: $Str .= '<h2>'.&mt('Output Data').'</h2>'."\n";
1.57 matthew 561: $Str .= "<dl>\n";
562: foreach my $option (@OutputDataOptions) {
563: $Str .= ' <dt>'.$option->{'name'}.'</dt>';
564: $Str .= '<dd>'.$option->{'longdesc'}.'</dd>'."\n";
565: }
566: $Str .= "</dl>\n";
567: return $Str;
568: }
1.54 matthew 569:
570: sub CreateAndParseOutputDataSelector {
571: my $Str = '';
572: my $elementname = 'chartoutputdata';
573: #
1.122 albertel 574: my $selected = (&Apache::loncommon::get_env_multiple('form.'.$elementname))[0];
575: $selected = 'scores' if (!$selected);
576:
1.54 matthew 577: #
1.87 matthew 578: $chosen_output = $OutputDataOptions[0];
1.54 matthew 579: foreach my $option (@OutputDataOptions) {
580: if ($option->{'value'} eq $selected) {
1.87 matthew 581: $chosen_output = $option;
1.54 matthew 582: }
583: }
584: #
585: # Build the form element
586: $Str = qq/<select size="5" name="$elementname">/;
587: foreach my $option (@OutputDataOptions) {
588: $Str .= "\n".' <option value="'.$option->{'value'}.'"';
1.87 matthew 589: $Str .= " selected " if ($option->{'value'} eq $chosen_output->{'value'});
1.75 matthew 590: $Str .= ">".&mt($option->{'name'})."<\/option>";
1.54 matthew 591: }
592: $Str .= "\n</select>";
593: return $Str;
594:
595: }
596:
1.28 matthew 597: #######################################################
598: #######################################################
1.115 matthew 599: sub count_parts {
600: my ($navmap,$sequence) = @_;
601: my @resources = &get_resources($navmap,$sequence);
602: my $count = 0;
603: foreach my $res (@resources) {
604: $count += scalar(@{$res->parts});
605: }
606: return $count;
607: }
608:
609: sub get_resources {
610: my ($navmap,$sequence) = @_;
611: my @resources = $navmap->retrieveResources($sequence,
612: sub { shift->is_problem(); },
613: 0,0,0);
614: return @resources;
615: }
616:
617: #######################################################
618: #######################################################
1.1 stredwic 619:
1.28 matthew 620: =pod
621:
1.31 matthew 622: =head2 HTML output routines
1.28 matthew 623:
1.31 matthew 624: =item &html_initialize($r)
1.28 matthew 625:
1.31 matthew 626: Create labels for the columns of student data to show.
1.28 matthew 627:
1.31 matthew 628: =item &html_outputstudent($r,$student)
1.28 matthew 629:
1.31 matthew 630: Return a line of the chart for a student.
1.28 matthew 631:
1.31 matthew 632: =item &html_finish($r)
1.28 matthew 633:
634: =cut
635:
636: #######################################################
637: #######################################################
1.31 matthew 638: {
639: my $padding;
640: my $count;
641:
1.39 matthew 642: my $nodata_count; # The number of students for which there is no data
643: my %prog_state; # progress state used by loncommon PrgWin routines
1.102 matthew 644: my $total_sum_width;
1.39 matthew 645:
1.112 matthew 646: my %width; # Holds sequence width information
647: my @sequences;
648: my $navmap; # Have to keep this around since weakref is a bit zealous
649:
1.125 albertel 650: sub html_cleanup {
651: undef(%prog_state);
652: undef(%width);
653: #
654: undef($navmap);
655: undef(@sequences);
656: }
657:
1.31 matthew 658: sub html_initialize {
659: my ($r) = @_;
1.30 matthew 660: #
661: $padding = ' 'x3;
1.35 matthew 662: $count = 0;
1.39 matthew 663: $nodata_count = 0;
1.125 albertel 664: &html_cleanup();
1.115 matthew 665: ($navmap,@sequences) =
666: &Apache::lonstatistics::selected_sequences_with_assessments();
667: if (! ref($navmap)) {
668: # Unable to get data, so bail out
1.156 bisitz 669: $r->print('<p class="LC_error">'
670: .&mt('Unable to retrieve course information.')
671: .'</p>');
1.115 matthew 672: }
1.134 bowersj2 673:
674: # If we're showing links, show a checkbox to open in new
675: # windows.
676: if ($show_links ne 'no') {
1.159 bisitz 677: my $labeltext = &mt('Show links in new window');
1.134 bowersj2 678: $r->print(<<NEW_WINDOW_CHECKBOX);
1.135 albertel 679: <script type="text/javascript">new_window = true;</script>
1.159 bisitz 680: <p><label>
1.152 bisitz 681: <input type="checkbox" checked="checked" onclick="new_window=this.checked" />
1.159 bisitz 682: $labeltext
1.135 albertel 683: </label></p>
1.134 bowersj2 684: NEW_WINDOW_CHECKBOX
685: }
686:
1.30 matthew 687: #
1.121 albertel 688: $r->print("<h3>".$env{'course.'.$env{'request.course.id'}.'.description'}.
1.156 bisitz 689: " ".&Apache::lonlocal::locallocaltime(time)."</h3>");
1.112 matthew 690: #
1.87 matthew 691: if ($chosen_output->{'base'} !~ /^final table/) {
1.146 bisitz 692: $r->print("<h3>".&mt($chosen_output->{'shortdesc'})."</h3>");
1.39 matthew 693: }
1.31 matthew 694: my $Str = "<pre>\n";
1.30 matthew 695: # First, the @StudentData fields need to be listed
1.31 matthew 696: my @to_show = &get_student_fields_to_show();
1.30 matthew 697: foreach my $field (@to_show) {
698: my $title=$Apache::lonstatistics::StudentData{$field}->{'title'};
699: my $base =$Apache::lonstatistics::StudentData{$field}->{'base_width'};
700: my $width=$Apache::lonstatistics::StudentData{$field}->{'width'};
701: $Str .= $title.' 'x($width-$base).$padding;
702: }
1.89 matthew 703: #
704: # Compute the column widths and output the sequence titles
1.102 matthew 705: my $total_count;
1.112 matthew 706: #
707: # Compute sequence widths
708: my $starttime = Time::HiRes::time;
709: foreach my $seq (@sequences) {
710: my $symb = $seq->symb;
711: my $title = $seq->compTitle;
712: $width{$symb}->{'width_sum'} = 0;
713: # Compute width of sum
1.89 matthew 714: if ($chosen_output->{'sequence_sum'}) {
1.99 matthew 715: if ($chosen_output->{'every_problem'}) {
716: # Use 1 digit for a space
1.112 matthew 717: $width{$symb}->{'width_sum'} += 1;
1.99 matthew 718: }
1.118 matthew 719: $total_count += &count_parts($navmap,$seq);
1.151 www 720: # Use 6 digits for the sum
721: $width{$symb}->{'width_sum'} += 6;
1.89 matthew 722: }
1.112 matthew 723: # Compute width of maximum
1.89 matthew 724: if ($chosen_output->{'sequence_max'}) {
1.112 matthew 725: if ($width{$symb}->{'width_sum'}>0) {
1.89 matthew 726: # One digit for the '/'
1.112 matthew 727: $width{$symb}->{'width_sum'} +=1;
1.89 matthew 728: }
1.151 www 729: # Use 6 digits for the total
730: $width{$symb}->{'width_sum'}+=6;
1.89 matthew 731: }
1.94 matthew 732: #
1.89 matthew 733: if ($chosen_output->{'every_problem'}) {
734: # one problem per digit
1.115 matthew 735: $width{$symb}->{'width_parts'}= &count_parts($navmap,$seq);
736: $width{$symb}->{'width_problem'} += $width{$symb}->{'width_parts'};
1.89 matthew 737: } else {
1.112 matthew 738: $width{$symb}->{'width_problem'} = 0;
1.89 matthew 739: }
1.112 matthew 740: $width{$symb}->{'width_total'} = $width{$symb}->{'width_problem'} +
741: $width{$symb}->{'width_sum'};
742: if ($width{$symb}->{'width_total'} < length(&HTML::Entities::decode($title))) {
743: $width{$symb}->{'width_total'} = length(&HTML::Entities::decode($title));
1.89 matthew 744: }
745: #
746: # Output the sequence titles
1.112 matthew 747: $Str .= $title.(' 'x($width{$symb}->{'width_total'}-
748: length($title)
749: )).$padding;
1.30 matthew 750: }
1.102 matthew 751: $total_sum_width = length($total_count)+1;
752: $Str .= " total</pre>\n";
1.31 matthew 753: $Str .= "<pre>";
754: $r->print($Str);
755: $r->rflush();
1.132 bowersj2 756:
757: $r->print(<<JS);
1.142 albertel 758: <script type="text/javascript">
1.132 bowersj2 759: // get the left offset of a given widget as an absolute position
760: function getLeftOffset (element) {
761: return collect(element, "offsetLeft");
762: }
763:
764: // get the top offset of a given widget as an absolute position
765: function getTopOffset (element) {
766: return collect(element, "offsetTop");
767: }
768:
769: function collect(element, att) {
770: var val = 0;
771: while(element) {
772: val += element[att];
773: element = element.offsetParent;
774: }
775: return val;
776: }
777:
778: var currentDiv;
779: var currentElement;
780: function popup_score(element, score) {
781: popdown_score();
782: var left = getLeftOffset(element);
783: var top = getTopOffset(element);
784: var div = document.createElement("div");
1.142 albertel 785: div.className = "LC_chrt_popup";
1.132 bowersj2 786: div.appendChild(document.createTextNode(score));
787: div.style.position = "absolute";
788: div.style.top = (top - 25) + "px";
789: div.style.left = (left - 10) + "px";
790: currentDiv = div;
1.133 bowersj2 791: document.body.insertBefore(div, document.body.childNodes[0]);
1.142 albertel 792: element.className = "LC_chrt_popup_up";
1.132 bowersj2 793: currentElement = element;
794: }
795:
796: function popdown_score() {
797: if (currentDiv) {
798: document.body.removeChild(currentDiv);
799: }
800: if (currentElement) {
1.142 albertel 801: currentElement.className = 'LC_chrt_popup_exists';
1.132 bowersj2 802: }
803: currentDiv = undefined;
804: }
805: </script>
806: JS
807:
1.123 albertel 808: #
809: # Let the user know what we are doing
810: my $studentcount = scalar(@Apache::lonstatistics::Students);
811: if ($env{'form.SelectedStudent'}) {
812: $studentcount = '1';
813: }
814: #
815: # Initialize progress window
816: %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
817: ($r,'HTML Chart Status',
818: 'HTML Chart Progress', $studentcount,
819: 'inline',undef,'Statistics','stats_status');
820: #
821: &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,
822: 'Processing first student');
1.31 matthew 823: return;
1.30 matthew 824: }
825:
1.31 matthew 826: sub html_outputstudent {
827: my ($r,$student) = @_;
1.2 stredwic 828: my $Str = '';
1.112 matthew 829: return if (! defined($navmap));
1.35 matthew 830: #
1.87 matthew 831: if($count++ % 5 == 0 && $count > 0) {
1.158 bisitz 832: # $r->print("</pre><pre>");
833: $r->print('</pre>');
834: &Apache::lonhtmlcommon::Increment_PrgWin(
1.162 bisitz 835: $r,\%prog_state,'last five students',5);
1.158 bisitz 836: $r->rflush();
837: $r->print('<pre>');
1.35 matthew 838: }
1.30 matthew 839: # First, the @StudentData fields need to be listed
1.31 matthew 840: my @to_show = &get_student_fields_to_show();
1.30 matthew 841: foreach my $field (@to_show) {
842: my $title=$student->{$field};
1.103 matthew 843: # Deal with 'comments' - how I love special cases
844: if ($field eq 'comments') {
845: $title = '<a href="/adm/'.$student->{'domain'}.'/'.$student->{'username'}.'/'.'aboutme#coursecomment">'.&mt('Comments').'</a>';
846: }
1.31 matthew 847: my $base = length($title);
1.30 matthew 848: my $width=$Apache::lonstatistics::StudentData{$field}->{'width'};
849: $Str .= $title.' 'x($width-$base).$padding;
850: }
851: # Get ALL the students data
852: my %StudentsData;
853: my @tmp = &Apache::loncoursedata::get_current_state
854: ($student->{'username'},$student->{'domain'},undef,
1.121 albertel 855: $env{'request.course.id'});
1.144 albertel 856: if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:(.*)/)) {
1.30 matthew 857: %StudentsData = @tmp;
1.144 albertel 858: } else {
859: my $error = $1;
860: if (scalar(@tmp) < 1) {
1.149 bisitz 861: $Str .= '<span class="LC_warning">'
862: .&mt('No Course Data')
863: .'</span>'."\n";
1.144 albertel 864: } else {
1.149 bisitz 865: $Str .= '<span class="LC_error">'
866: .&mt('Error getting student data ([_1])',$error)
867: .'</span>'."\n";
1.144 albertel 868: }
1.39 matthew 869: $nodata_count++;
1.31 matthew 870: $r->print($Str);
871: $r->rflush();
872: return;
1.30 matthew 873: }
874: #
875: # By sequence build up the data
876: my $studentstats;
1.31 matthew 877: my $PerformanceStr = '';
1.112 matthew 878: foreach my $seq (@sequences) {
1.118 matthew 879: my $symb = $seq->symb;
1.54 matthew 880: my ($performance,$performance_length,$score,$seq_max,$rawdata);
1.87 matthew 881: if ($chosen_output->{'tries'}) {
1.54 matthew 882: ($performance,$performance_length,$score,$seq_max,$rawdata) =
1.112 matthew 883: &student_tries_on_sequence($student,\%StudentsData,
884: $navmap,$seq,$show_links);
1.54 matthew 885: } else {
886: ($performance,$performance_length,$score,$seq_max,$rawdata) =
1.112 matthew 887: &student_performance_on_sequence($student,\%StudentsData,
1.129 bowersj2 888: $navmap,$seq,$show_links,
889: $chosen_output->{ignore_weight});
1.54 matthew 890: }
1.89 matthew 891: my $ratio='';
1.118 matthew 892: if ($chosen_output->{'every_problem'} &&
893: $chosen_output->{'sequence_sum'}) {
1.99 matthew 894: $ratio .= ' ';
895: }
1.97 matthew 896: if ($chosen_output->{'sequence_sum'} && $score ne ' ') {
1.151 www 897: my $score .= sprintf("%3.2f",$score);
898: $ratio .= (' 'x(6-length($score))).$score;
1.98 matthew 899: } elsif($chosen_output->{'sequence_sum'}) {
1.151 www 900: $ratio .= ' 'x6;
1.89 matthew 901: }
902: if ($chosen_output->{'sequence_max'}) {
903: if ($chosen_output->{'sequence_sum'}) {
904: $ratio .= '/';
905: }
1.151 www 906: my $sequence_total=sprintf("%3.2f",$seq_max);
907: $ratio .= $sequence_total.(' 'x(6-length($sequence_total)));
1.89 matthew 908: }
1.31 matthew 909: #
1.89 matthew 910: if (! $chosen_output->{'every_problem'}) {
911: $performance = '';
1.94 matthew 912: $performance_length=0;
1.30 matthew 913: }
1.118 matthew 914: $performance .= ' 'x($width{$symb}->{'width_total'} -
1.112 matthew 915: $performance_length -
1.118 matthew 916: $width{$symb}->{'width_sum'}).
1.89 matthew 917: $ratio;
1.31 matthew 918: #
919: $Str .= $performance.$padding;
920: #
1.118 matthew 921: $studentstats->{$symb}->{'score'}= $score;
922: $studentstats->{$symb}->{'max'} = $seq_max;
1.30 matthew 923: }
924: #
925: # Total it up and store the statistics info.
1.97 matthew 926: my ($score,$max);
1.30 matthew 927: while (my ($symb,$seq_stats) = each (%{$studentstats})) {
928: $Statistics->{$symb}->{'score'} += $seq_stats->{'score'};
1.54 matthew 929: if ($Statistics->{$symb}->{'max'} < $seq_stats->{'max'}) {
930: $Statistics->{$symb}->{'max'} = $seq_stats->{'max'};
931: }
1.97 matthew 932: if ($seq_stats->{'score'} ne ' ') {
933: $score += $seq_stats->{'score'};
934: $Statistics->{$symb}->{'num_students'}++;
935: }
1.30 matthew 936: $max += $seq_stats->{'max'};
937: }
1.97 matthew 938: if (! defined($score)) {
1.102 matthew 939: $score = ' ' x $total_sum_width;
1.105 matthew 940: } else {
1.151 www 941: $score = sprintf("%.2f",$score);
942: $score = (' 'x(6-length($score))).$score;
1.97 matthew 943: }
1.102 matthew 944: $Str .= ' '.' 'x($total_sum_width-length($score)).$score.' / '.$max;
1.30 matthew 945: $Str .= " \n";
1.39 matthew 946: #
1.31 matthew 947: $r->print($Str);
948: #
1.158 bisitz 949: # $r->rflush();
950: # &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,'last student');
1.31 matthew 951: return;
1.30 matthew 952: }
1.2 stredwic 953:
1.31 matthew 954: sub html_finish {
955: my ($r) = @_;
1.112 matthew 956: return if (! defined($navmap));
1.39 matthew 957: #
958: # Check for suppressed output and close the progress window if so
1.87 matthew 959: $r->print("</pre>\n");
1.90 matthew 960: if ($chosen_output->{'summary_table'}) {
961: if ($single_student_mode) {
962: $r->print(&SingleStudentTotal());
963: } else {
964: $r->print(&StudentAverageTotal());
965: }
1.49 matthew 966: }
1.31 matthew 967: $r->rflush();
1.123 albertel 968: &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
1.125 albertel 969: &html_cleanup();
1.31 matthew 970: return;
971: }
972:
1.39 matthew 973: sub StudentAverageTotal {
1.105 matthew 974: my $Str = '<h3>'.&mt('Summary Tables').'</h3>'.$/;
1.150 bisitz 975: $Str .= &Apache::loncommon::start_data_table();
976: $Str .= &Apache::loncommon::start_data_table_header_row().
1.105 matthew 977: '<th>'.&mt('Title').'</th>'.
978: '<th>'.&mt('Average').'</th>'.
979: '<th>'.&mt('Maximum').'</th>'.
1.150 bisitz 980: &Apache::loncommon::end_data_table_header_row().$/;
1.112 matthew 981: foreach my $seq (@sequences) {
982: my $symb = $seq->symb;
1.42 matthew 983: my $ave;
1.112 matthew 984: my $num_students = $Statistics->{$symb}->{'num_students'};
1.97 matthew 985: if ($num_students > 0) {
986: $ave = int(100*
1.112 matthew 987: ($Statistics->{$symb}->{'score'}/$num_students)
1.97 matthew 988: )/100;
1.42 matthew 989: } else {
990: $ave = 0;
991: }
1.112 matthew 992: my $max = $Statistics->{$symb}->{'max'};
1.82 matthew 993: $ave = sprintf("%.2f",$ave);
1.150 bisitz 994: $Str .= &Apache::loncommon::start_data_table_row().
995: '<td>'.$seq->compTitle.'</td>'.
1.82 matthew 996: '<td align="right">'.$ave.' </td>'.
1.150 bisitz 997: '<td align="right">'.$max.' '.'</td>'.
998: &Apache::loncommon::end_data_table_row()."\n";
1.39 matthew 999: }
1.150 bisitz 1000: $Str .= &Apache::loncommon::end_data_table()."\n";
1.39 matthew 1001: return $Str;
1002: }
1003:
1.49 matthew 1004: sub SingleStudentTotal {
1.115 matthew 1005: return if (! defined($navmap));
1.49 matthew 1006: my $student = &Apache::lonstatistics::current_student();
1.157 bisitz 1007: my $Str = '<h3>'.&mt('Summary table for [_1] ([_2])',
1.105 matthew 1008: $student->{'fullname'},
1.157 bisitz 1009: $student->{'username'}.':'.$student->{'domain'}).'</h3>';
1.105 matthew 1010: $Str .= $/;
1.150 bisitz 1011: $Str .= &Apache::loncommon::start_data_table()."\n";
1.49 matthew 1012: $Str .=
1.150 bisitz 1013: &Apache::loncommon::start_data_table_header_row().
1.105 matthew 1014: '<th>'.&mt('Sequence or Folder').'</th>';
1015: if ($chosen_output->{'base'} eq 'tries') {
1016: $Str .= '<th>'.&mt('Parts Correct').'</th>';
1017: } else {
1018: $Str .= '<th>'.&mt('Score').'</th>';
1019: }
1.150 bisitz 1020: $Str .= '<th>'.&mt('Maximum').'</th>'.
1021: &Apache::loncommon::end_data_table_header_row()."\n";
1.49 matthew 1022: my $total = 0;
1023: my $total_max = 0;
1.115 matthew 1024: foreach my $seq (@sequences) {
1.112 matthew 1025: my $value = $Statistics->{$seq->symb}->{'score'};
1026: my $max = $Statistics->{$seq->symb}->{'max'};
1.150 bisitz 1027: $Str .= &Apache::loncommon::start_data_table_row().
1028: '<td>'.&HTML::Entities::encode($seq->compTitle).'</td>'.
1.49 matthew 1029: '<td align="right">'.$value.'</td>'.
1.150 bisitz 1030: '<td align="right">'.$max.'</td>'.
1031: &Apache::loncommon::end_data_table_row()."\n";
1.49 matthew 1032: $total += $value;
1033: $total_max +=$max;
1034: }
1.150 bisitz 1035: $Str .= &Apache::loncommon::start_data_table_row().
1036: '<td><b>'.&mt('Total').'</b></td>'.
1.49 matthew 1037: '<td align="right">'.$total.'</td>'.
1.150 bisitz 1038: '<td align="right">'.$total_max.'</td>'.
1039: &Apache::loncommon::end_data_table_row()."\n";
1040: $Str .= &Apache::loncommon::end_data_table()."\n";
1.49 matthew 1041: return $Str;
1042: }
1043:
1.31 matthew 1044: }
1045:
1046: #######################################################
1047: #######################################################
1048:
1049: =pod
1050:
1051: =head2 EXCEL subroutines
1052:
1053: =item &excel_initialize($r)
1054:
1055: =item &excel_outputstudent($r,$student)
1056:
1057: =item &excel_finish($r)
1058:
1059: =cut
1060:
1061: #######################################################
1062: #######################################################
1063: {
1064:
1065: my $excel_sheet;
1.32 matthew 1066: my $excel_workbook;
1.117 matthew 1067: my $format;
1.32 matthew 1068:
1069: my $filename;
1070: my $rows_output;
1071: my $cols_output;
1072:
1.36 matthew 1073: my %prog_state; # progress window state
1.54 matthew 1074: my $request_aborted;
1.31 matthew 1075:
1.76 matthew 1076: my $total_formula;
1.101 matthew 1077: my $maximum_formula;
1.115 matthew 1078: my %formula_data;
1079:
1080: my $navmap;
1081: my @sequences;
1.76 matthew 1082:
1.125 albertel 1083: sub excel_cleanup {
1.31 matthew 1084: #
1.66 matthew 1085: undef ($excel_sheet);
1086: undef ($excel_workbook);
1087: undef ($filename);
1088: undef ($rows_output);
1089: undef ($cols_output);
1090: undef (%prog_state);
1091: undef ($request_aborted);
1.76 matthew 1092: undef ($total_formula);
1.101 matthew 1093: undef ($maximum_formula);
1.66 matthew 1094: #
1.115 matthew 1095: undef(%formula_data);
1096: #
1097: undef($navmap);
1098: undef(@sequences);
1.125 albertel 1099: }
1100:
1101: sub excel_initialize {
1102: my ($r) = @_;
1103:
1104: &excel_cleanup();
1.115 matthew 1105: ($navmap,@sequences) =
1106: &Apache::lonstatistics::selected_sequences_with_assessments();
1107: if (! ref($navmap)) {
1108: # Unable to get data, so bail out
1109: $r->print("<h3>".
1110: &mt('Unable to retrieve course information.').
1111: '</h3>');
1112: }
1113: #
1.54 matthew 1114: my $total_columns = scalar(&get_student_fields_to_show());
1.90 matthew 1115: my $num_students = scalar(@Apache::lonstatistics::Students);
1116: #
1.115 matthew 1117: foreach my $seq (@sequences) {
1.88 matthew 1118: if ($chosen_output->{'every_problem'}) {
1.115 matthew 1119: $total_columns+=&count_parts($navmap,$seq);
1.88 matthew 1120: }
1.87 matthew 1121: # Add 2 because we need a 'sequence_sum' and 'total' column for each
1.88 matthew 1122: $total_columns += 2;
1.54 matthew 1123: }
1.105 matthew 1124: my $too_many_cols_error_message =
1125: '<h2>'.&mt('Unable to Complete Request').'</h2>'.$/.
1126: '<p>'.&mt('LON-CAPA is unable to produce your Excel spreadsheet because your selections will result in more than 255 columns. Excel allows only 255 columns in a spreadsheet.').'</p>'.$/.
1127: '<p>'.&mt('You may consider reducing the number of <b>Sequences or Folders</b> you have selected.').'</p>'.$/.
1128: '<p>'.&mt('LON-CAPA can produce <b>CSV</b> files of this data or Excel files of the <b>Scores Summary</b> data.').'</p>'.$/;
1.87 matthew 1129: if ($chosen_output->{'base'} eq 'tries' && $total_columns > 255) {
1.105 matthew 1130: $r->print($too_many_cols_error_message);
1131: $request_aborted = 1;
1.54 matthew 1132: }
1.87 matthew 1133: if ($chosen_output->{'base'} eq 'scores' && $total_columns > 255) {
1.105 matthew 1134: $r->print($too_many_cols_error_message);
1135: $request_aborted = 1;
1.54 matthew 1136: }
1137: return if ($request_aborted);
1138: #
1.32 matthew 1139: #
1140: $excel_workbook = undef;
1141: $excel_sheet = undef;
1142: #
1143: $rows_output = 0;
1144: $cols_output = 0;
1145: #
1.90 matthew 1146: # Determine rows
1147: my $header_row = $rows_output++;
1148: my $description_row = $rows_output++;
1.109 matthew 1149: my $notes_row = $rows_output++;
1.90 matthew 1150: $rows_output++; # blank row
1151: my $summary_header_row;
1152: if ($chosen_output->{'summary_table'}) {
1153: $summary_header_row = $rows_output++;
1.115 matthew 1154: $rows_output+= scalar(@sequences);
1.90 matthew 1155: $rows_output++;
1156: }
1157: my $sequence_name_row = $rows_output++;
1158: my $resource_name_row = $rows_output++;
1159: my $maximum_data_row = $rows_output++;
1160: if (! $chosen_output->{'maximum_row'}) {
1161: $rows_output--;
1162: }
1163: my $first_data_row = $rows_output++;
1164: #
1.32 matthew 1165: # Create sheet
1.117 matthew 1166: ($excel_workbook,$filename,$format)=
1167: &Apache::loncommon::create_workbook($r);
1168: return if (! defined($excel_workbook));
1.91 matthew 1169: #
1.32 matthew 1170: # Add a worksheet
1.121 albertel 1171: my $sheetname = $env{'course.'.$env{'request.course.id'}.'.description'};
1.67 matthew 1172: $sheetname = &Apache::loncommon::clean_excel_name($sheetname);
1.33 matthew 1173: $excel_sheet = $excel_workbook->addworksheet($sheetname);
1.85 matthew 1174: #
1.34 matthew 1175: # Put the course description in the header
1.90 matthew 1176: $excel_sheet->write($header_row,$cols_output++,
1.121 albertel 1177: $env{'course.'.$env{'request.course.id'}.'.description'},
1.85 matthew 1178: $format->{'h1'});
1.34 matthew 1179: $cols_output += 3;
1180: #
1181: # Put a description of the sections listed
1182: my $sectionstring = '';
1.119 matthew 1183: my @Sections = &Apache::lonstatistics::get_selected_sections();
1.120 matthew 1184: $excel_sheet->write($header_row,$cols_output++,
1.124 matthew 1185: &Apache::lonstatistics::section_and_enrollment_description('plaintext'),
1.85 matthew 1186: $format->{'h3'});
1.34 matthew 1187: #
1188: # Put the date in there too
1.90 matthew 1189: $excel_sheet->write($header_row,$cols_output++,
1.157 bisitz 1190: &mt('Compiled on [_1]',&Apache::lonlocal::locallocaltime(time)),$format->{'h3'});
1.34 matthew 1191: #
1.54 matthew 1192: $cols_output = 0;
1.90 matthew 1193: $excel_sheet->write($description_row,$cols_output++,
1.157 bisitz 1194: &mt($chosen_output->{'shortdesc'}),
1.109 matthew 1195: $format->{'b'});
1196: #
1197: $cols_output = 0;
1198: $excel_sheet->write($notes_row,$cols_output++,
1199: $chosen_output->{'non_html_notes'},
1200: $format->{'i'});
1201:
1.90 matthew 1202: ##############################################
1203: # Output headings for the raw data
1204: ##############################################
1.86 matthew 1205: #
1.32 matthew 1206: # Add the student headers
1.34 matthew 1207: $cols_output = 0;
1.32 matthew 1208: foreach my $field (&get_student_fields_to_show()) {
1.86 matthew 1209: $excel_sheet->write($resource_name_row,$cols_output++,$field,
1.85 matthew 1210: $format->{'bold'});
1.32 matthew 1211: }
1212: #
1.54 matthew 1213: # Add the remaining column headers
1.76 matthew 1214: my $total_formula_string = '=0';
1.101 matthew 1215: my $maximum_formula_string = '=0';
1.115 matthew 1216: foreach my $seq (@sequences) {
1217: my $symb = $seq->symb;
1.86 matthew 1218: $excel_sheet->write($sequence_name_row,,
1.115 matthew 1219: $cols_output,$seq->compTitle,$format->{'bold'});
1.86 matthew 1220: # Determine starting cell
1.115 matthew 1221: $formula_data{$symb}->{'Excel:startcell'}=
1.86 matthew 1222: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1.90 matthew 1223: ($first_data_row,$cols_output);
1.115 matthew 1224: $formula_data{$symb}->{'Excel:startcol'}=$cols_output;
1.87 matthew 1225: my $count = 0;
1226: if ($chosen_output->{'every_problem'}) {
1.76 matthew 1227: # Put the names of the problems and parts into the sheet
1.115 matthew 1228: foreach my $res (&get_resources($navmap,$seq)) {
1229: if (scalar(@{$res->parts}) > 1) {
1230: foreach my $part (@{$res->parts}) {
1.86 matthew 1231: $excel_sheet->write($resource_name_row,
1.54 matthew 1232: $cols_output++,
1.115 matthew 1233: $res->compTitle.' part '.$res->part_display($part),
1.85 matthew 1234: $format->{'bold'});
1.106 matthew 1235: $count++;
1.54 matthew 1236: }
1237: } else {
1.86 matthew 1238: $excel_sheet->write($resource_name_row,
1.54 matthew 1239: $cols_output++,
1.115 matthew 1240: $res->compTitle,$format->{'bold'});
1.106 matthew 1241: $count++;
1.54 matthew 1242: }
1243: }
1.79 matthew 1244: }
1.87 matthew 1245: # Determine ending cell
1246: if ($count <= 1) {
1.115 matthew 1247: $formula_data{$symb}->{'Excel:endcell'} = $formula_data{$symb}->{'Excel:startcell'};
1248: $formula_data{$symb}->{'Excel:endcol'} = $formula_data{$symb}->{'Excel:startcol'};
1.87 matthew 1249: } else {
1.115 matthew 1250: $formula_data{$symb}->{'Excel:endcell'} =
1.87 matthew 1251: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1.90 matthew 1252: ($first_data_row,$cols_output-1);
1.115 matthew 1253: $formula_data{$symb}->{'Excel:endcol'} = $cols_output-1;
1.87 matthew 1254: }
1255: # Create the formula for summing up this sequence
1.115 matthew 1256: if (! exists($formula_data{$symb}->{'Excel:endcell'}) ||
1257: ! defined($formula_data{$symb}->{'Excel:endcell'})) {
1258: $formula_data{$symb}->{'Excel:endcell'} = $formula_data{$symb}->{'Excel:startcell'};
1259: }
1.128 bowersj2 1260:
1.127 bowersj2 1261: my $start = $formula_data{$symb}->{'Excel:startcell'};
1262: my $end = $formula_data{$symb}->{'Excel:endcell'};
1.115 matthew 1263: $formula_data{$symb}->{'Excel:sum'}= $excel_sheet->store_formula
1.127 bowersj2 1264: ("=IF(COUNT($start\:$end),SUM($start\:$end),\"\")");
1.79 matthew 1265: # Determine cell the score is held in
1.115 matthew 1266: $formula_data{$symb}->{'Excel:scorecell'} =
1.79 matthew 1267: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1.90 matthew 1268: ($first_data_row,$cols_output);
1.115 matthew 1269: $formula_data{$symb}->{'Excel:scorecol'}=$cols_output;
1.87 matthew 1270: if ($chosen_output->{'base'} eq 'parts correct total') {
1.86 matthew 1271: $excel_sheet->write($resource_name_row,$cols_output++,
1.157 bisitz 1272: &mt('parts correct'),
1.85 matthew 1273: $format->{'bold'});
1.87 matthew 1274: } elsif ($chosen_output->{'sequence_sum'}) {
1275: if ($chosen_output->{'correct'}) {
1276: # Only reporting the number correct, so do not call it score
1277: $excel_sheet->write($resource_name_row,$cols_output++,
1.157 bisitz 1278: &mt('sum'),
1.87 matthew 1279: $format->{'bold'});
1280: } else {
1281: $excel_sheet->write($resource_name_row,$cols_output++,
1.157 bisitz 1282: &mt('score'),
1.87 matthew 1283: $format->{'bold'});
1284: }
1.32 matthew 1285: }
1.79 matthew 1286: #
1287: $total_formula_string.='+'.
1288: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1.90 matthew 1289: ($first_data_row,$cols_output-1);
1.87 matthew 1290: if ($chosen_output->{'sequence_max'}) {
1.101 matthew 1291: $excel_sheet->write($resource_name_row,$cols_output,
1.157 bisitz 1292: &mt('maximum'),
1.87 matthew 1293: $format->{'bold'});
1.115 matthew 1294: $formula_data{$symb}->{'Excel:maxcell'} =
1.101 matthew 1295: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1296: ($first_data_row,$cols_output);
1.115 matthew 1297: $formula_data{$symb}->{'Excel:maxcol'}=$cols_output;
1.101 matthew 1298: $maximum_formula_string.='+'.
1299: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1300: ($first_data_row,$cols_output);
1301: $cols_output++;
1302:
1.87 matthew 1303: }
1304: }
1305: if ($chosen_output->{'grand_total'}) {
1.157 bisitz 1306: $excel_sheet->write($resource_name_row,$cols_output++,&mt('Total'),
1.85 matthew 1307: $format->{'bold'});
1.32 matthew 1308: }
1.101 matthew 1309: if ($chosen_output->{'grand_maximum'}) {
1.157 bisitz 1310: $excel_sheet->write($resource_name_row,$cols_output++,&mt('Max. Total'),
1.101 matthew 1311: $format->{'bold'});
1312: }
1.76 matthew 1313: $total_formula = $excel_sheet->store_formula($total_formula_string);
1.101 matthew 1314: $maximum_formula = $excel_sheet->store_formula($maximum_formula_string);
1.90 matthew 1315: ##############################################
1.87 matthew 1316: # Output a row for MAX, if appropriate
1.90 matthew 1317: ##############################################
1318: if ($chosen_output->{'maximum_row'}) {
1.87 matthew 1319: $cols_output = 0;
1320: foreach my $field (&get_student_fields_to_show()) {
1321: if ($field eq 'username' || $field eq 'fullname' ||
1322: $field eq 'id') {
1323: $excel_sheet->write($maximum_data_row,$cols_output++,'Maximum',
1324: $format->{'bold'});
1325: } else {
1326: $excel_sheet->write($maximum_data_row,$cols_output++,'');
1327: }
1.54 matthew 1328: }
1.87 matthew 1329: #
1330: # Add the maximums for each sequence or assessment
1331: my %total_cell_translation;
1.101 matthew 1332: my %maximum_cell_translation;
1.115 matthew 1333: foreach my $seq (@sequences) {
1334: my $symb = $seq->symb;
1335: $cols_output=$formula_data{$symb}->{'Excel:startcol'};
1336: $total_cell_translation{$formula_data{$symb}->{'Excel:scorecell'}}=
1.87 matthew 1337: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1.115 matthew 1338: ($maximum_data_row,$formula_data{$symb}->{'Excel:scorecol'});
1339: $maximum_cell_translation{$formula_data{$symb}->{'Excel:maxcell'}}=
1.101 matthew 1340: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1.115 matthew 1341: ($maximum_data_row,$formula_data{$symb}->{'Excel:maxcol'});
1.87 matthew 1342: my $weight;
1343: my $max = 0;
1.115 matthew 1344: foreach my $resource (&get_resources($navmap,$seq)) {
1345: foreach my $part (@{$resource->parts}){
1.87 matthew 1346: $weight = 1;
1347: if ($chosen_output->{'scores'}) {
1348: $weight = &Apache::lonnet::EXT
1.128 bowersj2 1349: ('resource.'.$part.'.weight',$resource->symb,
1.87 matthew 1350: undef,undef,undef);
1351: if (!defined($weight) || ($weight eq '')) {
1352: $weight=1;
1353: }
1354: }
1355: if ($chosen_output->{'scores'} &&
1356: $chosen_output->{'every_problem'}) {
1357: $excel_sheet->write($maximum_data_row,$cols_output++,
1358: $weight);
1.54 matthew 1359: }
1.87 matthew 1360: $max += $weight;
1.54 matthew 1361: }
1.87 matthew 1362: }
1363: #
1364: if ($chosen_output->{'sequence_sum'} &&
1365: $chosen_output->{'every_problem'}) {
1.110 albertel 1366: my %replaceCells=
1.115 matthew 1367: ('^'.$formula_data{$symb}->{'Excel:startcell'}.':'.
1368: $formula_data{$symb}->{'Excel:endcell'}.'$' =>
1369: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($maximum_data_row,$formula_data{$symb}->{'Excel:startcol'}).':'.
1370: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($maximum_data_row,$formula_data{$symb}->{'Excel:endcol'}));
1.87 matthew 1371: $excel_sheet->repeat_formula($maximum_data_row,$cols_output++,
1.115 matthew 1372: $formula_data{$symb}->{'Excel:sum'},undef,
1.127 bowersj2 1373: %replaceCells, %replaceCells);
1.110 albertel 1374:
1.87 matthew 1375: } elsif ($chosen_output->{'sequence_sum'}) {
1376: $excel_sheet->write($maximum_data_row,$cols_output++,$max);
1377: }
1378: if ($chosen_output->{'sequence_max'}) {
1379: $excel_sheet->write($maximum_data_row,$cols_output++,$max);
1.45 matthew 1380: }
1.87 matthew 1381: #
1.45 matthew 1382: }
1.87 matthew 1383: if ($chosen_output->{'grand_total'}) {
1.86 matthew 1384: $excel_sheet->repeat_formula($maximum_data_row,$cols_output++,
1.87 matthew 1385: $total_formula,undef,
1386: %total_cell_translation);
1.79 matthew 1387: }
1.101 matthew 1388: if ($chosen_output->{'grand_maximum'}) {
1389: $excel_sheet->repeat_formula($maximum_data_row,$cols_output++,
1390: $maximum_formula,undef,
1.107 matthew 1391: %maximum_cell_translation);
1.101 matthew 1392: }
1.90 matthew 1393: } # End of MAXIMUM row output if ($chosen_output->{'maximum_row'}) {
1.86 matthew 1394: $rows_output = $first_data_row;
1.90 matthew 1395: ##############################################
1396: # Output summary table, which actually is above the sequence name row.
1397: ##############################################
1398: if ($chosen_output->{'summary_table'}) {
1399: $cols_output = 0;
1400: $excel_sheet->write($summary_header_row,$cols_output++,
1.157 bisitz 1401: &mt('Summary Table'),$format->{'bold'});
1.90 matthew 1402: if ($chosen_output->{'maximum_row'}) {
1403: $excel_sheet->write($summary_header_row,$cols_output++,
1.157 bisitz 1404: &mt('Maximum'),$format->{'bold'});
1.90 matthew 1405: }
1406: $excel_sheet->write($summary_header_row,$cols_output++,
1.157 bisitz 1407: &mt('Average'),$format->{'bold'});
1.90 matthew 1408: $excel_sheet->write($summary_header_row,$cols_output++,
1.157 bisitz 1409: &mt('Median'),$format->{'bold'});
1.90 matthew 1410: $excel_sheet->write($summary_header_row,$cols_output++,
1.157 bisitz 1411: &mt('Std Dev'),$format->{'bold'});
1.90 matthew 1412: my $row = $summary_header_row+1;
1.115 matthew 1413: foreach my $seq (@sequences) {
1414: my $symb = $seq->symb;
1.90 matthew 1415: $cols_output = 0;
1416: $excel_sheet->write($row,$cols_output++,
1.115 matthew 1417: $seq->compTitle,
1.90 matthew 1418: $format->{'bold'});
1419: if ($chosen_output->{'maximum_row'}) {
1420: $excel_sheet->write
1421: ($row,$cols_output++,
1422: '='.
1423: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1.115 matthew 1424: ($maximum_data_row,$formula_data{$symb}->{'Excel:scorecol'})
1.90 matthew 1425: );
1426: }
1427: my $range =
1428: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1.115 matthew 1429: ($first_data_row,$formula_data{$symb}->{'Excel:scorecol'}).
1.90 matthew 1430: ':'.
1431: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1.115 matthew 1432: ($first_data_row+$num_students-1,$formula_data{$symb}->{'Excel:scorecol'});
1.90 matthew 1433: $excel_sheet->write($row,$cols_output++,
1434: '=AVERAGE('.$range.')');
1435: $excel_sheet->write($row,$cols_output++,
1436: '=MEDIAN('.$range.')');
1437: $excel_sheet->write($row,$cols_output++,
1438: '=STDEV('.$range.')');
1439: $row++;
1440: }
1441: }
1442: ##############################################
1443: # Take care of non-excel initialization
1444: ##############################################
1.32 matthew 1445: #
1446: # Let the user know what we are doing
1447: my $studentcount = scalar(@Apache::lonstatistics::Students);
1.121 albertel 1448: if ($env{'form.SelectedStudent'}) {
1.85 matthew 1449: $studentcount = '1';
1450: }
1.153 bisitz 1451: $r->print('<p>'
1452: .&mt('Compiling Excel spreadsheet for [quant,_1,student]...',$studentcount)
1453: ."</p>\n"
1454: );
1.32 matthew 1455: $r->rflush();
1.31 matthew 1456: #
1.36 matthew 1457: # Initialize progress window
1458: %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
1459: ($r,'Excel File Compilation Status',
1.108 matthew 1460: 'Excel File Compilation Progress', $studentcount,
1461: 'inline',undef,'Statistics','stats_status');
1.36 matthew 1462: #
1.62 matthew 1463: &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,
1464: 'Processing first student');
1.31 matthew 1465: return;
1466: }
1467:
1468: sub excel_outputstudent {
1469: my ($r,$student) = @_;
1.115 matthew 1470: if ($request_aborted || ! defined($navmap) || ! defined($excel_sheet)) {
1471: return;
1472: }
1.32 matthew 1473: $cols_output=0;
1474: #
1475: # Write out student data
1476: my @to_show = &get_student_fields_to_show();
1477: foreach my $field (@to_show) {
1.103 matthew 1478: my $value = $student->{$field};
1479: if ($field eq 'comments') {
1.136 albertel 1480: $value = &Apache::lonmsgdisplay::retrieve_instructor_comments
1.103 matthew 1481: ($student->{'username'},$student->{'domain'});
1482: }
1483: $excel_sheet->write($rows_output,$cols_output++,$value);
1.32 matthew 1484: }
1485: #
1486: # Get student assessment data
1487: my %StudentsData;
1488: my @tmp = &Apache::loncoursedata::get_current_state($student->{'username'},
1489: $student->{'domain'},
1490: undef,
1.121 albertel 1491: $env{'request.course.id'});
1.32 matthew 1492: if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:/)) {
1493: %StudentsData = @tmp;
1494: }
1495: #
1496: # Write out sequence scores and totals data
1.76 matthew 1497: my %total_cell_translation;
1.101 matthew 1498: my %maximum_cell_translation;
1.115 matthew 1499: foreach my $seq (@sequences) {
1500: my $symb = $seq->symb;
1501: $cols_output = $formula_data{$symb}->{'Excel:startcol'};
1.76 matthew 1502: # Keep track of cells to translate in total cell
1.115 matthew 1503: $total_cell_translation{$formula_data{$symb}->{'Excel:scorecell'}} =
1.76 matthew 1504: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1.115 matthew 1505: ($rows_output,$formula_data{$symb}->{'Excel:scorecol'});
1.107 matthew 1506: # and maximum cell
1.115 matthew 1507: $maximum_cell_translation{$formula_data{$symb}->{'Excel:maxcell'}} =
1.107 matthew 1508: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
1.115 matthew 1509: ($rows_output,$formula_data{$symb}->{'Excel:maxcol'});
1.76 matthew 1510: #
1.54 matthew 1511: my ($performance,$performance_length,$score,$seq_max,$rawdata);
1.87 matthew 1512: if ($chosen_output->{'tries'} || $chosen_output->{'correct'}){
1.54 matthew 1513: ($performance,$performance_length,$score,$seq_max,$rawdata) =
1.115 matthew 1514: &student_tries_on_sequence($student,\%StudentsData,
1515: $navmap,$seq,'no');
1.54 matthew 1516: } else {
1517: ($performance,$performance_length,$score,$seq_max,$rawdata) =
1.115 matthew 1518: &student_performance_on_sequence($student,\%StudentsData,
1.129 bowersj2 1519: $navmap,$seq,'no',
1520: $chosen_output->{ignore_weight});
1.87 matthew 1521: }
1522: if ($chosen_output->{'every_problem'}) {
1523: if ($chosen_output->{'correct'}) {
1524: # only indiciate if each item is correct or not
1525: foreach my $value (@$rawdata) {
1.126 bowersj2 1526: # positive means correct, 0 or negative means
1527: # incorrect
1528: $value = $value > 0 ? 1 : 0;
1.87 matthew 1529: $excel_sheet->write($rows_output,$cols_output++,$value);
1530: }
1531: } else {
1532: foreach my $value (@$rawdata) {
1.97 matthew 1533: if ($score eq ' ' || !defined($value)) {
1534: $cols_output++;
1535: } else {
1536: $excel_sheet->write($rows_output,$cols_output++,
1537: $value);
1538: }
1.87 matthew 1539: }
1540: }
1.54 matthew 1541: }
1.87 matthew 1542: if ($chosen_output->{'sequence_sum'} &&
1543: $chosen_output->{'every_problem'}) {
1.76 matthew 1544: # Write a formula for the sum of this sequence
1.110 albertel 1545: my %replaceCells=
1.115 matthew 1546: ('^'.$formula_data{$symb}->{'Excel:startcell'}.':'.$formula_data{$symb}->{'Excel:endcell'}.'$'
1.110 albertel 1547: =>
1.115 matthew 1548: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($rows_output,$formula_data{$symb}->{'Excel:startcol'}).':'.
1549: &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($rows_output,$formula_data{$symb}->{'Excel:endcol'})
1.110 albertel 1550: );
1551: # The undef is for the format
1552: $excel_sheet->repeat_formula($rows_output,$cols_output++,
1.115 matthew 1553: $formula_data{$symb}->{'Excel:sum'},undef,
1.127 bowersj2 1554: %replaceCells, %replaceCells);
1.87 matthew 1555: } elsif ($chosen_output->{'sequence_sum'}) {
1.97 matthew 1556: if ($score eq ' ') {
1557: $cols_output++;
1558: } else {
1559: $excel_sheet->write($rows_output,$cols_output++,$score);
1560: }
1.32 matthew 1561: }
1.87 matthew 1562: if ($chosen_output->{'sequence_max'}) {
1.32 matthew 1563: $excel_sheet->write($rows_output,$cols_output++,$seq_max);
1564: }
1565: }
1.76 matthew 1566: #
1.87 matthew 1567: if ($chosen_output->{'grand_total'}) {
1568: $excel_sheet->repeat_formula($rows_output,$cols_output++,
1569: $total_formula,undef,
1570: %total_cell_translation);
1571: }
1.101 matthew 1572: if ($chosen_output->{'grand_maximum'}) {
1573: $excel_sheet->repeat_formula($rows_output,$cols_output++,
1574: $maximum_formula,undef,
1.107 matthew 1575: %maximum_cell_translation);
1.101 matthew 1576: }
1.32 matthew 1577: #
1578: # Bookkeeping
1579: $rows_output++;
1580: $cols_output=0;
1581: #
1.36 matthew 1582: # Update the progress window
1583: &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,'last student');
1.32 matthew 1584: return;
1.31 matthew 1585: }
1586:
1587: sub excel_finish {
1588: my ($r) = @_;
1.115 matthew 1589: if ($request_aborted || ! defined($navmap) || ! defined($excel_sheet)) {
1.125 albertel 1590: &excel_cleanup();
1.115 matthew 1591: return;
1592: }
1.32 matthew 1593: #
1594: # Write the excel file
1595: $excel_workbook->close();
1596: #
1.36 matthew 1597: # Close the progress window
1598: &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
1599: #
1.32 matthew 1600: # Tell the user where to get their excel file
1.36 matthew 1601: $r->print('<br />'.
1.153 bisitz 1602: '<a href="'.$filename.'">'.&mt('Your Excel spreadsheet').'</a>'."\n");
1.32 matthew 1603: $r->rflush();
1.125 albertel 1604: &excel_cleanup();
1.32 matthew 1605: return;
1.31 matthew 1606: }
1607:
1608: }
1.30 matthew 1609: #######################################################
1610: #######################################################
1611:
1612: =pod
1613:
1.31 matthew 1614: =head2 CSV output routines
1615:
1616: =item &csv_initialize($r)
1617:
1618: =item &csv_outputstudent($r,$student)
1619:
1620: =item &csv_finish($r)
1.30 matthew 1621:
1622: =cut
1623:
1624: #######################################################
1625: #######################################################
1.31 matthew 1626: {
1627:
1.37 matthew 1628: my $outputfile;
1629: my $filename;
1.54 matthew 1630: my $request_aborted;
1.37 matthew 1631: my %prog_state; # progress window state
1.115 matthew 1632: my $navmap;
1633: my @sequences;
1.37 matthew 1634:
1.125 albertel 1635: sub csv_cleanup {
1.66 matthew 1636: undef($outputfile);
1637: undef($filename);
1638: undef($request_aborted);
1.37 matthew 1639: undef(%prog_state);
1640: #
1.115 matthew 1641: undef($navmap);
1642: undef(@sequences);
1.125 albertel 1643: }
1644:
1645: sub csv_initialize{
1646: my ($r) = @_;
1647:
1648: &csv_cleanup();
1.115 matthew 1649: ($navmap,@sequences) =
1650: &Apache::lonstatistics::selected_sequences_with_assessments();
1651: if (! ref($navmap)) {
1652: # Unable to get data, so bail out
1653: $r->print("<h3>".
1654: &mt('Unable to retrieve course information.').
1655: '</h3>');
1656: }
1657: #
1.54 matthew 1658: # Deal with unimplemented requests
1659: $request_aborted = undef;
1.87 matthew 1660: if ($chosen_output->{'base'} =~ /final table/) {
1.54 matthew 1661: $r->print(<<END);
1662: <h2>Unable to Complete Request</h2>
1663: <p>
1664: The <b>Summary Table (Scores)</b> option is not available for non-HTML output.
1665: </p>
1666: END
1667: $request_aborted = 1;
1668: }
1669: return if ($request_aborted);
1.87 matthew 1670: #
1671: # Initialize progress window
1672: my $studentcount = scalar(@Apache::lonstatistics::Students);
1673: %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
1674: ($r,'CSV File Compilation Status',
1.108 matthew 1675: 'CSV File Compilation Progress', $studentcount,
1676: 'inline',undef,'Statistics','stats_status');
1.54 matthew 1677: #
1.37 matthew 1678: # Open a file
1.120 matthew 1679: ($outputfile,$filename) = &Apache::loncommon::create_text_file($r,'csv');
1680: if (! defined($outputfile)) { return ''; }
1.38 matthew 1681: #
1682: # Datestamp
1.121 albertel 1683: my $description = $env{'course.'.$env{'request.course.id'}.'.description'};
1.38 matthew 1684: print $outputfile '"'.&Apache::loncommon::csv_translate($description).'",'.
1.161 raeburn 1685: '"'.&Apache::loncommon::csv_translate(scalar(&Apache::lonlocal::locallocaltime(time))).'"'.
1.38 matthew 1686: "\n";
1.120 matthew 1687: print $outputfile '"'.
1688: &Apache::loncommon::csv_translate
1689: (&Apache::lonstatistics::section_and_enrollment_description()).
1690: '"'."\n";
1.109 matthew 1691: foreach my $item ('shortdesc','non_html_notes') {
1692: next if (! exists($chosen_output->{$item}));
1693: print $outputfile
1694: '"'.&Apache::loncommon::csv_translate($chosen_output->{$item}).'"'.
1695: "\n";
1696: }
1.37 matthew 1697: #
1698: # Print out the headings
1.87 matthew 1699: my $sequence_row = '';
1700: my $resource_row = undef;
1.37 matthew 1701: foreach my $field (&get_student_fields_to_show()) {
1.87 matthew 1702: $sequence_row .='"",';
1703: $resource_row .= '"'.&Apache::loncommon::csv_translate($field).'",';
1.37 matthew 1704: }
1.115 matthew 1705: foreach my $seq (@sequences) {
1.87 matthew 1706: $sequence_row .= '"'.
1.115 matthew 1707: &Apache::loncommon::csv_translate($seq->compTitle).'",';
1.87 matthew 1708: my $count = 0;
1709: if ($chosen_output->{'every_problem'}) {
1.116 matthew 1710: foreach my $res (&get_resources($navmap,$seq)) {
1.115 matthew 1711: if (scalar(@{$res->parts}) < 1) {
1.87 matthew 1712: next;
1713: }
1.115 matthew 1714: foreach my $part (@{$res->parts}) {
1.87 matthew 1715: $resource_row .= '"'.
1.115 matthew 1716: &Apache::loncommon::csv_translate
1717: ($res->compTitle.', Part '.$res->part_display($part)).'",';
1.87 matthew 1718: $count++;
1.53 matthew 1719: }
1720: }
1.37 matthew 1721: }
1.87 matthew 1722: $sequence_row.='"",'x$count;
1723: if ($chosen_output->{'sequence_sum'}) {
1724: if($chosen_output->{'correct'}) {
1.157 bisitz 1725: $resource_row .= '"'.&mt('sum').'",';
1.87 matthew 1726: } else {
1.157 bisitz 1727: $resource_row .= '"'.&mt('score').'",';
1.87 matthew 1728: }
1729: }
1730: if ($chosen_output->{'sequence_max'}) {
1731: $sequence_row.= '"",';
1.157 bisitz 1732: $resource_row .= '"'.&mt('maximum possible').'",';
1.87 matthew 1733: }
1.37 matthew 1734: }
1.87 matthew 1735: if ($chosen_output->{'grand_total'}) {
1736: $sequence_row.= '"",';
1.157 bisitz 1737: $resource_row.= '"'.&mt('Total').'",';
1.87 matthew 1738: }
1.101 matthew 1739: if ($chosen_output->{'grand_maximum'}) {
1740: $sequence_row.= '"",';
1.157 bisitz 1741: $resource_row.= '"'.&mt('Maximum').'",';
1.101 matthew 1742: }
1.87 matthew 1743: chomp($sequence_row);
1744: chomp($resource_row);
1745: print $outputfile $sequence_row."\n";
1746: print $outputfile $resource_row."\n";
1.31 matthew 1747: return;
1748: }
1749:
1750: sub csv_outputstudent {
1751: my ($r,$student) = @_;
1.115 matthew 1752: if ($request_aborted || ! defined($navmap) || ! defined($outputfile)) {
1753: return;
1754: }
1.37 matthew 1755: my $Str = '';
1756: #
1757: # Output student fields
1758: my @to_show = &get_student_fields_to_show();
1759: foreach my $field (@to_show) {
1.103 matthew 1760: my $value = $student->{$field};
1761: if ($field eq 'comments') {
1.136 albertel 1762: $value = &Apache::lonmsgdisplay::retrieve_instructor_comments
1.103 matthew 1763: ($student->{'username'},$student->{'domain'});
1764: }
1765: $Str .= '"'.&Apache::loncommon::csv_translate($value).'",';
1.37 matthew 1766: }
1767: #
1768: # Get student assessment data
1769: my %StudentsData;
1770: my @tmp = &Apache::loncoursedata::get_current_state($student->{'username'},
1771: $student->{'domain'},
1772: undef,
1.121 albertel 1773: $env{'request.course.id'});
1.37 matthew 1774: if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:/)) {
1775: %StudentsData = @tmp;
1776: }
1777: #
1778: # Output performance data
1.87 matthew 1779: my $total = 0;
1.101 matthew 1780: my $maximum = 0;
1.115 matthew 1781: foreach my $seq (@sequences) {
1.54 matthew 1782: my ($performance,$performance_length,$score,$seq_max,$rawdata);
1.87 matthew 1783: if ($chosen_output->{'tries'}){
1.54 matthew 1784: ($performance,$performance_length,$score,$seq_max,$rawdata) =
1.115 matthew 1785: &student_tries_on_sequence($student,\%StudentsData,
1786: $navmap,$seq,'no');
1.54 matthew 1787: } else {
1788: ($performance,$performance_length,$score,$seq_max,$rawdata) =
1.115 matthew 1789: &student_performance_on_sequence($student,\%StudentsData,
1.129 bowersj2 1790: $navmap,$seq,'no',
1791: $chosen_output->{ignore_weight});
1.54 matthew 1792: }
1.87 matthew 1793: if ($chosen_output->{'every_problem'}) {
1794: if ($chosen_output->{'correct'}) {
1795: $score = 0;
1796: # Deal with number of parts correct data
1797: $Str .= '"'.join('","',( map { if ($_>0) {
1798: $score += 1;
1799: 1;
1800: } else {
1801: 0;
1802: }
1803: } @$rawdata)).'",';
1804: } else {
1805: $Str .= '"'.join('","',(@$rawdata)).'",';
1806: }
1807: }
1808: if ($chosen_output->{'sequence_sum'}) {
1.37 matthew 1809: $Str .= '"'.$score.'",';
1.87 matthew 1810: }
1811: if ($chosen_output->{'sequence_max'}) {
1812: $Str .= '"'.$seq_max.'",';
1.37 matthew 1813: }
1.87 matthew 1814: $total+=$score;
1.101 matthew 1815: $maximum += $seq_max;
1.87 matthew 1816: }
1817: if ($chosen_output->{'grand_total'}) {
1818: $Str .= '"'.$total.'",';
1.101 matthew 1819: }
1820: if ($chosen_output->{'grand_maximum'}) {
1821: $Str .= '"'.$maximum.'",';
1.37 matthew 1822: }
1823: chop($Str);
1824: $Str .= "\n";
1825: print $outputfile $Str;
1826: #
1827: # Update the progress window
1828: &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,'last student');
1829: return;
1.31 matthew 1830: }
1831:
1832: sub csv_finish {
1833: my ($r) = @_;
1.115 matthew 1834: if ($request_aborted || ! defined($navmap) || ! defined($outputfile)) {
1.125 albertel 1835: &csv_cleanup();
1.115 matthew 1836: return;
1837: }
1.37 matthew 1838: close($outputfile);
1839: #
1840: # Close the progress window
1841: &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
1842: #
1843: # Tell the user where to get their csv file
1844: $r->print('<br />'.
1.147 bisitz 1845: '<a href="'.$filename.'">'.&mt('Your CSV file.').'</a>'."\n");
1.37 matthew 1846: $r->rflush();
1.125 albertel 1847: &csv_cleanup();
1.37 matthew 1848: return;
1849:
1.31 matthew 1850: }
1.2 stredwic 1851:
1852: }
1853:
1.132 bowersj2 1854: # This function will return an HTML string including a star, with
1855: # a mouseover popup showing the "real" value. An optional second
1856: # argument lets you show something other than a star.
1857: sub show_star {
1858: my $popup = shift;
1859: my $symbol = shift || '*';
1860: # Escape the popup for JS.
1861: $popup =~ s/([^-a-zA-Z0-9:;,._ ()|!\/?=&*])/'\\' . sprintf("%lo", ord($1))/ge;
1862:
1.142 albertel 1863: return "<span class=\"LC_chrt_popup_exists\" onmouseover='popup_score(this, \"$popup\");return false;' onmouseout='popdown_score();return false;'>$symbol</span>";
1.132 bowersj2 1864: }
1865:
1.28 matthew 1866: #######################################################
1867: #######################################################
1868:
1.2 stredwic 1869: =pod
1870:
1.54 matthew 1871: =item &StudentTriesOnSequence()
1.2 stredwic 1872:
1.30 matthew 1873: Inputs:
1.2 stredwic 1874:
1875: =over 4
1876:
1.30 matthew 1877: =item $student
1.28 matthew 1878:
1.30 matthew 1879: =item $studentdata Hash ref to all student data
1.2 stredwic 1880:
1.30 matthew 1881: =item $seq Hash ref, the sequence we are working on
1.2 stredwic 1882:
1.30 matthew 1883: =item $links if defined we will output links to each resource.
1.2 stredwic 1884:
1.28 matthew 1885: =back
1.2 stredwic 1886:
1887: =cut
1.1 stredwic 1888:
1.28 matthew 1889: #######################################################
1890: #######################################################
1.112 matthew 1891: sub student_tries_on_sequence {
1892: my ($student,$studentdata,$navmap,$seq,$links) = @_;
1.31 matthew 1893: $links = 'no' if (! defined($links));
1.1 stredwic 1894: my $Str = '';
1.30 matthew 1895: my ($sum,$max) = (0,0);
1.51 matthew 1896: my $performance_length = 0;
1.54 matthew 1897: my @TriesData = ();
1898: my $tries;
1.97 matthew 1899: my $hasdata = 0; # flag - true if the student has any data on the sequence
1.115 matthew 1900: foreach my $resource (&get_resources($navmap,$seq)) {
1.112 matthew 1901: my $resource_data = $studentdata->{$resource->symb};
1.30 matthew 1902: my $value = '';
1.112 matthew 1903: foreach my $partnum (@{$resource->parts()}) {
1.54 matthew 1904: $tries = undef;
1.30 matthew 1905: $max++;
1.51 matthew 1906: $performance_length++;
1.30 matthew 1907: my $symbol = ' '; # default to space
1908: #
1.78 matthew 1909: my $awarded = 0;
1910: if (exists($resource_data->{'resource.'.$partnum.'.awarded'})) {
1911: $awarded = $resource_data->{'resource.'.$partnum.'.awarded'};
1912: $awarded = 0 if (! $awarded);
1913: }
1914: #
1915: my $status = '';
1.30 matthew 1916: if (exists($resource_data->{'resource.'.$partnum.'.solved'})) {
1.78 matthew 1917: $status = $resource_data->{'resource.'.$partnum.'.solved'};
1918: }
1919: #
1920: my $tries = 0;
1921: if(exists($resource_data->{'resource.'.$partnum.'.tries'})) {
1922: $tries = $resource_data->{'resource.'.$partnum.'.tries'};
1.97 matthew 1923: $hasdata =1;
1.78 matthew 1924: }
1925: #
1926: if ($awarded > 0) {
1927: # The student has gotten the problem correct to some degree
1928: if ($status eq 'excused') {
1929: $symbol = 'x';
1930: $max--;
1.137 albertel 1931: } elsif ($status eq 'correct_by_override' && !$resource->is_task()) {
1.30 matthew 1932: $symbol = '+';
1933: $sum++;
1.78 matthew 1934: } elsif ($tries > 0) {
1.54 matthew 1935: if ($tries > 9) {
1.132 bowersj2 1936: $symbol = show_star($tries);
1.78 matthew 1937: } else {
1.54 matthew 1938: $symbol = $tries;
1.30 matthew 1939: }
1940: $sum++;
1941: } else {
1.78 matthew 1942: $symbol = '+';
1943: $sum++;
1.2 stredwic 1944: }
1.30 matthew 1945: } else {
1.78 matthew 1946: # The student has the problem incorrect or it is ungraded
1947: if ($status eq 'excused') {
1948: $symbol = 'x';
1949: $max--;
1950: } elsif ($status eq 'incorrect_by_override') {
1951: $symbol = '-';
1952: } elsif ($status eq 'ungraded_attempted') {
1.124 matthew 1953: $symbol = 'u';
1.78 matthew 1954: } elsif ($status eq 'incorrect_attempted' ||
1955: $tries > 0) {
1.30 matthew 1956: $symbol = '.';
1957: } else {
1.78 matthew 1958: # Problem is wrong and has not been attempted.
1959: $symbol=' ';
1.18 matthew 1960: }
1.2 stredwic 1961: }
1.54 matthew 1962: #
1.109 matthew 1963: if (! defined($tries)) {
1964: $tries = 0;
1965: }
1966: if ($status =~ /^(incorrect|ungraded)/) {
1967: # Bug 3390: show '-' for tries on incorrect problems
1968: # (csv & excel only)
1969: push(@TriesData,-$tries);
1970: } else {
1971: push (@TriesData,$tries);
1.54 matthew 1972: }
1.30 matthew 1973: #
1.47 matthew 1974: if ( ($links eq 'yes' && $symbol ne ' ') ||
1975: ($links eq 'all')) {
1.134 bowersj2 1976: my $link = '/adm/grades'.
1.148 raeburn 1977: '?symb='.&escape($resource->shown_symb).
1.30 matthew 1978: '&student='.$student->{'username'}.
1.64 albertel 1979: '&userdom='.$student->{'domain'}.
1.134 bowersj2 1980: '&command=submission';
1981: $symbol = &link($symbol, $link);
1.30 matthew 1982: }
1983: $value .= $symbol;
1.2 stredwic 1984: }
1.30 matthew 1985: $Str .= $value;
1.17 minaeibi 1986: }
1.112 matthew 1987: if ($seq->randompick()) {
1988: $max = $seq->randompick();
1.51 matthew 1989: }
1.97 matthew 1990: if (! $hasdata && $sum == 0) {
1991: $sum = ' ';
1992: }
1.54 matthew 1993: return ($Str,$performance_length,$sum,$max,\@TriesData);
1994: }
1995:
1.134 bowersj2 1996: =pod
1997:
1998: =item &link
1999:
2000: Inputs:
2001:
2002: =over 4
2003:
2004: =item $text
2005:
2006: =item $target
2007:
2008: =back
2009:
2010: Takes the text and creates a link to the $text that honors
2011: the value of 'new window' if clicked on, but uses a real
2012: 'href' so middle and right clicks still work.
2013:
2014: $target and $text are assumed to be already correctly escaped; i.e., it
2015: can be dumped out directly into the output stream as-is.
2016:
2017: =cut
2018:
2019: sub link {
2020: my ($text,$target) = @_;
2021: return
2022: "<a href='$target' onclick=\"t=this.href;if(new_window)"
2023: ."{window.open(t)}else{return void(window."
2024: ."location=t)};return false;\">$text</a>";
2025: }
2026:
1.54 matthew 2027: #######################################################
2028: #######################################################
2029:
2030: =pod
2031:
1.115 matthew 2032: =item &student_performance_on_sequence
1.54 matthew 2033:
2034: Inputs:
2035:
2036: =over 4
2037:
2038: =item $student
2039:
2040: =item $studentdata Hash ref to all student data
2041:
2042: =item $seq Hash ref, the sequence we are working on
2043:
2044: =item $links if defined we will output links to each resource.
2045:
2046: =back
2047:
2048: =cut
2049:
2050: #######################################################
2051: #######################################################
1.112 matthew 2052: sub student_performance_on_sequence {
1.129 bowersj2 2053: my ($student,$studentdata,$navmap,$seq,$links,$awarded_only) = @_;
1.54 matthew 2054: $links = 'no' if (! defined($links));
2055: my $Str = ''; # final result string
2056: my ($score,$max) = (0,0);
2057: my $performance_length = 0;
2058: my $symbol;
2059: my @ScoreData = ();
2060: my $partscore;
1.97 matthew 2061: my $hasdata = 0; # flag, 0 if there were no submissions on the sequence
1.115 matthew 2062: foreach my $resource (&get_resources($navmap,$seq)) {
1.112 matthew 2063: my $symb = $resource->symb;
2064: my $resource_data = $studentdata->{$symb};
2065: foreach my $part (@{$resource->parts()}) {
1.54 matthew 2066: $partscore = undef;
1.129 bowersj2 2067: my $weight;
2068: if (!$awarded_only){
2069: $weight = &Apache::lonnet::EXT('resource.'.$part.'.weight',
2070: $symb,
2071: $student->{'domain'},
2072: $student->{'username'},
2073: $student->{'section'});
2074: }
1.54 matthew 2075: if (!defined($weight) || ($weight eq '')) {
2076: $weight=1;
2077: }
2078: #
2079: $max += $weight; # see the 'excused' branch below...
2080: $performance_length++; # one character per part
2081: $symbol = ' '; # default to space
2082: #
1.97 matthew 2083: my $awarded;
1.54 matthew 2084: if (exists($resource_data->{'resource.'.$part.'.awarded'})) {
2085: $awarded = $resource_data->{'resource.'.$part.'.awarded'};
1.67 matthew 2086: $awarded = 0 if (! $awarded);
1.97 matthew 2087: $hasdata = 1;
1.54 matthew 2088: }
2089: #
1.131 albertel 2090: $partscore = &Apache::grades::compute_points($weight,$awarded);
1.97 matthew 2091: if (! defined($awarded)) {
2092: $partscore = undef;
2093: }
1.54 matthew 2094: $score += $partscore;
1.63 matthew 2095: $symbol = $partscore;
1.70 matthew 2096: if (abs($symbol - sprintf("%.0f",$symbol)) < 0.001) {
2097: $symbol = sprintf("%.0f",$symbol);
2098: }
1.54 matthew 2099: if (length($symbol) > 1) {
1.132 bowersj2 2100: $symbol = show_star($symbol);
1.54 matthew 2101: }
1.124 matthew 2102: if (exists($resource_data->{'resource.'.$part.'.solved'}) &&
2103: $resource_data->{'resource.'.$part.'.solved'} ne '') {
1.54 matthew 2104: my $status = $resource_data->{'resource.'.$part.'.solved'};
2105: if ($status eq 'excused') {
2106: $symbol = 'x';
2107: $max -= $weight; # Do not count 'excused' problems.
1.124 matthew 2108: } elsif ($status eq 'ungraded_attempted') {
2109: $symbol = 'u';
1.54 matthew 2110: }
1.97 matthew 2111: $hasdata = 1;
1.124 matthew 2112: } elsif ($resource_data->{'resource.'.$part.'.award'} eq 'DRAFT') {
2113: $symbol = 'd';
2114: $hasdata = 1;
1.111 matthew 2115: } elsif (!exists($resource_data->{'resource.'.$part.'.awarded'})){
1.54 matthew 2116: # Unsolved. Did they try?
2117: if (exists($resource_data->{'resource.'.$part.'.tries'})){
2118: $symbol = '.';
1.97 matthew 2119: $hasdata = 1;
1.54 matthew 2120: } else {
2121: $symbol = ' ';
2122: }
2123: }
2124: #
1.60 matthew 2125: if (! defined($partscore)) {
2126: $partscore = $symbol;
2127: }
2128: push (@ScoreData,$partscore);
2129: #
1.54 matthew 2130: if ( ($links eq 'yes' && $symbol ne ' ') || ($links eq 'all')) {
1.134 bowersj2 2131: my $link = '/adm/grades' .
1.148 raeburn 2132: '?symb='.&escape($resource->shown_symb).
1.54 matthew 2133: '&student='.$student->{'username'}.
1.64 albertel 2134: '&userdom='.$student->{'domain'}.
1.134 bowersj2 2135: '&command=submission';
2136: $symbol = &link($symbol, $link);
1.54 matthew 2137: }
1.60 matthew 2138: $Str .= $symbol;
1.54 matthew 2139: }
1.97 matthew 2140: }
2141: if (! $hasdata && $score == 0) {
2142: $score = ' ';
1.54 matthew 2143: }
2144: return ($Str,$performance_length,$score,$max,\@ScoreData);
1.1 stredwic 2145: }
1.23 minaeibi 2146:
1.28 matthew 2147: #######################################################
2148: #######################################################
1.23 minaeibi 2149:
1.2 stredwic 2150: =pod
2151:
2152: =item &CreateLegend()
2153:
2154: This function returns a formatted string containing the legend for the
2155: chart. The legend describes the symbols used to represent grades for
2156: problems.
2157:
2158: =cut
2159:
1.28 matthew 2160: #######################################################
2161: #######################################################
1.2 stredwic 2162: sub CreateLegend {
2163: my $Str = "<p><pre>".
1.124 matthew 2164: " digit score or number of tries to get correct ".
1.12 minaeibi 2165: " * correct by student in more than 9 tries\n".
1.20 minaeibi 2166: " + correct by hand grading or override\n".
1.12 minaeibi 2167: " - incorrect by override\n".
2168: " . incorrect attempted\n".
1.124 matthew 2169: " u ungraded attempted\n".
2170: " d draft answer saved but not submitted\n".
1.13 minaeibi 2171: " not attempted (blank field)\n".
1.12 minaeibi 2172: " x excused".
1.17 minaeibi 2173: "</pre><p>";
1.2 stredwic 2174: return $Str;
2175: }
2176:
1.28 matthew 2177: #######################################################
2178: #######################################################
2179:
1.30 matthew 2180: =pod
1.2 stredwic 2181:
2182: =back
2183:
2184: =cut
2185:
1.28 matthew 2186: #######################################################
2187: #######################################################
1.2 stredwic 2188:
1.28 matthew 2189: 1;
1.2 stredwic 2190:
1.1 stredwic 2191: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>