version 1.19, 2004/09/16 21:54:22
|
version 1.20, 2004/09/20 19:24:02
|
Line 152 sub new_excel_output {
|
Line 152 sub new_excel_output {
|
# |
# |
# Determine the number of columns in the spreadsheet |
# Determine the number of columns in the spreadsheet |
my $columncount = 3; # username, domain, id |
my $columncount = 3; # username, domain, id |
my $multiplier = 1; |
my $response_multiplier = 1; |
$multiplier ++ if ($ENV{'form.correctans'} eq 'true'); |
$response_multiplier ++ if ($ENV{'form.correctans'} eq 'true'); |
|
$response_multiplier += 4 if ($ENV{'form.prob_status'} eq 'true'); |
|
my $lastprob; |
foreach my $prob (@$Problems) { |
foreach my $prob (@$Problems) { |
$columncount += ($multiplier * $prob->countResponses); |
$columncount += ($response_multiplier * $prob->countResponses); |
last if ($columncount > 255); |
last if ($columncount > 255); |
|
$lastprob = $prob; |
} |
} |
if ($columncount > 255) { |
if ($columncount > 255) { |
$r->print('<h1>'.&mt('Unable to complete request').'</h1>'.$/. |
$r->print('<h1>'.&mt('Unable to complete request').'</h1>'.$/. |
'<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>'.$/. |
'<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>'.$/. |
'<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>'.$/); |
'<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>'.$/. |
|
'<p>'.&mt('The last problem that will fit in the current spreadsheet is [_1].',&get_title($lastprob->title,$lastprob->src)).'</p>'); |
$r->rflush(); |
$r->rflush(); |
return; |
return; |
} |
} |
Line 236 sub new_excel_output {
|
Line 240 sub new_excel_output {
|
$worksheet->write($header_row,$cols_output,'Correct'); |
$worksheet->write($header_row,$cols_output,'Correct'); |
$cols_output++; |
$cols_output++; |
} |
} |
|
if ($ENV{'form.prob_status'} eq 'true') { |
|
$worksheet->write($header_row,$cols_output++, |
|
'Award Detail'); |
|
$worksheet->write($header_row,$cols_output++,'Attempt'); |
|
$worksheet->write($header_row,$cols_output++,'Time'); |
|
$worksheet->write($header_row,$cols_output++,'Awarded'); |
|
} |
} |
} |
} |
} |
} |
} |
Line 245 sub new_excel_output {
|
Line 256 sub new_excel_output {
|
($r,'Excel File Compilation Status', |
($r,'Excel File Compilation Status', |
'Excel File Compilation Progress', |
'Excel File Compilation Progress', |
scalar(@$Students),'inline',undef,'Statistics','stats_status'); |
scalar(@$Students),'inline',undef,'Statistics','stats_status'); |
|
my $max_row = $rows_output; |
foreach my $student (@$Students) { |
foreach my $student (@$Students) { |
last if ($c->aborted()); |
last if ($c->aborted()); |
$cols_output = 0; |
$cols_output = 0; |
|
my $student_row = $max_row; |
foreach my $field (@StudentColumns) { |
foreach my $field (@StudentColumns) { |
$worksheet->write($rows_output,$cols_output++, |
$worksheet->write($student_row,$cols_output++, |
$student->{$field}); |
$student->{$field}); |
} |
} |
|
my $last_student_col = $cols_output-1; |
|
my $response_count; |
foreach my $prob (@$Problems) { |
foreach my $prob (@$Problems) { |
foreach my $partid (@{$prob->parts}) { |
foreach my $partid (@{$prob->parts}) { |
my @Response = $prob->responseIds($partid); |
my @Response = $prob->responseIds($partid); |
my @ResponseType = $prob->responseType($partid); |
my @ResponseType = $prob->responseType($partid); |
for (my $i=0;$i<=$#Response;$i++) { |
for (my $i=0;$i<=$#Response;$i++) { |
|
my $response_start_col = $last_student_col + |
|
$response_count * $response_multiplier + 1; |
|
$response_count++; |
my $respid = $Response[$i]; |
my $respid = $Response[$i]; |
my $resptype = $ResponseType[$i]; |
my $resptype = $ResponseType[$i]; |
my $results = |
my $results = |
&Apache::loncoursedata::get_response_data_by_student |
&Apache::loncoursedata::get_response_data_by_student |
($student,$prob->symb(),$respid); |
($student,$prob->symb(),$respid); |
my $final_response = $results->[-1]; |
if (! defined($results)) { |
my $submission = |
$results = []; |
$final_response->[ |
} |
&Apache::loncoursedata::RDs_submission() |
# |
]; |
$rows_output = $student_row; |
$submission=&excel_format_response($submission,$resptype); |
# |
$worksheet->write($rows_output,$cols_output++, |
for (my $j=scalar(@$results)-1;$j>=0;$j--) { |
$submission); |
$cols_output = $response_start_col; |
if ($ENV{'form.correctans'} eq 'true') { |
my $response = $results->[$j]; |
my $correct = |
if ($ENV{'form.all_sub'} ne 'true') { |
&Apache::lonstathelpers::analyze_problem_as_student |
next if ($j ne scalar(@$results)-1); |
($prob,$student->{'username'},$student->{'domain'}, |
} |
$partid,$respid); |
my $cols_output = &write_excel_row |
$correct =&excel_format_response($correct,$resptype); |
($worksheet, |
$worksheet->write($rows_output,$cols_output++, |
$rows_output++,$cols_output, |
$correct); |
$response,$student, |
|
$prob,$partid,$respid, |
|
$format,$resptype); |
|
if ($rows_output > $max_row) { |
|
$max_row = $rows_output; |
|
} |
} |
} |
} |
} |
} |
} |
Line 303 sub new_excel_output {
|
Line 326 sub new_excel_output {
|
return; |
return; |
} |
} |
|
|
|
sub write_excel_row { |
|
my ($worksheet,$row,$col,$response,$student,$prob,$partid,$respid, |
|
$format,$resptype) = @_; |
|
# |
|
my $submission =$response->[&Apache::loncoursedata::RDs_submission()]; |
|
$submission = &excel_format_response($submission,$resptype); |
|
$worksheet->write($row,$col++,$submission); |
|
if ($ENV{'form.correctans'} eq 'true') { |
|
my $correct = &Apache::lonstathelpers::analyze_problem_as_student |
|
($prob,$student->{'username'},$student->{'domain'}, |
|
$partid,$respid); |
|
$correct =&excel_format_response($correct,$resptype); |
|
$worksheet->write($row,$col++,$correct); |
|
} |
|
if ($ENV{'form.prob_status'} eq 'true') { |
|
$worksheet->write |
|
($row,$col++, |
|
$response->[&Apache::loncoursedata::RDs_awarddetail()]); |
|
$worksheet->write |
|
($row,$col++,$response->[&Apache::loncoursedata::RDs_tries()]); |
|
$worksheet->write |
|
($row,$col++, |
|
&Apache::lonstathelpers::calc_serial |
|
($response->[&Apache::loncoursedata::RDs_timestamp()]), |
|
$format->{'date'}); |
|
$worksheet->write |
|
($row,$col++,$response->[&Apache::loncoursedata::RDs_awarded()]); |
|
} |
|
return $col; |
|
} |
|
|
sub get_title { |
sub get_title { |
my ($title,$src) = @_; |
my ($title,$src) = @_; |
if ($title eq '') { |
if ($title eq '') { |
Line 870 sub prepare_excel_output {
|
Line 924 sub prepare_excel_output {
|
$r->rflush(); |
$r->rflush(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my @ColumnLabels; |
my @ColumnLabels; |
my @Columns = @DefaultColumns; |
my @Columns = @DefaultColumns; |
my %seen; |
my %seen; |
Line 1101 sub CreateInterface {
|
Line 1147 sub CreateInterface {
|
} |
} |
$all_sub_checkbox.= 'value="true" />'; |
$all_sub_checkbox.= 'value="true" />'; |
# |
# |
# Concise view checkbox |
# problem status checkbox |
my $concise_view_checkbox = '<input type="checkbox" name="concise" '; |
my $prob_status_checkbox = '<input type="checkbox" name="prob_status" '; |
if (exists($ENV{'form.concise'}) && $ENV{'form.concise'} eq 'true') { |
if (exists($ENV{'form.prob_status'}) && |
$concise_view_checkbox .= 'checked '; |
$ENV{'form.prob_status'} eq 'true') { |
|
$prob_status_checkbox .= 'checked '; |
} |
} |
$concise_view_checkbox .= 'value="true" />'; |
$prob_status_checkbox .= 'value="true" />'; |
# |
# |
$Str .= '<td align="right" halign="top">'. |
$Str .= '<td align="right" halign="top">'. |
# '<b>'.&mt('Output Format: [_1]',$output_selector).'</b><br />'.$/. |
|
'<label><b>'. |
'<label><b>'. |
&mt('show problem [_1]',$prob_checkbox).'</b></label><br />'. |
&mt('Show problem [_1]',$prob_checkbox).'</b></label><br />'. |
|
'<label><b>'. |
|
&mt('Show correct answers [_1]',$ans_checkbox).'</b></label><br />'. |
|
'<label><b>'. |
|
&mt('Show all submissions [_1]',$all_sub_checkbox). |
|
'</b></label><br />'. |
'<label><b>'. |
'<label><b>'. |
&mt('compute correct answers [_1]',$ans_checkbox).'</b></label><br />'. |
&mt('Show problem grading [_1]',$prob_status_checkbox). |
# '<label><b>'. |
'</b></label><br />'. |
# &mt('All submission [_1]',$all_sub_checkbox).'</b></label><br />'. |
|
# '<label><b>'. |
|
# &mt('concise view [_1]',$concise_view_checkbox).'</b></label><br />'. |
|
'</td>'; |
'</td>'; |
# |
# |
$Str .= '</tr>'."\n"; |
$Str .= '</tr>'."\n"; |