--- loncom/interface/statistics/lonstudentassessment.pm 2003/05/21 14:43:01 1.48 +++ loncom/interface/statistics/lonstudentassessment.pm 2003/05/29 21:41:10 1.50 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstudentassessment.pm,v 1.48 2003/05/21 14:43:01 matthew Exp $ +# $Id: lonstudentassessment.pm,v 1.50 2003/05/29 21:41:10 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -85,6 +85,9 @@ my $Statistics; =item $show 'all', 'totals', or 'scores' determines how much data is output +=item $single_student_mode evaluates to true if we are showing only one +student. + =cut ####################################################### @@ -92,6 +95,7 @@ my $Statistics; my $show_links; my $output_mode; my $show; +my $single_student_mode; ####################################################### ####################################################### @@ -127,14 +131,17 @@ Inputs: sub BuildStudentAssessmentPage { my ($r,$c)=@_; undef($Statistics); + $single_student_mode = 1 if ($ENV{'form.SelectedStudent'}); # # Print out the HTML headers for the interface # This also parses the output mode selector # This step must always be done. $r->print(&CreateInterface()); $r->print(''); + $r->print(''); $r->rflush(); - if (! exists($ENV{'form.notfirstrun'})) { + if (! exists($ENV{'form.notfirstrun'}) && ! $single_student_mode) { $r->print(< @@ -168,9 +175,19 @@ ENDMSG # if($c->aborted()) { return ; } # + # Determine which students we want to look at + my @Students; + if ($single_student_mode) { + @Students = (&Apache::lonstatistics::current_student()); + $r->print(&next_and_previous_buttons()); + $r->rflush(); + } else { + @Students = @Apache::lonstatistics::Students; + } + # # Call the initialize routine selected above $initialize->($r); - foreach my $student (@Apache::lonstatistics::Students) { + foreach my $student (@Students) { if($c->aborted()) { $finish->($r); return ; @@ -186,6 +203,54 @@ ENDMSG ####################################################### ####################################################### +sub next_and_previous_buttons { + my $Str = ''; + $Str .= ''; + # + # Build the previous student link + my $previous = &Apache::lonstatistics::previous_student(); + my $previousbutton = ''; + if (defined($previous)) { + my $sname = $previous->{'username'}.':'.$previous->{'domain'}; + $previousbutton .= ''; + } else { + $previousbutton .= ''; + } + # + # Build the next student link + my $next = &Apache::lonstatistics::next_student(); + my $nextbutton = ''; + if (defined($next)) { + my $sname = $next->{'username'}.':'.$next->{'domain'}; + $nextbutton .= ''; + } else { + $nextbutton .= ''; + } + # + # Build the 'all students' button + my $all = ''; + $all .= ''; + $Str .= $previousbutton.(' 'x5).$all.(' 'x5).$nextbutton; + return $Str; +} + +####################################################### +####################################################### sub get_student_fields_to_show { my @to_show = @Apache::lonstatistics::SelectedStudentData; @@ -396,7 +461,7 @@ sub CreateAndParseOutputSelector { my $elementname = 'chartoutputmode'; # # Format for output options is 'mode, restrictions'; - my $selected = 'html, with links'; + my $selected = 'html, without links'; if (exists($ENV{'form.'.$elementname})) { if (ref($ENV{'form.'.$elementname} eq 'ARRAY')) { $selected = $ENV{'form.'.$elementname}->[0]; @@ -595,7 +660,11 @@ sub html_finish { } else { $r->print("\n"); } - $r->print(&StudentAverageTotal()); + if ($single_student_mode) { + $r->print(&SingleStudentTotal()); + } else { + $r->print(&StudentAverageTotal()); + } $r->rflush(); return; } @@ -638,6 +707,31 @@ sub StudentAverageTotal { return $Str; } +sub SingleStudentTotal { + my $student = &Apache::lonstatistics::current_student(); + my $Str = "

Summary Table For ".$student->{'username'}.'@'. + $student->{'domain'}."

\n"; + $Str .= ''."\n"; + $Str .= + "\n"; + my $total = 0; + my $total_max = 0; + foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { + my $value = $Statistics->{$seq->{'symb'}}->{'score'}; + my $max = $Statistics->{$seq->{'symb'}}->{'max'}; + $Str .= ''. + ''. + ''."\n"; + $total += $value; + $total_max +=$max; + } + $Str .= ''. + ''. + '\n"; + $Str .= "
Sequence or FolderScoreMaximum
'.$seq->{'title'}.''.$value.''.$max.'
Total'.$total.''.$total_max."
\n"; + return $Str; +} + } ####################################################### @@ -1175,6 +1269,9 @@ sub StudentPerformanceOnSequence { # if ( ($links eq 'yes' && $symbol ne ' ') || ($links eq 'all')) { + if (length($symbol) > 1) { + &Apache::lonnet::logthis('length of symbol "'.$symbol.'" > 1'); + } $symbol = '