version 1.120, 2005/03/21 19:47:54
|
version 1.132, 2006/03/05 02:00:01
|
Line 56 use Apache::loncommon();
|
Line 56 use Apache::loncommon();
|
use Apache::loncoursedata; |
use Apache::loncoursedata; |
use Apache::lonnet; # for logging porpoises |
use Apache::lonnet; # for logging porpoises |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use Apache::grades; |
use Time::HiRes; |
use Time::HiRes; |
use Spreadsheet::WriteExcel; |
use Spreadsheet::WriteExcel; |
use Spreadsheet::WriteExcel::Utility(); |
use Spreadsheet::WriteExcel::Utility(); |
Line 153 sub BuildStudentAssessmentPage {
|
Line 154 sub BuildStudentAssessmentPage {
|
&Apache::lonstatistics::PrepareClasslist(); |
&Apache::lonstatistics::PrepareClasslist(); |
# |
# |
$single_student_mode = 0; |
$single_student_mode = 0; |
$single_student_mode = 1 if ($ENV{'form.SelectedStudent'}); |
$single_student_mode = 1 if ($env{'form.SelectedStudent'}); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['selectstudent']); |
['selectstudent']); |
if ($ENV{'form.selectstudent'}) { |
if ($env{'form.selectstudent'}) { |
&Apache::lonstatistics::DisplayClasslist($r); |
&Apache::lonstatistics::DisplayClasslist($r); |
return; |
return; |
} |
} |
Line 167 sub BuildStudentAssessmentPage {
|
Line 168 sub BuildStudentAssessmentPage {
|
$r->print(&CreateInterface()); |
$r->print(&CreateInterface()); |
$r->print('<input type="hidden" name="notfirstrun" value="true" />'); |
$r->print('<input type="hidden" name="notfirstrun" value="true" />'); |
$r->print('<input type="hidden" name="sort" value="'. |
$r->print('<input type="hidden" name="sort" value="'. |
$ENV{'form.sort'}.'" />'); |
$env{'form.sort'}.'" />'); |
$r->rflush(); |
$r->rflush(); |
# |
# |
if (! exists($ENV{'form.notfirstrun'}) && ! $single_student_mode) { |
if (! exists($env{'form.notfirstrun'}) && ! $single_student_mode) { |
return; |
return; |
} |
} |
$r->print('<h4>'. |
$r->print('<h4>'. |
Line 234 sub BuildStudentAssessmentPage {
|
Line 235 sub BuildStudentAssessmentPage {
|
sub next_and_previous_buttons { |
sub next_and_previous_buttons { |
my $Str = ''; |
my $Str = ''; |
$Str .= '<input type="hidden" name="SelectedStudent" value="'. |
$Str .= '<input type="hidden" name="SelectedStudent" value="'. |
$ENV{'form.SelectedStudent'}.'" />'; |
$env{'form.SelectedStudent'}.'" />'; |
# |
# |
# Build the previous student link |
# Build the previous student link |
my $previous = &Apache::lonstatistics::previous_student(); |
my $previous = &Apache::lonstatistics::previous_student(); |
Line 430 sub CreateAndParseOutputSelector {
|
Line 431 sub CreateAndParseOutputSelector {
|
[$elementname]); |
[$elementname]); |
# |
# |
# Format for output options is 'mode, restrictions'; |
# Format for output options is 'mode, restrictions'; |
my $selected = 'html, without links'; |
my $selected = (&Apache::loncommon::get_env_multiple('form.'.$elementname))[0]; |
if (exists($ENV{'form.'.$elementname})) { |
$selected = 'html, without links' if (!$selected); |
if (ref($ENV{'form.'.$elementname} eq 'ARRAY')) { |
|
$selected = $ENV{'form.'.$elementname}->[0]; |
|
} else { |
|
$selected = $ENV{'form.'.$elementname}; |
|
} |
|
} |
|
# |
# |
# Set package variables describing output mode |
# Set package variables describing output mode |
$show_links = 'no'; |
$show_links = 'no'; |
Line 477 my @OutputDataOptions =
|
Line 473 my @OutputDataOptions =
|
grand_maximum => 1, |
grand_maximum => 1, |
summary_table => 1, |
summary_table => 1, |
maximum_row => 1, |
maximum_row => 1, |
|
ignore_weight => 0, |
shortdesc => 'Total Score and Maximum Possible for each '. |
shortdesc => 'Total Score and Maximum Possible for each '. |
'Sequence or Folder', |
'Sequence or Folder', |
longdesc => 'The score of each student as well as the '. |
longdesc => 'The score of each student as well as the '. |
Line 495 my @OutputDataOptions =
|
Line 492 my @OutputDataOptions =
|
grand_maximum => 1, |
grand_maximum => 1, |
summary_table => 1, |
summary_table => 1, |
maximum_row => 1, |
maximum_row => 1, |
|
ignore_weight => 0, |
shortdesc => 'Score on each Problem Part', |
shortdesc => 'Score on each Problem Part', |
longdesc =>'The students score on each problem part, computed as'. |
longdesc =>'The students score on each problem part, computed as'. |
'the part weight * part awarded', |
'the part weight * part awarded', |
Line 512 my @OutputDataOptions =
|
Line 510 my @OutputDataOptions =
|
grand_maximum => 0, |
grand_maximum => 0, |
summary_table => 0, |
summary_table => 0, |
maximum_row => 0, |
maximum_row => 0, |
|
ignore_weight => 0, |
shortdesc => 'Number of Tries before success on each Problem Part', |
shortdesc => 'Number of Tries before success on each Problem Part', |
longdesc =>'The number of tries before success on each problem part.', |
longdesc =>'The number of tries before success on each problem part.', |
non_html_notes => 'negative values indicate an incorrect problem', |
non_html_notes => 'negative values indicate an incorrect problem', |
Line 529 my @OutputDataOptions =
|
Line 528 my @OutputDataOptions =
|
grand_maximum => 1, |
grand_maximum => 1, |
summary_table => 1, |
summary_table => 1, |
maximum_row => 0, |
maximum_row => 0, |
|
ignore_weight => 1, |
shortdesc => 'Number of Problem Parts completed successfully.', |
shortdesc => 'Number of Problem Parts completed successfully.', |
longdesc => 'The Number of Problem Parts completed successfully and '. |
longdesc => 'The Number of Problem Parts completed successfully and '. |
'the maximum possible for each student', |
'the maximum possible for each student', |
Line 551 sub CreateAndParseOutputDataSelector {
|
Line 551 sub CreateAndParseOutputDataSelector {
|
my $Str = ''; |
my $Str = ''; |
my $elementname = 'chartoutputdata'; |
my $elementname = 'chartoutputdata'; |
# |
# |
my $selected = 'scores'; |
my $selected = (&Apache::loncommon::get_env_multiple('form.'.$elementname))[0]; |
if (exists($ENV{'form.'.$elementname})) { |
$selected = 'scores' if (!$selected); |
if (ref($ENV{'form.'.$elementname} eq 'ARRAY')) { |
|
$selected = $ENV{'form.'.$elementname}->[0]; |
|
} else { |
|
$selected = $ENV{'form.'.$elementname}; |
|
} |
|
} |
|
# |
# |
$chosen_output = $OutputDataOptions[0]; |
$chosen_output = $OutputDataOptions[0]; |
foreach my $option (@OutputDataOptions) { |
foreach my $option (@OutputDataOptions) { |
Line 632 Return a line of the chart for a student
|
Line 627 Return a line of the chart for a student
|
my @sequences; |
my @sequences; |
my $navmap; # Have to keep this around since weakref is a bit zealous |
my $navmap; # Have to keep this around since weakref is a bit zealous |
|
|
|
sub html_cleanup { |
|
undef(%prog_state); |
|
undef(%width); |
|
# |
|
undef($navmap); |
|
undef(@sequences); |
|
} |
|
|
sub html_initialize { |
sub html_initialize { |
my ($r) = @_; |
my ($r) = @_; |
# |
# |
$padding = ' 'x3; |
$padding = ' 'x3; |
$count = 0; |
$count = 0; |
$nodata_count = 0; |
$nodata_count = 0; |
undef(%prog_state); |
&html_cleanup(); |
undef(%width); |
|
# |
|
undef($navmap); |
|
undef(@sequences); |
|
($navmap,@sequences) = |
($navmap,@sequences) = |
&Apache::lonstatistics::selected_sequences_with_assessments(); |
&Apache::lonstatistics::selected_sequences_with_assessments(); |
if (! ref($navmap)) { |
if (! ref($navmap)) { |
Line 652 sub html_initialize {
|
Line 651 sub html_initialize {
|
'</h3>'); |
'</h3>'); |
} |
} |
# |
# |
$r->print("<h3>".$ENV{'course.'.$ENV{'request.course.id'}.'.description'}. |
$r->print("<h3>".$env{'course.'.$env{'request.course.id'}.'.description'}. |
" ".localtime(time)."</h3>"); |
" ".localtime(time)."</h3>"); |
# |
# |
if ($chosen_output->{'base'} !~ /^final table/) { |
if ($chosen_output->{'base'} !~ /^final table/) { |
Line 720 sub html_initialize {
|
Line 719 sub html_initialize {
|
$Str .= "<pre>"; |
$Str .= "<pre>"; |
$r->print($Str); |
$r->print($Str); |
$r->rflush(); |
$r->rflush(); |
|
|
|
$r->print(<<JS); |
|
<script> |
|
// get the left offset of a given widget as an absolute position |
|
function getLeftOffset (element) { |
|
return collect(element, "offsetLeft"); |
|
} |
|
|
|
// get the top offset of a given widget as an absolute position |
|
function getTopOffset (element) { |
|
return collect(element, "offsetTop"); |
|
} |
|
|
|
function collect(element, att) { |
|
var val = 0; |
|
while(element) { |
|
val += element[att]; |
|
element = element.offsetParent; |
|
} |
|
return val; |
|
} |
|
|
|
var currentDiv; |
|
var oldBorder; |
|
var currentElement; |
|
function popup_score(element, score) { |
|
popdown_score(); |
|
var left = getLeftOffset(element); |
|
var top = getTopOffset(element); |
|
var div = document.createElement("div"); |
|
div.style.border = "1px solid #8888FF"; |
|
div.style.backgroundColor = "#CCCCFF"; |
|
div.appendChild(document.createTextNode(score)); |
|
div.style.position = "absolute"; |
|
div.style.top = (top - 25) + "px"; |
|
div.style.left = (left - 10) + "px"; |
|
currentDiv = div; |
|
document.body.insertBefore(div, document.body.children[0]); |
|
oldBorder = element.style.border; |
|
element.style.border = "1px solid yellow"; |
|
currentElement = element; |
|
} |
|
|
|
function popdown_score() { |
|
if (currentDiv) { |
|
document.body.removeChild(currentDiv); |
|
} |
|
if (currentElement) { |
|
currentElement.style.border = oldBorder; |
|
} |
|
currentDiv = undefined; |
|
} |
|
</script> |
|
JS |
|
|
|
# |
|
# Let the user know what we are doing |
|
my $studentcount = scalar(@Apache::lonstatistics::Students); |
|
if ($env{'form.SelectedStudent'}) { |
|
$studentcount = '1'; |
|
} |
|
# |
|
# Initialize progress window |
|
%prog_state=&Apache::lonhtmlcommon::Create_PrgWin |
|
($r,'HTML Chart Status', |
|
'HTML Chart Progress', $studentcount, |
|
'inline',undef,'Statistics','stats_status'); |
|
# |
|
&Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state, |
|
'Processing first student'); |
return; |
return; |
} |
} |
|
|
Line 747 sub html_outputstudent {
|
Line 816 sub html_outputstudent {
|
my %StudentsData; |
my %StudentsData; |
my @tmp = &Apache::loncoursedata::get_current_state |
my @tmp = &Apache::loncoursedata::get_current_state |
($student->{'username'},$student->{'domain'},undef, |
($student->{'username'},$student->{'domain'},undef, |
$ENV{'request.course.id'}); |
$env{'request.course.id'}); |
if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:/)) { |
if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:/)) { |
%StudentsData = @tmp; |
%StudentsData = @tmp; |
} |
} |
Line 772 sub html_outputstudent {
|
Line 841 sub html_outputstudent {
|
} else { |
} else { |
($performance,$performance_length,$score,$seq_max,$rawdata) = |
($performance,$performance_length,$score,$seq_max,$rawdata) = |
&student_performance_on_sequence($student,\%StudentsData, |
&student_performance_on_sequence($student,\%StudentsData, |
$navmap,$seq,$show_links); |
$navmap,$seq,$show_links, |
|
$chosen_output->{ignore_weight}); |
} |
} |
my $ratio=''; |
my $ratio=''; |
if ($chosen_output->{'every_problem'} && |
if ($chosen_output->{'every_problem'} && |
Line 832 sub html_outputstudent {
|
Line 902 sub html_outputstudent {
|
$r->print($Str); |
$r->print($Str); |
# |
# |
$r->rflush(); |
$r->rflush(); |
|
&Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,'last student'); |
return; |
return; |
} |
} |
|
|
Line 849 sub html_finish {
|
Line 920 sub html_finish {
|
} |
} |
} |
} |
$r->rflush(); |
$r->rflush(); |
undef($navmap); |
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); |
|
&html_cleanup(); |
return; |
return; |
} |
} |
|
|
Line 956 my %formula_data;
|
Line 1028 my %formula_data;
|
my $navmap; |
my $navmap; |
my @sequences; |
my @sequences; |
|
|
sub excel_initialize { |
sub excel_cleanup { |
my ($r) = @_; |
|
# |
# |
undef ($excel_sheet); |
undef ($excel_sheet); |
undef ($excel_workbook); |
undef ($excel_workbook); |
Line 973 sub excel_initialize {
|
Line 1044 sub excel_initialize {
|
# |
# |
undef($navmap); |
undef($navmap); |
undef(@sequences); |
undef(@sequences); |
|
} |
|
|
|
sub excel_initialize { |
|
my ($r) = @_; |
|
|
|
&excel_cleanup(); |
($navmap,@sequences) = |
($navmap,@sequences) = |
&Apache::lonstatistics::selected_sequences_with_assessments(); |
&Apache::lonstatistics::selected_sequences_with_assessments(); |
if (! ref($navmap)) { |
if (! ref($navmap)) { |
Line 1039 sub excel_initialize {
|
Line 1116 sub excel_initialize {
|
return if (! defined($excel_workbook)); |
return if (! defined($excel_workbook)); |
# |
# |
# Add a worksheet |
# Add a worksheet |
my $sheetname = $ENV{'course.'.$ENV{'request.course.id'}.'.description'}; |
my $sheetname = $env{'course.'.$env{'request.course.id'}.'.description'}; |
$sheetname = &Apache::loncommon::clean_excel_name($sheetname); |
$sheetname = &Apache::loncommon::clean_excel_name($sheetname); |
$excel_sheet = $excel_workbook->addworksheet($sheetname); |
$excel_sheet = $excel_workbook->addworksheet($sheetname); |
# |
# |
# Put the course description in the header |
# Put the course description in the header |
$excel_sheet->write($header_row,$cols_output++, |
$excel_sheet->write($header_row,$cols_output++, |
$ENV{'course.'.$ENV{'request.course.id'}.'.description'}, |
$env{'course.'.$env{'request.course.id'}.'.description'}, |
$format->{'h1'}); |
$format->{'h1'}); |
$cols_output += 3; |
$cols_output += 3; |
# |
# |
Line 1053 sub excel_initialize {
|
Line 1130 sub excel_initialize {
|
my $sectionstring = ''; |
my $sectionstring = ''; |
my @Sections = &Apache::lonstatistics::get_selected_sections(); |
my @Sections = &Apache::lonstatistics::get_selected_sections(); |
$excel_sheet->write($header_row,$cols_output++, |
$excel_sheet->write($header_row,$cols_output++, |
&Apache::lonstatistics::section_and_enrollment_description('plain text'), |
&Apache::lonstatistics::section_and_enrollment_description('plaintext'), |
$format->{'h3'}); |
$format->{'h3'}); |
# |
# |
# Put the date in there too |
# Put the date in there too |
Line 1128 sub excel_initialize {
|
Line 1205 sub excel_initialize {
|
! defined($formula_data{$symb}->{'Excel:endcell'})) { |
! defined($formula_data{$symb}->{'Excel:endcell'})) { |
$formula_data{$symb}->{'Excel:endcell'} = $formula_data{$symb}->{'Excel:startcell'}; |
$formula_data{$symb}->{'Excel:endcell'} = $formula_data{$symb}->{'Excel:startcell'}; |
} |
} |
|
|
|
my $start = $formula_data{$symb}->{'Excel:startcell'}; |
|
my $end = $formula_data{$symb}->{'Excel:endcell'}; |
$formula_data{$symb}->{'Excel:sum'}= $excel_sheet->store_formula |
$formula_data{$symb}->{'Excel:sum'}= $excel_sheet->store_formula |
('=SUM('.$formula_data{$symb}->{'Excel:startcell'}. |
("=IF(COUNT($start\:$end),SUM($start\:$end),\"\")"); |
':'.$formula_data{$symb}->{'Excel:endcell'}.')'); |
|
# Determine cell the score is held in |
# Determine cell the score is held in |
$formula_data{$symb}->{'Excel:scorecell'} = |
$formula_data{$symb}->{'Excel:scorecell'} = |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
Line 1215 sub excel_initialize {
|
Line 1294 sub excel_initialize {
|
$weight = 1; |
$weight = 1; |
if ($chosen_output->{'scores'}) { |
if ($chosen_output->{'scores'}) { |
$weight = &Apache::lonnet::EXT |
$weight = &Apache::lonnet::EXT |
('resource.'.$part.'.weight',$resource->{'symb'}, |
('resource.'.$part.'.weight',$resource->symb, |
undef,undef,undef); |
undef,undef,undef); |
if (!defined($weight) || ($weight eq '')) { |
if (!defined($weight) || ($weight eq '')) { |
$weight=1; |
$weight=1; |
Line 1239 sub excel_initialize {
|
Line 1318 sub excel_initialize {
|
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($maximum_data_row,$formula_data{$symb}->{'Excel:endcol'})); |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($maximum_data_row,$formula_data{$symb}->{'Excel:endcol'})); |
$excel_sheet->repeat_formula($maximum_data_row,$cols_output++, |
$excel_sheet->repeat_formula($maximum_data_row,$cols_output++, |
$formula_data{$symb}->{'Excel:sum'},undef, |
$formula_data{$symb}->{'Excel:sum'},undef, |
%replaceCells); |
%replaceCells, %replaceCells); |
|
|
} elsif ($chosen_output->{'sequence_sum'}) { |
} elsif ($chosen_output->{'sequence_sum'}) { |
$excel_sheet->write($maximum_data_row,$cols_output++,$max); |
$excel_sheet->write($maximum_data_row,$cols_output++,$max); |
Line 1314 sub excel_initialize {
|
Line 1393 sub excel_initialize {
|
# |
# |
# Let the user know what we are doing |
# Let the user know what we are doing |
my $studentcount = scalar(@Apache::lonstatistics::Students); |
my $studentcount = scalar(@Apache::lonstatistics::Students); |
if ($ENV{'form.SelectedStudent'}) { |
if ($env{'form.SelectedStudent'}) { |
$studentcount = '1'; |
$studentcount = '1'; |
} |
} |
if ($studentcount > 1) { |
if ($studentcount > 1) { |
Line 1361 sub excel_outputstudent {
|
Line 1440 sub excel_outputstudent {
|
my @tmp = &Apache::loncoursedata::get_current_state($student->{'username'}, |
my @tmp = &Apache::loncoursedata::get_current_state($student->{'username'}, |
$student->{'domain'}, |
$student->{'domain'}, |
undef, |
undef, |
$ENV{'request.course.id'}); |
$env{'request.course.id'}); |
if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:/)) { |
if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:/)) { |
%StudentsData = @tmp; |
%StudentsData = @tmp; |
} |
} |
Line 1389 sub excel_outputstudent {
|
Line 1468 sub excel_outputstudent {
|
} else { |
} else { |
($performance,$performance_length,$score,$seq_max,$rawdata) = |
($performance,$performance_length,$score,$seq_max,$rawdata) = |
&student_performance_on_sequence($student,\%StudentsData, |
&student_performance_on_sequence($student,\%StudentsData, |
$navmap,$seq,'no'); |
$navmap,$seq,'no', |
|
$chosen_output->{ignore_weight}); |
} |
} |
if ($chosen_output->{'every_problem'}) { |
if ($chosen_output->{'every_problem'}) { |
if ($chosen_output->{'correct'}) { |
if ($chosen_output->{'correct'}) { |
# only indiciate if each item is correct or not |
# only indiciate if each item is correct or not |
foreach my $value (@$rawdata) { |
foreach my $value (@$rawdata) { |
# nonzero means correct |
# positive means correct, 0 or negative means |
$value = 1 if ($value > 0); |
# incorrect |
|
$value = $value > 0 ? 1 : 0; |
$excel_sheet->write($rows_output,$cols_output++,$value); |
$excel_sheet->write($rows_output,$cols_output++,$value); |
} |
} |
} else { |
} else { |
Line 1422 sub excel_outputstudent {
|
Line 1503 sub excel_outputstudent {
|
# The undef is for the format |
# The undef is for the format |
$excel_sheet->repeat_formula($rows_output,$cols_output++, |
$excel_sheet->repeat_formula($rows_output,$cols_output++, |
$formula_data{$symb}->{'Excel:sum'},undef, |
$formula_data{$symb}->{'Excel:sum'},undef, |
%replaceCells); |
%replaceCells, %replaceCells); |
} elsif ($chosen_output->{'sequence_sum'}) { |
} elsif ($chosen_output->{'sequence_sum'}) { |
if ($score eq ' ') { |
if ($score eq ' ') { |
$cols_output++; |
$cols_output++; |
Line 1458 sub excel_outputstudent {
|
Line 1539 sub excel_outputstudent {
|
sub excel_finish { |
sub excel_finish { |
my ($r) = @_; |
my ($r) = @_; |
if ($request_aborted || ! defined($navmap) || ! defined($excel_sheet)) { |
if ($request_aborted || ! defined($navmap) || ! defined($excel_sheet)) { |
|
&excel_cleanup(); |
return; |
return; |
} |
} |
# |
# |
# Write the excel file |
# Write the excel file |
$excel_workbook->close(); |
$excel_workbook->close(); |
my $c = $r->connection(); |
|
# |
|
return if($c->aborted()); |
|
# |
# |
# Close the progress window |
# Close the progress window |
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); |
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); |
Line 1474 sub excel_finish {
|
Line 1553 sub excel_finish {
|
$r->print('<br />'. |
$r->print('<br />'. |
'<a href="'.$filename.'">Your Excel spreadsheet.</a>'."\n"); |
'<a href="'.$filename.'">Your Excel spreadsheet.</a>'."\n"); |
$r->rflush(); |
$r->rflush(); |
|
&excel_cleanup(); |
return; |
return; |
} |
} |
|
|
Line 1504 my %prog_state; # progress window state
|
Line 1584 my %prog_state; # progress window state
|
my $navmap; |
my $navmap; |
my @sequences; |
my @sequences; |
|
|
sub csv_initialize{ |
sub csv_cleanup { |
my ($r) = @_; |
|
# |
|
# Clean up |
|
undef($outputfile); |
undef($outputfile); |
undef($filename); |
undef($filename); |
undef($request_aborted); |
undef($request_aborted); |
Line 1515 sub csv_initialize{
|
Line 1592 sub csv_initialize{
|
# |
# |
undef($navmap); |
undef($navmap); |
undef(@sequences); |
undef(@sequences); |
|
} |
|
|
|
sub csv_initialize{ |
|
my ($r) = @_; |
|
|
|
&csv_cleanup(); |
($navmap,@sequences) = |
($navmap,@sequences) = |
&Apache::lonstatistics::selected_sequences_with_assessments(); |
&Apache::lonstatistics::selected_sequences_with_assessments(); |
if (! ref($navmap)) { |
if (! ref($navmap)) { |
Line 1549 END
|
Line 1632 END
|
if (! defined($outputfile)) { return ''; } |
if (! defined($outputfile)) { return ''; } |
# |
# |
# Datestamp |
# Datestamp |
my $description = $ENV{'course.'.$ENV{'request.course.id'}.'.description'}; |
my $description = $env{'course.'.$env{'request.course.id'}.'.description'}; |
print $outputfile '"'.&Apache::loncommon::csv_translate($description).'",'. |
print $outputfile '"'.&Apache::loncommon::csv_translate($description).'",'. |
'"'.&Apache::loncommon::csv_translate(scalar(localtime(time))).'"'. |
'"'.&Apache::loncommon::csv_translate(scalar(localtime(time))).'"'. |
"\n"; |
"\n"; |
Line 1639 sub csv_outputstudent {
|
Line 1722 sub csv_outputstudent {
|
my @tmp = &Apache::loncoursedata::get_current_state($student->{'username'}, |
my @tmp = &Apache::loncoursedata::get_current_state($student->{'username'}, |
$student->{'domain'}, |
$student->{'domain'}, |
undef, |
undef, |
$ENV{'request.course.id'}); |
$env{'request.course.id'}); |
if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:/)) { |
if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:/)) { |
%StudentsData = @tmp; |
%StudentsData = @tmp; |
} |
} |
Line 1656 sub csv_outputstudent {
|
Line 1739 sub csv_outputstudent {
|
} else { |
} else { |
($performance,$performance_length,$score,$seq_max,$rawdata) = |
($performance,$performance_length,$score,$seq_max,$rawdata) = |
&student_performance_on_sequence($student,\%StudentsData, |
&student_performance_on_sequence($student,\%StudentsData, |
$navmap,$seq,'no'); |
$navmap,$seq,'no', |
|
$chosen_output->{ignore_weight}); |
} |
} |
if ($chosen_output->{'every_problem'}) { |
if ($chosen_output->{'every_problem'}) { |
if ($chosen_output->{'correct'}) { |
if ($chosen_output->{'correct'}) { |
Line 1700 sub csv_outputstudent {
|
Line 1784 sub csv_outputstudent {
|
sub csv_finish { |
sub csv_finish { |
my ($r) = @_; |
my ($r) = @_; |
if ($request_aborted || ! defined($navmap) || ! defined($outputfile)) { |
if ($request_aborted || ! defined($navmap) || ! defined($outputfile)) { |
|
&csv_cleanup(); |
return; |
return; |
} |
} |
close($outputfile); |
close($outputfile); |
# |
# |
my $c = $r->connection(); |
|
return if ($c->aborted()); |
|
# |
|
# Close the progress window |
# Close the progress window |
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); |
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); |
# |
# |
Line 1714 sub csv_finish {
|
Line 1796 sub csv_finish {
|
$r->print('<br />'. |
$r->print('<br />'. |
'<a href="'.$filename.'">'.&mt('Your csv file.').'</a>'."\n"); |
'<a href="'.$filename.'">'.&mt('Your csv file.').'</a>'."\n"); |
$r->rflush(); |
$r->rflush(); |
|
&csv_cleanup(); |
return; |
return; |
|
|
} |
} |
|
|
} |
} |
|
|
|
# This function will return an HTML string including a star, with |
|
# a mouseover popup showing the "real" value. An optional second |
|
# argument lets you show something other than a star. |
|
sub show_star { |
|
my $popup = shift; |
|
my $symbol = shift || '*'; |
|
# Escape the popup for JS. |
|
$popup =~ s/([^-a-zA-Z0-9:;,._ ()|!\/?=&*])/'\\' . sprintf("%lo", ord($1))/ge; |
|
|
|
return "<span onmouseover='popup_score(this, \"$popup\");return false;' onmouseout='popdown_score();return false;' style='border: 1px solid #339933; margin: -1px;'>$symbol</span>"; |
|
} |
|
|
####################################################### |
####################################################### |
####################################################### |
####################################################### |
|
|
Line 1790 sub student_tries_on_sequence {
|
Line 1885 sub student_tries_on_sequence {
|
$sum++; |
$sum++; |
} elsif ($tries > 0) { |
} elsif ($tries > 0) { |
if ($tries > 9) { |
if ($tries > 9) { |
$symbol = '*'; |
$symbol = show_star($tries); |
} else { |
} else { |
$symbol = $tries; |
$symbol = $tries; |
} |
} |
Line 1807 sub student_tries_on_sequence {
|
Line 1902 sub student_tries_on_sequence {
|
} elsif ($status eq 'incorrect_by_override') { |
} elsif ($status eq 'incorrect_by_override') { |
$symbol = '-'; |
$symbol = '-'; |
} elsif ($status eq 'ungraded_attempted') { |
} elsif ($status eq 'ungraded_attempted') { |
$symbol = '#'; |
$symbol = 'u'; |
} elsif ($status eq 'incorrect_attempted' || |
} elsif ($status eq 'incorrect_attempted' || |
$tries > 0) { |
$tries > 0) { |
$symbol = '.'; |
$symbol = '.'; |
Line 1878 Inputs:
|
Line 1973 Inputs:
|
####################################################### |
####################################################### |
####################################################### |
####################################################### |
sub student_performance_on_sequence { |
sub student_performance_on_sequence { |
my ($student,$studentdata,$navmap,$seq,$links) = @_; |
my ($student,$studentdata,$navmap,$seq,$links,$awarded_only) = @_; |
$links = 'no' if (! defined($links)); |
$links = 'no' if (! defined($links)); |
my $Str = ''; # final result string |
my $Str = ''; # final result string |
my ($score,$max) = (0,0); |
my ($score,$max) = (0,0); |
Line 1892 sub student_performance_on_sequence {
|
Line 1987 sub student_performance_on_sequence {
|
my $resource_data = $studentdata->{$symb}; |
my $resource_data = $studentdata->{$symb}; |
foreach my $part (@{$resource->parts()}) { |
foreach my $part (@{$resource->parts()}) { |
$partscore = undef; |
$partscore = undef; |
my $weight = &Apache::lonnet::EXT('resource.'.$part.'.weight', |
my $weight; |
$symb, |
if (!$awarded_only){ |
$student->{'domain'}, |
$weight = &Apache::lonnet::EXT('resource.'.$part.'.weight', |
$student->{'username'}, |
$symb, |
$student->{'section'}); |
$student->{'domain'}, |
|
$student->{'username'}, |
|
$student->{'section'}); |
|
} |
if (!defined($weight) || ($weight eq '')) { |
if (!defined($weight) || ($weight eq '')) { |
$weight=1; |
$weight=1; |
} |
} |
Line 1912 sub student_performance_on_sequence {
|
Line 2010 sub student_performance_on_sequence {
|
$hasdata = 1; |
$hasdata = 1; |
} |
} |
# |
# |
$partscore = $weight*$awarded; |
$partscore = &Apache::grades::compute_points($weight,$awarded); |
if (! defined($awarded)) { |
if (! defined($awarded)) { |
$partscore = undef; |
$partscore = undef; |
} |
} |
Line 1922 sub student_performance_on_sequence {
|
Line 2020 sub student_performance_on_sequence {
|
$symbol = sprintf("%.0f",$symbol); |
$symbol = sprintf("%.0f",$symbol); |
} |
} |
if (length($symbol) > 1) { |
if (length($symbol) > 1) { |
$symbol = '*'; |
$symbol = show_star($symbol); |
} |
} |
if (exists($resource_data->{'resource.'.$part.'.solved'})) { |
if (exists($resource_data->{'resource.'.$part.'.solved'}) && |
|
$resource_data->{'resource.'.$part.'.solved'} ne '') { |
my $status = $resource_data->{'resource.'.$part.'.solved'}; |
my $status = $resource_data->{'resource.'.$part.'.solved'}; |
if ($status eq 'excused') { |
if ($status eq 'excused') { |
$symbol = 'x'; |
$symbol = 'x'; |
$max -= $weight; # Do not count 'excused' problems. |
$max -= $weight; # Do not count 'excused' problems. |
|
} elsif ($status eq 'ungraded_attempted') { |
|
$symbol = 'u'; |
} |
} |
$hasdata = 1; |
$hasdata = 1; |
|
} elsif ($resource_data->{'resource.'.$part.'.award'} eq 'DRAFT') { |
|
$symbol = 'd'; |
|
$hasdata = 1; |
} elsif (!exists($resource_data->{'resource.'.$part.'.awarded'})){ |
} elsif (!exists($resource_data->{'resource.'.$part.'.awarded'})){ |
# Unsolved. Did they try? |
# Unsolved. Did they try? |
if (exists($resource_data->{'resource.'.$part.'.tries'})){ |
if (exists($resource_data->{'resource.'.$part.'.tries'})){ |
Line 1979 problems.
|
Line 2083 problems.
|
####################################################### |
####################################################### |
sub CreateLegend { |
sub CreateLegend { |
my $Str = "<p><pre>". |
my $Str = "<p><pre>". |
" 1 correct by student in 1 try\n". |
" digit score or number of tries to get correct ". |
" 7 correct by student in 7 tries\n". |
|
" * correct by student in more than 9 tries\n". |
" * correct by student in more than 9 tries\n". |
" + correct by hand grading or override\n". |
" + correct by hand grading or override\n". |
" - incorrect by override\n". |
" - incorrect by override\n". |
" . incorrect attempted\n". |
" . incorrect attempted\n". |
" # ungraded attempted\n". |
" u ungraded attempted\n". |
|
" d draft answer saved but not submitted\n". |
" not attempted (blank field)\n". |
" not attempted (blank field)\n". |
" x excused". |
" x excused". |
"</pre><p>"; |
"</pre><p>"; |