version 1.104, 2004/08/25 21:04:37
|
version 1.108, 2005/01/05 20:01:46
|
Line 357 sub CreateInterface {
|
Line 357 sub CreateInterface {
|
$Str .= '<input type="submit" name="ClearCache" value="'. |
$Str .= '<input type="submit" name="ClearCache" value="'. |
&mt('Clear Caches').'" />'; |
&mt('Clear Caches').'" />'; |
$Str .= ' 'x5; |
$Str .= ' 'x5; |
|
$Str .= |
|
&mt('Status [_1]', |
|
'<input type="text" name="stats_status" size="60" value="" />'); |
$Str .= '<br />'; |
$Str .= '<br />'; |
return $Str; |
return $Str; |
} |
} |
Line 776 sub html_outputstudent {
|
Line 779 sub html_outputstudent {
|
} |
} |
if (! defined($score)) { |
if (! defined($score)) { |
$score = ' ' x $total_sum_width; |
$score = ' ' x $total_sum_width; |
|
} else { |
|
$score = sprintf("%.0f",$score); |
} |
} |
$Str .= ' '.' 'x($total_sum_width-length($score)).$score.' / '.$max; |
$Str .= ' '.' 'x($total_sum_width-length($score)).$score.' / '.$max; |
$Str .= " \n"; |
$Str .= " \n"; |
Line 803 sub html_finish {
|
Line 808 sub html_finish {
|
} |
} |
|
|
sub StudentAverageTotal { |
sub StudentAverageTotal { |
my $Str = "<h3>Summary Tables</h3>\n"; |
my $Str = '<h3>'.&mt('Summary Tables').'</h3>'.$/; |
# my $max_students; |
|
# my $total_ave = 0; |
|
# my $total_max = 0; |
|
$Str .= '<table border=2 cellspacing="1">'."\n"; |
$Str .= '<table border=2 cellspacing="1">'."\n"; |
$Str .= "<tr><th>Title</th><th>Average</th><th>Maximum</th></tr>\n"; |
$Str .= '<tr>'. |
|
'<th>'.&mt('Title').'</th>'. |
|
'<th>'.&mt('Average').'</th>'. |
|
'<th>'.&mt('Maximum').'</th>'. |
|
'</tr>'.$/; |
foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { |
foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { |
my $ave; |
my $ave; |
my $num_students = $Statistics->{$seq->{'symb'}}->{'num_students'}; |
my $num_students = $Statistics->{$seq->{'symb'}}->{'num_students'}; |
# if ($num_students > $max_students) { |
|
# $max_students = $num_students; |
|
# } |
|
if ($num_students > 0) { |
if ($num_students > 0) { |
$ave = int(100* |
$ave = int(100* |
($Statistics->{$seq->{'symb'}}->{'score'}/$num_students) |
($Statistics->{$seq->{'symb'}}->{'score'}/$num_students) |
Line 822 sub StudentAverageTotal {
|
Line 825 sub StudentAverageTotal {
|
} else { |
} else { |
$ave = 0; |
$ave = 0; |
} |
} |
# $total_ave += $ave; |
|
my $max = $Statistics->{$seq->{'symb'}}->{'max'}; |
my $max = $Statistics->{$seq->{'symb'}}->{'max'}; |
# $total_max += $max; |
|
$ave = sprintf("%.2f",$ave); |
$ave = sprintf("%.2f",$ave); |
$Str .= '<tr><td>'.$seq->{'title'}.'</td>'. |
$Str .= '<tr><td>'.$seq->{'title'}.'</td>'. |
'<td align="right">'.$ave.' </td>'. |
'<td align="right">'.$ave.' </td>'. |
'<td align="right">'.$max.' '.'</td></tr>'."\n"; |
'<td align="right">'.$max.' '.'</td></tr>'."\n"; |
} |
} |
# $total_ave = sprintf('%.2f',$total_ave); # only two digit |
|
$Str .= "</table>\n"; |
$Str .= "</table>\n"; |
# $Str .= '<table border=2 cellspacing="1">'."\n"; |
|
# $Str .= '<tr><th>Number of Students</th><th>Average</th>'. |
|
# "<th>Maximum</th></tr>\n"; |
|
# $Str .= '<tr>'. |
|
# '<td align="right">'.$max_students.'</td>'. |
|
# '<td align="right">'.$total_ave.' '.'</td>'. |
|
# '<td align="right">'.$total_max.' '.'</td>'; |
|
# $Str .= "</table>\n"; |
|
return $Str; |
return $Str; |
} |
} |
|
|
sub SingleStudentTotal { |
sub SingleStudentTotal { |
my $student = &Apache::lonstatistics::current_student(); |
my $student = &Apache::lonstatistics::current_student(); |
my $Str = "<h3>Summary table for ".$student->{'fullname'}." ". |
my $Str = '<h3>'.&mt('Summary table for [_1] ([_2]@[_3])', |
$student->{'username'}.'@'.$student->{'domain'}."</h3>\n"; |
$student->{'fullname'}, |
|
$student->{'username'},$student->{'domain'}).'</h3>'; |
|
$Str .= $/; |
$Str .= '<table border=2 cellspacing="1">'."\n"; |
$Str .= '<table border=2 cellspacing="1">'."\n"; |
$Str .= |
$Str .= |
"<tr><th>Sequence or Folder</th><th>Score</th><th>Maximum</th></tr>\n"; |
'<tr>'. |
|
'<th>'.&mt('Sequence or Folder').'</th>'; |
|
if ($chosen_output->{'base'} eq 'tries') { |
|
$Str .= '<th>'.&mt('Parts Correct').'</th>'; |
|
} else { |
|
$Str .= '<th>'.&mt('Score').'</th>'; |
|
} |
|
$Str .= '<th>'.&mt('Maximum').'</th>'."</tr>\n"; |
my $total = 0; |
my $total = 0; |
my $total_max = 0; |
my $total_max = 0; |
foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { |
foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { |
Line 861 sub SingleStudentTotal {
|
Line 862 sub SingleStudentTotal {
|
$total += $value; |
$total += $value; |
$total_max +=$max; |
$total_max +=$max; |
} |
} |
$Str .= '<tr><td><b>Total</b></td>'. |
$Str .= '<tr><td><b>'.&mt('Total').'</b></td>'. |
'<td align="right">'.$total.'</td>'. |
'<td align="right">'.$total.'</td>'. |
'<td align="right">'.$total_max."</td></tr>\n"; |
'<td align="right">'.$total_max."</td></tr>\n"; |
$Str .= "</table>\n"; |
$Str .= "</table>\n"; |
Line 925 sub excel_initialize {
|
Line 926 sub excel_initialize {
|
# Add 2 because we need a 'sequence_sum' and 'total' column for each |
# Add 2 because we need a 'sequence_sum' and 'total' column for each |
$total_columns += 2; |
$total_columns += 2; |
} |
} |
|
my $too_many_cols_error_message = |
|
'<h2>'.&mt('Unable to Complete Request').'</h2>'.$/. |
|
'<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('You may consider reducing the number of <b>Sequences or Folders</b> you have selected.').'</p>'.$/. |
|
'<p>'.&mt('LON-CAPA can produce <b>CSV</b> files of this data or Excel files of the <b>Scores Summary</b> data.').'</p>'.$/; |
if ($chosen_output->{'base'} eq 'tries' && $total_columns > 255) { |
if ($chosen_output->{'base'} eq 'tries' && $total_columns > 255) { |
$r->print(<<END); |
$r->print($too_many_cols_error_message); |
<h2>Unable to Complete Request</h2> |
$request_aborted = 1; |
<p> |
|
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> |
|
You may consider reducing the number of <b>Sequences or Folders</b> you |
|
have selected. |
|
</p><p> |
|
LON-CAPA can produce <b>CSV</b> files of this data or Excel files of the |
|
summary data (<b>Parts Correct</b> or <b>Parts Correct & Totals</b>). |
|
</p> |
|
END |
|
$request_aborted = 1; |
|
} |
} |
if ($chosen_output->{'base'} eq 'scores' && $total_columns > 255) { |
if ($chosen_output->{'base'} eq 'scores' && $total_columns > 255) { |
$r->print(<<END); |
$r->print($too_many_cols_error_message); |
<h2>Unable to Complete Request</h2> |
$request_aborted = 1; |
<p> |
|
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> |
|
You may consider reducing the number of <b>Sequences or Folders</b> you |
|
have selected. |
|
</p><p> |
|
LON-CAPA can produce <b>CSV</b> files of this data or Excel files of the |
|
<b>Scores Summary</b> data. |
|
</p> |
|
END |
|
$request_aborted = 1; |
|
} |
} |
return if ($request_aborted); |
return if ($request_aborted); |
# |
# |
Line 1087 END
|
Line 1067 END
|
$cols_output++, |
$cols_output++, |
$res->{'title'}.' part '.$part, |
$res->{'title'}.' part '.$part, |
$format->{'bold'}); |
$format->{'bold'}); |
|
$count++; |
} |
} |
} else { |
} else { |
$excel_sheet->write($resource_name_row, |
$excel_sheet->write($resource_name_row, |
$cols_output++, |
$cols_output++, |
$res->{'title'},$format->{'bold'}); |
$res->{'title'},$format->{'bold'}); |
|
$count++; |
} |
} |
$count++; |
|
} |
} |
} |
} |
# Determine ending cell |
# Determine ending cell |
Line 1241 END
|
Line 1222 END
|
if ($chosen_output->{'grand_maximum'}) { |
if ($chosen_output->{'grand_maximum'}) { |
$excel_sheet->repeat_formula($maximum_data_row,$cols_output++, |
$excel_sheet->repeat_formula($maximum_data_row,$cols_output++, |
$maximum_formula,undef, |
$maximum_formula,undef, |
%total_cell_translation); |
%maximum_cell_translation); |
} |
} |
} # End of MAXIMUM row output if ($chosen_output->{'maximum_row'}) { |
} # End of MAXIMUM row output if ($chosen_output->{'maximum_row'}) { |
$rows_output = $first_data_row; |
$rows_output = $first_data_row; |
Line 1313 END
|
Line 1294 END
|
# Initialize progress window |
# Initialize progress window |
%prog_state=&Apache::lonhtmlcommon::Create_PrgWin |
%prog_state=&Apache::lonhtmlcommon::Create_PrgWin |
($r,'Excel File Compilation Status', |
($r,'Excel File Compilation Status', |
'Excel File Compilation Progress', $studentcount); |
'Excel File Compilation Progress', $studentcount, |
|
'inline',undef,'Statistics','stats_status'); |
# |
# |
&Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state, |
&Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state, |
'Processing first student'); |
'Processing first student'); |
Line 1356 sub excel_outputstudent {
|
Line 1338 sub excel_outputstudent {
|
$total_cell_translation{$seq->{'Excel:scorecell'}} = |
$total_cell_translation{$seq->{'Excel:scorecell'}} = |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
($rows_output,$seq->{'Excel:scorecol'}); |
($rows_output,$seq->{'Excel:scorecol'}); |
|
# and maximum cell |
|
$maximum_cell_translation{$seq->{'Excel:maxcell'}} = |
|
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
|
($rows_output,$seq->{'Excel:maxcol'}); |
# |
# |
my ($performance,$performance_length,$score,$seq_max,$rawdata); |
my ($performance,$performance_length,$score,$seq_max,$rawdata); |
if ($chosen_output->{'tries'} || $chosen_output->{'correct'}){ |
if ($chosen_output->{'tries'} || $chosen_output->{'correct'}){ |
Line 1426 sub excel_outputstudent {
|
Line 1412 sub excel_outputstudent {
|
if ($chosen_output->{'grand_maximum'}) { |
if ($chosen_output->{'grand_maximum'}) { |
$excel_sheet->repeat_formula($rows_output,$cols_output++, |
$excel_sheet->repeat_formula($rows_output,$cols_output++, |
$maximum_formula,undef, |
$maximum_formula,undef, |
%total_cell_translation); |
%maximum_cell_translation); |
} |
} |
# |
# |
# Bookkeeping |
# Bookkeeping |
Line 1510 END
|
Line 1496 END
|
my $studentcount = scalar(@Apache::lonstatistics::Students); |
my $studentcount = scalar(@Apache::lonstatistics::Students); |
%prog_state=&Apache::lonhtmlcommon::Create_PrgWin |
%prog_state=&Apache::lonhtmlcommon::Create_PrgWin |
($r,'CSV File Compilation Status', |
($r,'CSV File Compilation Status', |
'CSV File Compilation Progress', $studentcount); |
'CSV File Compilation Progress', $studentcount, |
|
'inline',undef,'Statistics','stats_status'); |
# |
# |
# Open a file |
# Open a file |
$filename = '/prtspool/'. |
$filename = '/prtspool/'. |