Annotation of loncom/interface/statistics/lonstudentsubmissions.pm, revision 1.51
1.1 matthew 1: # The LearningOnline Network with CAPA
2: #
1.51 ! bisitz 3: # $Id: lonstudentsubmissions.pm,v 1.50 2008/10/30 17:45:25 bisitz Exp $
1.1 matthew 4: #
5: # Copyright Michigan State University Board of Trustees
6: #
7: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
8: #
9: # LON-CAPA is free software; you can redistribute it and/or modify
10: # it under the terms of the GNU General Public License as published by
11: # the Free Software Foundation; either version 2 of the License, or
12: # (at your option) any later version.
13: #
14: # LON-CAPA is distributed in the hope that it will be useful,
15: # but WITHOUT ANY WARRANTY; without even the implied warranty of
16: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17: # GNU General Public License for more details.
18: #
19: # You should have received a copy of the GNU General Public License
20: # along with LON-CAPA; if not, write to the Free Software
21: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22: #
23: # /home/httpd/html/adm/gpl.txt
24: #
25: # http://www.lon-capa.org/
26: #
27: package Apache::lonstudentsubmissions;
28:
29: use strict;
1.40 albertel 30: use Apache::lonnet;
1.1 matthew 31: use Apache::loncommon();
32: use Apache::lonhtmlcommon();
33: use Apache::loncoursedata();
34: use Apache::lonstatistics;
35: use Apache::lonlocal;
36: use Apache::lonstathelpers;
37: use HTML::Entities();
38: use Time::Local();
39: use Spreadsheet::WriteExcel();
1.45 www 40: use lib '/home/httpd/lib/perl/';
41: use LONCAPA;
42:
1.1 matthew 43:
1.18 matthew 44: my @SubmitButtons = ({ name => 'SelectAnother',
1.1 matthew 45: text => 'Choose a different Problem' },
46: { name => 'Generate',
1.16 matthew 47: text => 'Generate Report'},
1.1 matthew 48: );
49:
50: sub BuildStudentSubmissionsPage {
51: my ($r,$c)=@_;
52: #
53: my %Saveable_Parameters = ('Status' => 'scalar',
54: 'Section' => 'array',
55: 'NumPlots' => 'scalar',
56: );
57: &Apache::loncommon::store_course_settings('student_submissions',
58: \%Saveable_Parameters);
59: &Apache::loncommon::restore_course_settings('student_submissions',
60: \%Saveable_Parameters);
61: #
62: &Apache::lonstatistics::PrepareClasslist();
63: #
64: $r->print(&CreateInterface());
65: #
66: my @Students = @Apache::lonstatistics::Students;
67: #
68: if (@Students < 1) {
1.50 bisitz 69: $r->print('<div class="LC_warning">'
70: .&mt('There are no students in the sections selected.')
71: .'</div>');
1.1 matthew 72: }
73: #
1.11 matthew 74: my @CacheButtonHTML =
1.19 matthew 75: &Apache::lonstathelpers::manage_caches($r,'Statistics','stats_status',
1.50 bisitz 76: '<div class="LC_info">'.&mt('Loading student data...').'</div>');
1.1 matthew 77: $r->rflush();
78: #
1.40 albertel 79: if (exists($env{'form.problemchoice'}) &&
80: ! exists($env{'form.SelectAnother'})) {
1.1 matthew 81: foreach my $button (@SubmitButtons) {
82: if ($button->{'name'} eq 'break') {
83: $r->print("<br />\n");
84: } else {
85: $r->print('<input type="submit" name="'.$button->{'name'}.'" '.
86: 'value="'.&mt($button->{'text'}).'" />');
87: $r->print(' 'x5);
88: }
89: }
1.11 matthew 90: foreach my $html (@CacheButtonHTML) {
91: $r->print($html.(' 'x5));
92: }
1.1 matthew 93: #
1.18 matthew 94: $r->print('<hr />'.$/);
1.1 matthew 95: $r->rflush();
96: #
1.18 matthew 97: # Determine which problems we are to analyze
98: my @Symbs =
99: &Apache::lonstathelpers::get_selected_symbs('problemchoice');
100: foreach my $selected (@Symbs) {
101: $r->print('<input type="hidden" name="problemchoice" value="'.
102: $selected.'" />'.$/);
103: }
1.1 matthew 104: #
1.18 matthew 105: # Get resource objects
106: my $navmap = Apache::lonnavmaps::navmap->new();
107: if (!defined($navmap)) {
1.50 bisitz 108: $r->print('<div class="LC_error">'.&mt("Internal error").'</div>');
1.18 matthew 109: return;
110: }
111: my %already_seen;
112: my @Problems;
113: foreach my $symb (@Symbs) {
114: my $resource = $navmap->getBySymb($symb);
115: push(@Problems,$resource);
1.1 matthew 116: }
1.25 matthew 117: #
1.37 matthew 118: $r->print('<h4>'.
119: &Apache::lonstatistics::section_and_enrollment_description().
120: '</h4>');
1.18 matthew 121: if (! scalar(@Problems) || ! defined($Problems[0])) {
1.1 matthew 122: $r->print('resource is undefined');
123: } else {
1.18 matthew 124: if (scalar(@Problems) == 1) {
125: my $resource = $Problems[0];
126: $r->print('<h1>'.$resource->title.'</h1>');
127: $r->print('<h3>'.$resource->src.'</h3>');
1.40 albertel 128: if ($env{'form.renderprob'} eq 'true') {
1.36 matthew 129: $r->print(&Apache::lonstathelpers::render_resource($resource));
1.18 matthew 130: $r->rflush();
131: }
132: }
1.40 albertel 133: if ($env{'form.output'} eq 'excel') {
1.21 matthew 134: &prepare_excel_output($r,\@Problems,\@Students);
1.40 albertel 135: } elsif ($env{'form.output'} eq 'csv') {
1.22 matthew 136: &prepare_csv_output($r,\@Problems,\@Students);
1.21 matthew 137: } else {
138: &prepare_html_output($r,\@Problems,\@Students);
139: }
1.1 matthew 140: }
141: $r->print('<hr />');
142: } else {
143: $r->print('<input type="submit" name="Generate" value="'.
1.17 matthew 144: &mt('Prepare Report').'" />');
1.1 matthew 145: $r->print(' 'x5);
1.19 matthew 146: $r->print('<p>'.
147: &mt('Computing correct answers greatly increasese the amount of time required to prepare a report.').
148: '</p>');
149: $r->print('<p>'.
1.50 bisitz 150: &mt('Please select problems and use the [_1]Prepare Report[_2] button to continue.','<b>','</b>').
1.19 matthew 151: '</p>');
1.18 matthew 152: $r->print(&Apache::lonstathelpers::MultipleProblemSelector
1.19 matthew 153: (undef,'problemchoice','Statistics'));
1.18 matthew 154: }
155: }
156:
1.30 matthew 157: ##
1.31 matthew 158: ## get_extra_response_headers
159: ##
160: sub get_extra_response_headers {
161: my @extra_resp_headers;
1.40 albertel 162: if ($env{'form.correctans'} eq 'true') {
1.31 matthew 163: push(@extra_resp_headers,'Correct');
164: }
1.40 albertel 165: if ($env{'form.prob_status'} eq 'true') {
1.31 matthew 166: push(@extra_resp_headers,'Award Detail');
167: push(@extra_resp_headers,'Time');
168: push(@extra_resp_headers,'Attempt');
169: push(@extra_resp_headers,'Awarded');
170: }
171: return @extra_resp_headers;
172: }
173:
174: ##
1.30 matthew 175: ## get_headers:
176: ## return the proper headers for the given response
177: sub get_headers {
178: my ($prob,$partid,$respid,$resptype,$analysis,$output,$purpose,
179: @basic_headers) = @_;
180: my @headers;
181: if ($resptype eq 'essay' && $purpose eq 'display' &&
182: ($output eq 'html')) {# || scalar(@{$prob->parts})!=1)) {
183: @headers = ();
184: } elsif ($resptype =~ /^(option|match|rank)$/) {
185: my $prefix = '_';
186: if ($purpose eq 'display') {
187: $prefix = '';
188: }
189: my @foils =
190: map {
191: $prefix.$_;
192: } sort(keys(%{$analysis->{$partid.'.'.$respid}->{'_Foils'}}));
193: if (scalar(@basic_headers) && $basic_headers[0] eq 'Correct') {
194: @foils = map { ($_ , $_.' Correct') } @foils;
195: shift(@basic_headers); # Get rid of 'Correct'
196: }
197: @headers = (@foils,@basic_headers);
1.42 albertel 198: } elsif (lc($resptype) eq 'task') {
199: @headers = ('Grader','Status',@basic_headers,'Submission');
1.30 matthew 200: } else {
201: @headers = ('Submission',@basic_headers);
202: }
203: return @headers;
204: }
205:
1.18 matthew 206: #########################################################
207: #########################################################
1.21 matthew 208: ##
209: ## HTML Output Routines
210: ##
211: #########################################################
212: #########################################################
213: sub prepare_html_output {
214: my ($r,$problems,$students) = @_;
215: my $c = $r->connection();
216: #
217: # Set a flag for the case when there is just one problem
218: my $single_response = 0;
219: if (scalar(@$problems) == 1 &&
220: $problems->[0]->countResponses == 1) {
221: $single_response = 1;
222: }
223: #
224: # Compute the number of columns per response
1.31 matthew 225: my @extra_resp_headers = &get_extra_response_headers();
1.21 matthew 226: #
227: # Create the table header
1.38 matthew 228: my @student_columns = ('username','domain','id','section');
1.21 matthew 229: #
230: my %headers;
231: my $student_column_count = scalar(@student_columns);
232: $headers{'problem'} = qq{<th colspan="$student_column_count">\ </th>};
233: foreach (@student_columns) {
234: $headers{'student'}.= '<th>'.ucfirst($_).'</th>';
235: }
236: #
237: # we put the headers into the %headers hash
238: my $total_col = scalar(@student_columns);
239: my $nonempty_part_headers = 0;
1.30 matthew 240: #
241: my %problem_analysis;
1.21 matthew 242: foreach my $prob (@$problems) {
1.31 matthew 243: my %analysis = &Apache::lonstathelpers::get_problem_data($prob->src);
1.30 matthew 244: $problem_analysis{$prob->src}=\%analysis;
245: #
1.21 matthew 246: my $prob_span = 0;
247: my $single_part = 0;
248: if (scalar(@{$prob->parts}) == 1) {
249: $single_part = 1;
250: }
251: foreach my $partid (@{$prob->parts}) {
252: my $part_span = 0;
253: my $responses = [$prob->responseIds($partid)];
254: my $resptypes = [$prob->responseType($partid)];
255: for (my $i=0;$i<scalar(@$responses);$i++) {
1.30 matthew 256: my $respid = $responses->[$i];
257: my @headers = &get_headers($prob,$partid,$respid,
258: $resptypes->[$i],
259: $problem_analysis{$prob->src},
260: 'html','display',
261: @extra_resp_headers);
262: if (scalar(@headers)>0) {
263: $total_col += scalar(@headers);
264: $part_span += scalar(@headers);
1.21 matthew 265: $headers{'response'} .=
1.30 matthew 266: '<th colspan="'.scalar(@headers).'">'.
1.21 matthew 267: &mt('Response [_1]',$responses->[$i]).'</th>';
1.51 ! bisitz 268: $headers{'student'}.= '<th>'.join('</th><th><span class="LC_nobreak">',
1.30 matthew 269: @headers).
1.51 ! bisitz 270: '</span></th>';
1.21 matthew 271: }
272: }
1.41 matthew 273: if ($part_span == 0) {
274: next;
275: }
1.21 matthew 276: if (! $single_part) {
277: my $tmpname = $partid;
278: if ($partid =~/^\d+$/) {
1.24 matthew 279: $tmpname = $prob->part_display($partid);
1.21 matthew 280: }
1.35 matthew 281: if ($tmpname !~ /^part/) {
282: $tmpname = 'Part '.$tmpname;
283: }
1.21 matthew 284: $headers{'part'} .= qq{<th colspan="$part_span">$tmpname</th>};
285: $nonempty_part_headers = 1;
286: } else {
287: $headers{'part'} .= qq{<th colspan="$part_span"> </th>};
288: }
289: $prob_span += $part_span;
290: }
1.23 matthew 291: my $title = $prob->compTitle;
1.21 matthew 292: if ($prob_span > 0) {
293: $headers{'problem'}.= qq{<th colspan="$prob_span">$title</th>};
294: } elsif ($single_response) {
295: $prob_span = scalar(@student_columns);
296: $headers{'problem'} = qq{<th colspan="$prob_span">$title</th>};
297: }
298: }
299: if (exists($headers{'part'})) {
300: $headers{'part'} = qq{<th colspan="$student_column_count">\ </th>}.
301: $headers{'part'};
302: }
303: if (exists($headers{'response'})) {
304: $headers{'response'}=
305: qq{<th colspan="$student_column_count">\ </th>}.
306: $headers{'response'};
307: }
308: my $full_header = $/.'<table>'.$/;
309: $full_header .= '<tr align="left">'.$headers{'problem'}.'</tr>'.$/;
310: if ($nonempty_part_headers) {
311: $full_header .= '<tr align="left">'.$headers{'part'}.'</tr>'.$/;
312: }
313: $full_header .= '<tr align="left">'.$headers{'response'}.'</tr>'.$/;
314: $full_header .= '<tr align="left">'.$headers{'student'}.'</tr>'.$/;
315: #
316: # Main loop
317: my $count;
318: $r->print($/.$full_header.$/);
319: my $row_class = 'odd'; # css
320: foreach my $student (@$students) {
321: my $student_row_data;
322: if ($count++ >= 30) {
323: $r->print('</table>'.$/.$full_header.$/);
324: $count = 0;
325: }
326: last if ($c->aborted());
327: foreach my $field (@student_columns) {
328: $student_row_data .=
329: '<td valign="top">'.$student->{$field}.'</td>';
330: }
331: #
332: # Figure out what it is we need to output for this student
333: my @essays;
1.30 matthew 334: my %prob_data;
1.21 matthew 335: my $maxrow;
336: foreach my $prob (@$problems) {
1.30 matthew 337: $prob_data{$prob->symb}={};
1.21 matthew 338: foreach my $partid (@{$prob->parts}) {
339: my @responses = $prob->responseIds($partid);
340: my @response_type = $prob->responseType($partid);
341: for (my $i=0;$i<=$#responses;$i++) {
1.30 matthew 342: my $respid = $responses[$i];
1.21 matthew 343: my $results =
344: &Apache::loncoursedata::get_response_data_by_student
345: ($student,$prob->symb(),$respid);
1.30 matthew 346: my $resptype = $response_type[$i];
347: my @headers = &get_headers($prob,$partid,$respid,
348: $resptype,
349: $problem_analysis{$prob->src},
350: 'html','normal',
351: @extra_resp_headers);
352: my $width = scalar(@headers);
1.41 matthew 353: next if ($width < 1);
1.30 matthew 354: my $resp_data;
1.41 matthew 355: $resp_data->{'fake'} = qq{<td colspan="$width"> </td>};
1.21 matthew 356: if (! defined($results)) {
357: $results = [];
358: }
1.30 matthew 359: #
1.21 matthew 360: if (scalar(@$results) > $maxrow && $resptype ne 'essay') {
361: $maxrow = scalar(@$results);
362: }
363: for (my $j=scalar(@$results)-1;$j>=0;$j--) {
1.40 albertel 364: if ($env{'form.all_sub'} ne 'true') {
1.21 matthew 365: next if ($j ne scalar(@$results)-1);
366: }
1.30 matthew 367: my $response = &hashify_response($results->[$j],
368: $prob,
369: $student,
370: $partid,
371: $respid);
1.21 matthew 372: if ($resptype eq 'essay') {
373: push(@essays,
1.30 matthew 374: &html_essay_results(\@headers,
1.21 matthew 375: $prob,$partid,$respid,
376: $response,
377: $single_response).
378: '</td>');
1.42 albertel 379: } elsif (lc($resptype) eq 'task') {
380: my $results =
381: &html_task_results(\@headers,
382: $prob,$partid,$respid,
383: $response,$resptype);
384: if ($results) {
385: push(@{$resp_data->{'real'}},$results);
386: }
1.21 matthew 387: } else {
388: push(@{$resp_data->{'real'}},
1.30 matthew 389: &html_non_essay_results(\@headers,
390: $prob,$partid,$respid,
391: $response,$resptype));
1.21 matthew 392: }
1.30 matthew 393: }
394: $prob_data{$prob->symb}->{$partid}->{$respid}=$resp_data;
1.21 matthew 395: } # end of $i loop
396: } # end of partid loop
397: } # end of prob loop
398: #
399: # if there is no data, skip this student.
400: next if (! $maxrow && ! scalar(@essays));
401: #
402: # Go through the problem data and output a row.
403: if ($row_class eq 'even') {
404: $row_class = 'odd';
405: } else {
406: $row_class = 'even';
407: }
408: my $printed_something;
409: for (my $rows_output = 0;$rows_output<$maxrow;$rows_output++) {
410: my $html;
411: my $no_data = 1;
412: foreach my $prob (@$problems) {
413: foreach my $partid (@{$prob->parts}) {
414: my @responses = $prob->responseIds($partid);
415: my @response_type = $prob->responseType($partid);
416: for (my $i=0;$i<=$#responses;$i++) {
417: my $respid = $responses[$i];
418: my $resp_data =
1.30 matthew 419: $prob_data{$prob->symb}->{$partid}->{$respid};
1.21 matthew 420: next if ($response_type[$i] eq 'essay');
421: if (defined($resp_data->{'real'}->[$rows_output])) {
422: $html .= $resp_data->{'real'}->[$rows_output];
423: $no_data = 0;
424: } else {
425: $html .= $resp_data->{'fake'};
426: }
427: }
428: }
429: }
430: if (! $no_data) {
431: $r->print(qq{<tr class="$row_class">$student_row_data$html</tr>}.$/);
432: $printed_something=1;
433: }
434: }
435: if (@essays) {
436: my $tr = qq{<tr class="$row_class">};
437: my $td = qq{<td valign="top" class="essay" colspan="$total_col">};
438: if (! $printed_something) {
439: $r->print($tr.$student_row_data.'</tr>'.$/);
440: }
441: $r->print($tr.$td.
442: join('</td></tr>'.$/.$tr.$td,@essays).'</td></tr>'.$/);
443: undef(@essays);
444: }
445: } # end of student loop
446: return;
447: }
448:
1.30 matthew 449: sub hashify_response {
450: my ($response,$prob,$student,$partid,$respid) =@_;
451: my $resp_hash = {};
1.40 albertel 452: if ($env{'form.correctans'} eq 'true') {
1.30 matthew 453: $resp_hash->{'Correct'} =
454: &Apache::lonstathelpers::get_student_answer
455: ($prob,$student->{'username'},$student->{'domain'},
456: $partid,$respid);
457: }
458: $resp_hash->{'Submission'} =
459: $response->[&Apache::loncoursedata::RDs_submission()];
460: $resp_hash->{'Time'} =
461: $response->[&Apache::loncoursedata::RDs_timestamp()];
462: $resp_hash->{'Attempt'} =
463: $response->[&Apache::loncoursedata::RDs_tries()];
464: $resp_hash->{'Awarded'} =
465: $response->[&Apache::loncoursedata::RDs_awarded()];
1.42 albertel 466: if ($prob->is_task()) {
467: $resp_hash->{'Grader'} =
468: $response->[&Apache::loncoursedata::RDs_response_eval_2()];
469: if ($resp_hash->{'Attempt'} eq '0') {
470: $resp_hash->{'Attempt'} = '';
471: }
472: $resp_hash->{'Award Detail'} =
473: $response->[&Apache::loncoursedata::RDs_part_award()];
474: $resp_hash->{'Status'} =
475: $response->[&Apache::loncoursedata::RDs_response_eval()];
476: } else {
477: $resp_hash->{'Award Detail'} =
478: $response->[&Apache::loncoursedata::RDs_awarddetail()];
479: }
480:
1.30 matthew 481: return $resp_hash;
482: }
483:
1.21 matthew 484: #####################################################
485: ##
486: ## HTML helper routines
487: ##
488: #####################################################
489: sub html_essay_results {
1.30 matthew 490: my ($headers,$prob,$partid,$respid,$response,$single_response)=@_;
491: if (! ref($headers) || ref($headers) ne 'ARRAY') {
492: return '';
1.21 matthew 493: }
1.30 matthew 494: # Start of telling them what problem, part, and response
1.21 matthew 495: my $Str;
496: if (! $single_response) {
1.23 matthew 497: my $id = $prob->compTitle;
1.21 matthew 498: if (defined($partid) && $partid ne '0') {
1.24 matthew 499: $id .= ' '.$prob->part_display($partid);
1.21 matthew 500: }
501: if (defined($respid)) {
502: $id .= ' '.$respid;
503: }
1.51 ! bisitz 504: $Str .= '<span class="LC_nobreak">'.$id.'</span>'.(' 'x4);
1.21 matthew 505: }
1.30 matthew 506: #
507: shift(@$headers); # Get rid of the Submission header
508: my $correct = '';
509: if ($headers->[0] eq 'Correct') {
510: $correct = &html_format_essay_sub($response->{'Correct'});
511: shift(@$headers);
512: }
1.51 ! bisitz 513: $Str .= '<span class="LC_nobreak">'.
1.30 matthew 514: join('',
515: map {
516: (' 'x4).&mt($_.': [_1]',$response->{$_});
1.51 ! bisitz 517: } @$headers).'</span>';
1.30 matthew 518: if (@$headers || ! $single_response) {
519: $Str .= '<br />';
1.21 matthew 520: }
1.30 matthew 521: $Str .= &html_format_essay_sub($response->{'Submission'});
522: #
1.21 matthew 523: if (defined($correct) && $correct !~ /^\s*$/) {
524: $Str .= '<hr /><b>'.&mt('Correct').'</b>'.$correct
525: }
526: return $Str;
527: }
528:
1.30 matthew 529: sub html_format_essay_sub {
530: my ($submission) = @_;
531: return '' if (! defined($submission) || $submission eq '');
532: $submission = &HTML::Entities::decode($submission);
533: $submission =~ s/\\\"/\"/g;
534: $submission =~ s/\\\'/\'/g;
535: $submission =~ s|\\r\\n|$/|g;
536: $submission = &HTML::Entities::encode($submission,'<>&"');
537: $submission =~ s|$/\s*$/|$/</p><p>$/|g;
538: $submission =~ s|\\||g;
539: $submission = '<p>'.$submission.'</p>';
540: return $submission;
1.21 matthew 541: }
542:
1.42 albertel 543: sub html_task_results {
544: my ($headers,$prob,$partid,$respid,$response,$resptype) = @_;
545: if (! ref($headers) || ref($headers) ne 'ARRAY' || ! scalar(@$headers)) {
546: return '';
547: }
548:
549: my @values;
550: @values = map { $response->{$_}; } @$headers;
551:
552: my $td = '<td valign="top">';
553: my $str = $td.join('</td>'.$td,@values).'</td>';
554: return $str;
555: }
556:
1.30 matthew 557: sub html_non_essay_results {
558: my ($headers,$prob,$partid,$respid,$response,$resptype) = @_;
559: if (! ref($headers) || ref($headers) ne 'ARRAY' || ! scalar(@$headers)) {
560: return '';
561: }
562: #
1.45 www 563: my $submission = &HTML::Entities::decode(&unescape($response->{'Submission'}));
1.21 matthew 564: return '' if (! defined($submission) || $submission eq '');
1.25 matthew 565: $submission =~ s/\\\"/\"/g;
566: $submission =~ s/\\\'/\'/g;
1.30 matthew 567: if ($resptype eq 'radiobutton') {
1.25 matthew 568: $submission = &HTML::Entities::encode($submission,'<>&"');
1.21 matthew 569: $submission =~ s/=([^=])$//;
1.51 ! bisitz 570: $submission = '<span class="LC_nobreak">'.$submission.'</span>';
1.30 matthew 571: }
572: $response->{'Submission'} = $submission;
573: #
574: my @values;
575: if ($resptype =~ /^(option|match|rank)$/) {
576: my %submission =
577: map {
1.45 www 578: my ($foil,$value) = split('=',&unescape($_));
1.30 matthew 579: ($foil,$value);
580: } split('&',$response->{'Submission'});
581: my %correct;
582: if (exists($response->{'Correct'})) {
583: %correct =
584: map {
1.45 www 585: my ($foil,$value)=split('=',&unescape($_));
1.30 matthew 586: ($foil,$value);
587: } split('&',$response->{'Correct'});
588: }
589: #
590: foreach my $original_header (@$headers) {
591: if ($original_header =~ /^_/) {
592: # '_' denotes a foil column
593: my ($header) = ($original_header =~ m/^_(.*)$/);
594: my $option = '';
595: if ( my ($foil) = ($header =~ /(.*) Correct$/)) {
596: if (exists($correct{$foil})) {
597: $option = $correct{$foil};
598: }
599: } elsif (exists($submission{$header})) {
600: $option = $submission{$header};
601: }
602: push(@values,&HTML::Entities::encode($option));
1.38 matthew 603: } elsif ($original_header eq 'Time') {
604: push(@values,&Apache::lonlocal::locallocaltime($response->{$original_header}));
1.30 matthew 605: } else {
606: # A normal column
607: push(@values,$response->{$original_header});
608: }
609: }
1.25 matthew 610: } else {
1.30 matthew 611: @values = map { $response->{$_}; } @$headers;
1.21 matthew 612: }
1.30 matthew 613: my $td = '<td valign="top">';
614: my $str = $td.join('</td>'.$td,@values).'</td>';
615: return $str;
1.21 matthew 616: }
1.18 matthew 617:
1.30 matthew 618:
1.21 matthew 619: #########################################################
620: #########################################################
621: ##
622: ## Excel Output Routines
623: ##
624: #########################################################
625: #########################################################
626: sub prepare_excel_output {
1.19 matthew 627: my ($r,$Problems,$Students) = @_;
1.18 matthew 628: my $c = $r->connection();
629: #
1.19 matthew 630: #
631: # Determine the number of columns in the spreadsheet
632: my $columncount = 3; # username, domain, id
1.31 matthew 633: my @extra_resp_headers = &get_extra_response_headers();
1.20 matthew 634: my $lastprob;
1.31 matthew 635: my %problem_analysis;
1.19 matthew 636: foreach my $prob (@$Problems) {
1.31 matthew 637: my %analysis = &Apache::lonstathelpers::get_problem_data($prob->src);
638: $problem_analysis{$prob->src}=\%analysis;
639: foreach my $partid (@{$prob->parts}) {
640: my $responses = [$prob->responseIds($partid)];
641: my $resptypes = [$prob->responseType($partid)];
642: for (my $i=0;$i<scalar(@$responses);$i++) {
643: my @headers = &get_headers($prob,$partid,$responses->[$i],
644: $resptypes->[$i],
645: $problem_analysis{$prob->src},
646: 'excel','display',
647: @extra_resp_headers);
648: $columncount += scalar(@headers);
649: }
650: }
1.19 matthew 651: last if ($columncount > 255);
1.20 matthew 652: $lastprob = $prob;
1.19 matthew 653: }
654: if ($columncount > 255) {
655: $r->print('<h1>'.&mt('Unable to complete request').'</h1>'.$/.
656: '<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>'.$/.
1.20 matthew 657: '<p>'.&mt('Consider selecting fewer problems to generate reports on, or reducing the number of items per problem. Or use HTML or CSV output.').'</p>'.$/.
1.23 matthew 658: '<p>'.&mt('The last problem that will fit in the current spreadsheet is [_1].',$lastprob->compTitle).'</p>');
1.19 matthew 659: $r->rflush();
660: return;
661: }
662: #
663: # Print out a message telling them what we are doing
1.18 matthew 664: if (scalar(@$Problems) > 1) {
665: $r->print('<h2>'.
666: &mt('Preparing Excel spreadsheet of student responses to [_1] problems',
667: scalar(@$Problems)).
668: '</h2>');
669: } else {
670: $r->print('<h2>'.
671: &mt('Preparing Excel spreadsheet of student responses').
672: '</h2>');
673: }
674: $r->rflush();
675: #
676: # Create the excel spreadsheet
1.36 matthew 677: my ($workbook,$filename,$format) =
678: &Apache::loncommon::create_workbook($r);
679: return if (! defined($workbook));
1.18 matthew 680: my $worksheet = $workbook->addworksheet('Student Submission Data');
681: #
682: # Add headers to the worksheet
683: my $rows_output = 0;
684: $worksheet->write($rows_output++,0,
1.40 albertel 685: $env{'course.'.$env{'request.course.id'}.'.description'},
1.18 matthew 686: $format->{'h1'});
687: $rows_output++;
688: my $cols_output = 0;
689: my $title_row = $rows_output++;
690: my $partid_row = $rows_output++;
691: my $respid_row = $rows_output++;
692: my $header_row = $rows_output++;
693: $worksheet->write($title_row ,0,'Problem Title',$format->{'bold'});
694: $worksheet->write($partid_row,0,'Part ID',$format->{'bold'});
695: $worksheet->write($respid_row,0,'Response ID',$format->{'bold'});
696: # Student headers
1.38 matthew 697: my @StudentColumns = ('username','domain','id','section');
1.18 matthew 698: foreach (@StudentColumns) {
1.19 matthew 699: $worksheet->write($header_row,$cols_output++,ucfirst($_),
700: $format->{'bold'});
1.18 matthew 701: }
702: # Problem headers
1.31 matthew 703: my %start_col;
1.18 matthew 704: foreach my $prob (@$Problems) {
1.23 matthew 705: my $title = $prob->compTitle;
1.18 matthew 706: $worksheet->write($title_row,$cols_output,
707: $title,$format->{'h3'});
708: foreach my $partid (@{$prob->parts}) {
1.24 matthew 709: $worksheet->write($partid_row,$cols_output,
710: $prob->part_display($partid));
1.18 matthew 711: my $responses = [$prob->responseIds($partid)];
712: my $resptypes = [$prob->responseType($partid)];
713: for (my $i=0;$i<scalar(@$responses);$i++) {
1.31 matthew 714: $start_col{$prob->symb}->{$partid}->{$responses->[$i]}=
715: $cols_output;
1.18 matthew 716: $worksheet->write($respid_row,$cols_output,
717: $resptypes->[$i].', '.$responses->[$i]);
1.31 matthew 718: my @headers = &get_headers($prob,$partid,$responses->[$i],
719: $resptypes->[$i],
720: $problem_analysis{$prob->src},
721: 'excel','display',
722: @extra_resp_headers);
723: foreach my $text (@headers) {
724: if ($text eq 'Time') {
725: $worksheet->set_column($cols_output,$cols_output,undef,
726: $format->{'date'});
727: }
728: $worksheet->write($header_row,$cols_output++,$text);
1.20 matthew 729: }
1.18 matthew 730: }
731: }
732: }
733: #
734: # Populate the worksheet with the student data
735: my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
736: ($r,'Excel File Compilation Status',
737: 'Excel File Compilation Progress',
738: scalar(@$Students),'inline',undef,'Statistics','stats_status');
1.20 matthew 739: my $max_row = $rows_output;
1.18 matthew 740: foreach my $student (@$Students) {
741: last if ($c->aborted());
742: $cols_output = 0;
1.20 matthew 743: my $student_row = $max_row;
1.18 matthew 744: foreach my $field (@StudentColumns) {
1.20 matthew 745: $worksheet->write($student_row,$cols_output++,
1.18 matthew 746: $student->{$field});
747: }
1.20 matthew 748: my $last_student_col = $cols_output-1;
1.18 matthew 749: foreach my $prob (@$Problems) {
750: foreach my $partid (@{$prob->parts}) {
751: my @Response = $prob->responseIds($partid);
752: my @ResponseType = $prob->responseType($partid);
753: for (my $i=0;$i<=$#Response;$i++) {
754: my $respid = $Response[$i];
755: my $resptype = $ResponseType[$i];
756: my $results =
757: &Apache::loncoursedata::get_response_data_by_student
758: ($student,$prob->symb(),$respid);
1.31 matthew 759: my @headers = &get_headers($prob,$partid,$respid,
760: $resptype,
761: $problem_analysis{$prob->src},
762: 'excel','normal',
763: @extra_resp_headers);
764:
1.20 matthew 765: if (! defined($results)) {
766: $results = [];
767: }
768: #
769: $rows_output = $student_row;
770: #
1.31 matthew 771: my $response_start_col = $start_col{$prob->symb}->{$partid}->{$respid};
1.20 matthew 772: for (my $j=scalar(@$results)-1;$j>=0;$j--) {
773: $cols_output = $response_start_col;
1.40 albertel 774: if ($env{'form.all_sub'} ne 'true') {
1.20 matthew 775: next if ($j ne scalar(@$results)-1);
776: }
1.31 matthew 777: my $response = &hashify_response($results->[$j],
778: $prob,
779: $student,
780: $partid,
781: $respid);
782: my @response_data =
1.33 matthew 783: &compile_response_data(\@headers,$response,
784: $prob,$partid,$respid,
785: $resptype,
786: \&excel_format_item);
1.31 matthew 787: $worksheet->write_row($rows_output++,$cols_output,
788: \@response_data);
789: $cols_output+=scalar(@response_data);
1.20 matthew 790: if ($rows_output > $max_row) {
791: $max_row = $rows_output;
792: }
1.19 matthew 793: }
1.18 matthew 794: }
795: }
796: }
1.28 matthew 797: # Fill in the remaining rows with the students data
1.34 matthew 798: for (my $row = $student_row+1;$row<$max_row;$row++) {
1.28 matthew 799: my $cols = 0;
800: foreach my $field (@StudentColumns) {
801: $worksheet->write($row,$cols++,
802: $student->{$field});
803: }
804: }
1.18 matthew 805: &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
806: 'last student');
807: }
808: &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
809: #
810: # Close the excel file
811: $workbook->close();
812: #
813: # Write a link to allow them to download it
814: $r->print('<p><a href="'.$filename.'">'.
815: &mt('Your Excel spreadsheet.').
816: '</a></p>'."\n");
817: $r->print('<script>'.
818: 'window.document.Statistics.stats_status.value="'.
819: 'Done compiling spreadsheet. See link below to download.'.
820: '";</script>');
821: $r->rflush();
822: return;
823: }
824:
1.33 matthew 825: sub compile_response_data {
826: my ($headers,$response,$prob,$partid,$respid,$resptype,$format) = @_;
1.31 matthew 827: if (! ref($headers) || ref($headers) ne 'ARRAY' || ! scalar(@$headers)) {
828: return ();
829: }
1.33 matthew 830: if (ref($format) ne 'CODE') {
831: $format = sub { return $_[0]; };
832: }
1.31 matthew 833: #
1.33 matthew 834: my $submission =
835: &HTML::Entities::decode
1.45 www 836: (&unescape($response->{'Submission'}));
1.42 albertel 837: if (!$prob->is_task()) {
838: return () if (! defined($submission) || $submission eq '');
839: }
1.31 matthew 840: $submission =~ s/\\\"/\"/g;
841: $submission =~ s/\\\'/\'/g;
842: if ($resptype eq 'radiobutton') {
843: $submission =~ s/=([^=])$//;
1.20 matthew 844: }
1.31 matthew 845: $response->{'Submission'} = $submission;
846: #
847: my @values;
848: if ($resptype =~ /^(option|match|rank)$/) {
849: my %submission =
850: map {
1.45 www 851: my ($foil,$value) = split('=',&unescape($_));
1.31 matthew 852: ($foil,$value);
853: } split('&',$response->{'Submission'});
854: my %correct;
855: if (exists($response->{'Correct'})) {
856: %correct =
857: map {
1.45 www 858: my ($foil,$value)=split('=',&unescape($_));
1.31 matthew 859: ($foil,$value);
860: } split('&',$response->{'Correct'});
861: }
862: #
863: foreach my $original_header (@$headers) {
864: if ($original_header =~ /^_/) {
865: # '_' denotes a foil column
866: my ($header) = ($original_header =~ m/^_(.*)$/);
867: my $option = '';
868: if ( my ($foil) = ($header =~ /(.*) Correct$/)) {
869: if (exists($correct{$foil})) {
870: $option = $correct{$foil};
871: }
872: } elsif (exists($submission{$header})) {
873: $option = $submission{$header};
874: }
1.33 matthew 875: push(@values,&{$format}($option,$header));
1.31 matthew 876: } else {
877: # A normal column
1.33 matthew 878: push(@values,&{$format}($response->{$original_header},
1.31 matthew 879: $original_header));
880: }
881: }
882: } else {
1.33 matthew 883: @values = map { &{$format}($response->{$_},$_); } @$headers;
1.20 matthew 884: }
1.31 matthew 885: return @values;
1.20 matthew 886: }
887:
1.31 matthew 888: sub excel_format_item {
889: my ($item,$type) = @_;
890: if ($type eq 'Time') {
1.33 matthew 891: $item = &Apache::lonstathelpers::calc_serial($item);
1.31 matthew 892: } else {
893: if ($item =~ m/^=/) {
894: $item = ' '.$item;
895: }
896: $item =~ s/\\r//g;
897: $item =~ s/\\n/\n/g;
898: $item =~ s/(\s*$|^\s*)//g;
899: $item =~ s/\\\'/\'/g;
1.18 matthew 900: }
1.31 matthew 901: return $item;
1.1 matthew 902: }
903:
904: #########################################################
905: #########################################################
1.17 matthew 906: ##
907: ## CSV output of student answers
908: ##
909: #########################################################
910: #########################################################
911: sub prepare_csv_output {
1.22 matthew 912: my ($r,$problems,$students) = @_;
1.17 matthew 913: my $c = $r->connection();
914: #
915: $r->print('<h2>'.
916: &mt('Generating CSV report of student responses').'</h2>');
917: #
918: # Progress window
919: my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
920: ($r,'CSV File Compilation Status',
921: 'CSV File Compilation Progress',
1.22 matthew 922: scalar(@$students),'inline',undef,'Statistics','stats_status');
923:
1.17 matthew 924: $r->rflush();
925: #
926: # Open a file
927: my $outputfile;
928: my $filename = '/prtspool/'.
1.40 albertel 929: $env{'user.name'}.'_'.$env{'user.domain'}.'_'.
1.17 matthew 930: time.'_'.rand(1000000000).'.csv';
931: unless ($outputfile = Apache::File->new('>/home/httpd'.$filename)) {
932: $r->log_error("Couldn't open $filename for output $!");
1.50 bisitz 933: $r->print('<div class="LC_error">'
934: .&mt('Problems occurred in writing the CSV file. '
1.47 bisitz 935: .'This error has been logged. '
1.50 bisitz 936: .'Please alert your LON-CAPA administrator.')
937: .'</div>');
1.17 matthew 938: $outputfile = undef;
939: }
940: #
1.22 matthew 941: # Compute the number of columns per response
1.32 matthew 942: my @extra_resp_headers = &get_extra_response_headers();
1.22 matthew 943: #
944: # Create the table header
1.38 matthew 945: my @student_columns = ('username','domain','id','section');
1.17 matthew 946: #
1.22 matthew 947: my %headers;
948: push(@{$headers{'student'}},@student_columns);
949: # Pad for the student data
950: foreach my $row ('problem','part','response') {
1.32 matthew 951: $headers{$row}=[map {''} @student_columns];
1.22 matthew 952: }
953: #
954: # we put the headers into the %headers hash
1.32 matthew 955: my %problem_analysis;
956: my %start_col;
957: my $max_column = scalar(@student_columns);
1.22 matthew 958: foreach my $prob (@$problems) {
1.32 matthew 959: my %analysis = &Apache::lonstathelpers::get_problem_data($prob->src);
960: $problem_analysis{$prob->src}=\%analysis;
961: $headers{'problem'}->[$max_column] = $prob->compTitle;
1.22 matthew 962: foreach my $partid (@{$prob->parts}) {
1.32 matthew 963: $headers{'part'}->[$max_column] = $prob->part_display($partid);
1.22 matthew 964: my $responses = [$prob->responseIds($partid)];
1.32 matthew 965: my $resptypes = [$prob->responseType($partid)];
1.22 matthew 966: for (my $i=0;$i<scalar(@$responses);$i++) {
1.32 matthew 967: my @headers = &get_headers($prob,$partid,$responses->[$i],
968: $resptypes->[$i],
969: $problem_analysis{$prob->src},
970: 'csv','display',
971: @extra_resp_headers);
972: $start_col{$prob->symb}->{$partid}->{$responses->[$i]}=
973: $max_column;
974: $headers{'response'}->[$max_column]=
1.22 matthew 975: &mt('Response [_1]',$responses->[$i]);
1.32 matthew 976: for (my $j=0;$j<=$#headers;$j++) {
977: $headers{'student'}->[$max_column+$j]=$headers[$j];
1.22 matthew 978: }
1.32 matthew 979: $max_column += scalar(@headers);
1.17 matthew 980: }
981: }
982: }
1.22 matthew 983: foreach my $row ('problem','part','response','student') {
1.32 matthew 984: print $outputfile '"'.
1.22 matthew 985: join('","',
986: map {
987: &Apache::loncommon::csv_translate($_);
988: } @{$headers{$row}}).'"'.$/;
1.17 matthew 989: }
990: #
1.22 matthew 991: # Main loop
992: foreach my $student (@$students) {
1.27 matthew 993: last if ($c->aborted());
1.22 matthew 994: my @rows;
995: foreach my $prob (@$problems) {
996: foreach my $partid (@{$prob->parts}) {
997: my @responses = $prob->responseIds($partid);
998: my @response_type = $prob->responseType($partid);
999: for (my $i=0;$i<=$#responses;$i++) {
1000: my $respid = $responses[$i];
1.32 matthew 1001: my $resptype = $response_type[$i];
1002: my @headers = &get_headers($prob,$partid,$respid,$resptype,
1003: $problem_analysis{$prob->src},
1004: 'csv','normal',
1005: @extra_resp_headers);
1.22 matthew 1006: my $results =
1007: &Apache::loncoursedata::get_response_data_by_student
1008: ($student,$prob->symb(),$respid);
1009: if (! defined($results)) {
1010: $results = [];
1011: }
1012: for (my $j=0; $j<scalar(@$results);$j++) {
1.40 albertel 1013: if ($env{'form.all_sub'} ne 'true') {
1.22 matthew 1014: next if ($j != 0);
1015: }
1016: my $idx = scalar(@$results) - $j - 1;
1.32 matthew 1017: my $response = &hashify_response($results->[$idx],
1018: $prob,$student,
1019: $partid,$respid);
1020: my @data = &compile_response_data(\@headers,$response,
1.22 matthew 1021: $prob,$partid,
1.33 matthew 1022: $respid,$resptype,
1023: \&csv_format_item);
1.32 matthew 1024: my $resp_start_idx =
1025: $start_col{$prob->symb}->{$partid}->{$respid};
1.22 matthew 1026: for (my $k=0;$k<=$#data;$k++) {
1.32 matthew 1027: $rows[$j]->[$resp_start_idx + $k] = $data[$k];
1.22 matthew 1028: }
1029: }
1030: }
1.17 matthew 1031: }
1.22 matthew 1032: }
1033: foreach my $row (@rows) {
1034: print $outputfile '"'.join('","',
1035: map { $student->{$_}; }
1036: @student_columns).'"';
1.32 matthew 1037: for (my $i=scalar(@student_columns);$i<$max_column;$i++) {
1.22 matthew 1038: my $value = &Apache::loncommon::csv_translate($row->[$i]);
1039: $value ||='';
1040: print $outputfile ',"'.$value.'"';
1.17 matthew 1041: }
1.22 matthew 1042: print $outputfile $/;
1.17 matthew 1043: }
1.22 matthew 1044: undef(@rows);
1.17 matthew 1045: &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
1046: 'last student');
1047: }
1048: close($outputfile);
1049: #
1050: # Close the progress window
1051: &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
1052: #
1.48 bisitz 1053: # Tell the user where to get their CSV file
1.17 matthew 1054: $r->print('<br />'.
1.48 bisitz 1055: '<a href="'.$filename.'">'.&mt('Your CSV file.').'</a>'."\n");
1.17 matthew 1056: $r->rflush();
1057: return;
1058: }
1059:
1.32 matthew 1060: sub csv_format_item {
1061: my ($item,$type) = @_;
1062: if ($type eq 'Time') {
1063: $item = localtime($item);
1.33 matthew 1064: }
1.32 matthew 1065: $item =&Apache::loncommon::csv_translate($item);
1066: return $item;
1.15 matthew 1067: }
1068:
1.1 matthew 1069: #########################################################
1070: #########################################################
1071: ##
1072: ## Generic Interface Routines
1073: ##
1074: #########################################################
1075: #########################################################
1076: sub CreateInterface {
1077: ##
1.16 matthew 1078: ## Output Selection
1.19 matthew 1079: my $output_selector = $/.'<select name="output">'.$/;
1.22 matthew 1080: foreach ('HTML','Excel','CSV') {
1.19 matthew 1081: $output_selector .= ' <option value="'.lc($_).'"';
1.40 albertel 1082: if ($env{'form.output'} eq lc($_)) {
1.19 matthew 1083: $output_selector .= ' selected ';
1.16 matthew 1084: }
1.19 matthew 1085: $output_selector .='>'.&mt($_).'</option>'.$/;
1.16 matthew 1086: }
1.19 matthew 1087: $output_selector .= '</select>'.$/;
1.16 matthew 1088: ##
1.1 matthew 1089: ## Environment variable initialization
1090: my $Str = '';
1.43 albertel 1091: $Str .= &Apache::lonhtmlcommon::breadcrumbs('Student Submission Reports');
1.11 matthew 1092: $Str .= '<p>';
1.50 bisitz 1093: $Str .= &Apache::loncommon::start_data_table();
1094: $Str .= &Apache::loncommon::start_data_table_header_row();
1.16 matthew 1095: $Str .= '<th>'.&mt('Sections').'</th>';
1.44 raeburn 1096: $Str .= '<th>'.&mt('Groups').'</th>';
1.46 raeburn 1097: $Str .= '<th>'.&mt('Access Status').'</th>';
1.50 bisitz 1098: # $Str .= '<th>'.&mt('Output as [_1]',$output_selector).'</th>';
1099: $Str .= '<th>'.&mt('Options').'</th>';
1100: $Str .= '<th>'.&mt('Output Format').'</th>';
1101: $Str .= &Apache::loncommon::end_data_table_header_row();
1.11 matthew 1102: #
1.50 bisitz 1103: $Str .= &Apache::loncommon::start_data_table_row();
1104: $Str .= '<td align="center">'."\n";
1.1 matthew 1105: $Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5);
1106: $Str .= '</td>';
1107: #
1.44 raeburn 1108: $Str .= '<td align="center">'."\n";
1109: $Str .= &Apache::lonstatistics::GroupSelect('Group','multiple',5);
1110: $Str .= '</td>';
1111: #
1.1 matthew 1112: $Str .= '<td align="center">';
1113: $Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5);
1114: $Str .= '</td>';
1.6 matthew 1115: #
1.15 matthew 1116: # Render problem checkbox
1117: my $prob_checkbox = '<input type="checkbox" name="renderprob" ';
1.40 albertel 1118: if (exists($env{'form.renderprob'}) && $env{'form.renderprob'} eq 'true') {
1.50 bisitz 1119: $prob_checkbox .= 'checked="checked" ';
1.15 matthew 1120: }
1121: $prob_checkbox .= 'value="true" />';
1122: #
1123: # Compute correct answers checkbox
1124: my $ans_checkbox = '<input type="checkbox" name="correctans" ';
1.40 albertel 1125: if (exists($env{'form.correctans'}) && $env{'form.correctans'} eq 'true') {
1.50 bisitz 1126: $ans_checkbox .= 'checked="checked" ';
1.13 matthew 1127: }
1.15 matthew 1128: $ans_checkbox .= 'value="true" />';
1129: #
1.19 matthew 1130: # Show all submissions checkbox
1131: my $all_sub_checkbox = '<input type="checkbox" name="all_sub" ';
1.40 albertel 1132: if (exists($env{'form.all_sub'}) &&
1133: $env{'form.all_sub'} eq 'true') {
1.50 bisitz 1134: $all_sub_checkbox .= 'checked="checked" ';
1.15 matthew 1135: }
1.19 matthew 1136: $all_sub_checkbox.= 'value="true" />';
1.15 matthew 1137: #
1.20 matthew 1138: # problem status checkbox
1139: my $prob_status_checkbox = '<input type="checkbox" name="prob_status" ';
1.40 albertel 1140: if (exists($env{'form.prob_status'}) &&
1141: $env{'form.prob_status'} eq 'true') {
1.50 bisitz 1142: $prob_status_checkbox .= 'checked="checked" ';
1.15 matthew 1143: }
1.20 matthew 1144: $prob_status_checkbox .= 'value="true" />';
1.15 matthew 1145: #
1.39 matthew 1146: $Str .= '<td align="right" valign="top">'.
1.16 matthew 1147: '<label><b>'.
1.20 matthew 1148: &mt('Show problem [_1]',$prob_checkbox).'</b></label><br />'.
1149: '<label><b>'.
1150: &mt('Show correct answers [_1]',$ans_checkbox).'</b></label><br />'.
1151: '<label><b>'.
1152: &mt('Show all submissions [_1]',$all_sub_checkbox).
1153: '</b></label><br />'.
1.15 matthew 1154: '<label><b>'.
1.20 matthew 1155: &mt('Show problem grading [_1]',$prob_status_checkbox).
1156: '</b></label><br />'.
1.15 matthew 1157: '</td>';
1.13 matthew 1158: #
1.50 bisitz 1159: $Str .= '<td align="center" valign="top">'.$output_selector.'</td>';
1160: #
1161: $Str .= &Apache::loncommon::end_data_table_row();
1162: $Str .= &Apache::loncommon::end_data_table();
1.1 matthew 1163: #
1.49 bisitz 1164: $Str .= '<p><span class="LC_nobreak">'
1165: .&mt('Status: [_1]',
1166: '<input type="text" name="stats_status"'
1167: .' size="60" value="" readonly="readonly" />')
1168: .'</span></p>';
1.11 matthew 1169: ##
1.1 matthew 1170: return $Str;
1171: }
1172:
1173: 1;
1174:
1175: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>