--- loncom/interface/statistics/lonstudentassessment.pm 2002/07/24 14:52:32 1.1 +++ loncom/interface/statistics/lonstudentassessment.pm 2002/07/25 21:23:51 1.2 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: lonstudentassessment.pm,v 1.1 2002/07/24 14:52:32 stredwic Exp $ +# $Id: lonstudentassessment.pm,v 1.2 2002/07/25 21:23:51 stredwic Exp $ # # Copyright Michigan State University Board of Trustees # @@ -43,125 +43,190 @@ use Apache::loncoursedata; use GDBM_File; sub BuildStudentAssessmentPage { - my ($cacheDB, $students, $courseID, $c)=@_; + my ($cacheDB,$students,$courseID,$formName,$headings,$spacing, + $studentInformation,$r,$c)=@_; my %cache; - - my $Ptr = ''; - $Ptr .= '
Select Map | '."\n"; - $Ptr .= ''; - $Ptr .= &Apache::lonhtmlcommon::MapOptions(\%cache, 'StudentAssessment'); - $Ptr .= ' | |||||||||||
Select Student | '."\n"; - $Ptr .= ''."\n"; - $Ptr .= &Apache::lonhtmlcommon::StudentOptions(\%cache, $students, - $selectedName, - 'StudentAssessment'); - $Ptr .= ' | |||||||||||
';
- $Ptr .= 'print($Ptr);
+ return;
}
+ my ($infoHeadings, $infoKeys, $sequenceHeadings, $sequenceKeys) =
+ &ShouldShowColumns(\%cache, $headings, $studentInformation);
+
+ $r->print(&CreateTableHeadings(\%cache, $spacing, $infoKeys, $infoHeadings,
+ $sequenceKeys, $sequenceHeadings));
+ untie(%cache);
+
my $selected=0;
+ $r->print(''."\n"); foreach (@$students) { next if ($_ ne $selectedName && $selectedName ne 'All Students'); $selected = 1; - my $courseData = - &Apache::loncoursedata::DownloadCourseInformation($_, $courseID); + my $courseData; + if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER,0640)) { + if($cache{$_.':lastDownloadTime'} eq 'Not downloaded') { + untie(%cache); + $courseData = + &Apache::loncoursedata::DownloadCourseInformation($_, + $courseID); + if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT,0640)) { + &Apache::loncoursedata::ProcessStudentData(\%cache, + $courseData, $_); + untie(%cache); + } else { + last if($c->aborted()); + next; + } + } else { + untie(%cache); + } + } else { + last if($c->aborted()); + next; + } + last if ($c->aborted()); - if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT,0640)) { - &Apache::loncoursedata::ProcessStudentData(\%cache, - $courseData, $_); - if(!$c->aborted()) { $Ptr .= &StudentReport(\%cache, $_); } + + if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER,0640)) { + my $displayString = 'DISPLAYDATA'.$spacing; + $r->print(&Apache::lonhtmlcommon::FormatStudentInformation( + \%cache, $_, + $infoKeys, + $displayString, + 'preformatted')); + $r->print(&StudentReport(\%cache, $_, $spacing, $sequenceKeys)); + $r->print("\n"); untie(%cache); } } + $r->print(''."\n"); if($selected == 0) { $Ptr .= ' WARNING: '; $Ptr .= 'Please select a student'; + $r->print($Ptr); } - return $Ptr; + return; } #---- Student Assessment Web Page -------------------------------------------- -# ------ Create different Student Report +sub CreateInterface { + my($cache,$selectedName,$students,$formName)=@_; + my $Ptr = ''; + $Ptr .= &CreateLegend(); + $Ptr .= '
'; return $Str; } - $Str .= "
". + "1..9: correct by student in 1..9 tries\n". + " *: correct by student in more than 9 tries\n". + " +: correct by override\n". + " -: incorrect by override\n". + " .: incorrect attempted\n". + " #: ungraded attempted\n". + " : not attempted\n". + " x: excused". + " "; + return $Str; +} + +=pod + +=item &CreateColumnSelectionBox() + +If there are columns not being displayed then this selection box is created +with a list of those columns. When selections are made and the page +refreshed, the columns will be removed from this box and the column is +put back in the chart. If there is no columns to select, no row is added +to the interface table. + +=over 4 +Input: $CacheData, $headings + + +$CacheData: A pointer to a hash tied to the cached data + +$headings: An array of the names of the columns for the student information. +They are used for displaying which columns are missing. + +Output: $notThere + +$notThere: The string contains one row of a table. The first column has the +name of the selection box. The second contains the selection box +which has a size of four. + +=back + +=cut + +sub CreateColumnSelectionBox { + my ($CacheData,$headings)=@_; + + my $missing=0; + my $notThere=' | ||||||||||||
Select column to view:'; + my $name; + $notThere .= ' | '; + $notThere .= ''; + } else { + $notThere=' | |||||||||||
'; + } + + return $notThere.' | ||||||||||||
'; + $present .= ''; + $present .= ' | '; + $found++; + } + + foreach my $sequence (split(/\:/,$CacheData->{'orderedSequences'})) { + if(!&ShouldShowColumn($CacheData, 'ChartSequence'.$sequence)) { + next; + } + $present .= ''; + $present .= ''; + $present .= ' | '; + $found++; + } + + if(!$found) { + $present = ''; + } + + return $present.'