--- loncom/interface/statistics/lonstudentassessment.pm 2002/07/26 16:22:09 1.3
+++ loncom/interface/statistics/lonstudentassessment.pm 2002/07/26 19:49:26 1.4
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# (Publication Handler
#
-# $Id: lonstudentassessment.pm,v 1.3 2002/07/26 16:22:09 stredwic Exp $
+# $Id: lonstudentassessment.pm,v 1.4 2002/07/26 19:49:26 stredwic Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -42,10 +42,12 @@ use Apache::lonhtmlcommon;
use Apache::loncoursedata;
use GDBM_File;
+#my $jr;
+
sub BuildStudentAssessmentPage {
my ($cacheDB,$students,$courseID,$formName,$headings,$spacing,
$studentInformation,$r,$c)=@_;
-
+# $jr = $r;
my %cache;
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER,0640)) {
$r->print('
Unable to tie database.');
@@ -75,23 +77,24 @@ sub BuildStudentAssessmentPage {
splice(@$students, $studentIndex, 1);
}
}
+ my ($infoHeadings, $infoKeys, $sequenceHeadings, $sequenceKeys,
+ $doNotShow) =
+ &ShouldShowColumns(\%cache, $headings, $studentInformation);
my $selectedName = &FindSelectedStudent(\%cache,
$cache{'StudentAssessmentStudent'},
$students);
- $r->print(&CreateInterface(\%cache, $selectedName, $students, $formName));
+ $r->print(&CreateInterface(\%cache, $selectedName, $students, $formName,
+ $doNotShow));
- my $Ptr = '';
+ my $Str = '';
if($selectedName eq 'No Student Selected') {
- $Ptr .= 'WARNING: ';
- $Ptr .= 'Please select a student ';
- $r->print($Ptr);
+ $Str .= 'WARNING: ';
+ $Str .= 'Please select a student ';
+ $r->print($Str);
return;
}
- my ($infoHeadings, $infoKeys, $sequenceHeadings, $sequenceKeys) =
- &ShouldShowColumns(\%cache, $headings, $studentInformation);
-
$r->print(&CreateTableHeadings(\%cache, $spacing, $infoKeys, $infoHeadings,
$sequenceKeys, $sequenceHeadings));
untie(%cache);
@@ -141,9 +144,9 @@ sub BuildStudentAssessmentPage {
}
$r->print(''."\n");
if($selected == 0) {
- $Ptr .= 'WARNING: ';
- $Ptr .= 'Please select a student ';
- $r->print($Ptr);
+ $Str .= 'WARNING: ';
+ $Str .= 'Please select a student ';
+ $r->print($Str);
}
return;
@@ -152,33 +155,42 @@ sub BuildStudentAssessmentPage {
#---- Student Assessment Web Page --------------------------------------------
sub CreateInterface {
- my($cache,$selectedName,$students,$formName)=@_;
- my $Ptr = '';
- $Ptr .= &CreateLegend();
- $Ptr .= ''."\n";
+ $Str .= '';
+ $Str .= &CreateColumnSelectionBox($doNotShow);
+ $Str .= ' '."\n";
+ $Str .= 'DISPLAYDATA FORMATTING';
$displayString .= $spacing.' '."\n";
@@ -433,41 +451,22 @@ which has a size of four.
=cut
sub CreateColumnSelectionBox {
- my ($CacheData,$headings)=@_;
-
- my $missing=0;
- my $notThere='Select column to view: ';
- my $name;
- $notThere .= '';
- $notThere .= ''."\n";
-
- for(my $index=0; $index<(scalar @$headings); $index++) {
- if(&ShouldShowColumn($CacheData, 'ChartHeading'.$index)) {
- next;
- }
- $name = $headings->[$index];
- $notThere .= '';
- $notThere .= $name.' '."\n";
- $missing++;
- }
+ my ($doNotShow)=@_;
- foreach my $sequence (split(/\:/,$CacheData->{'orderedSequences'})) {
- if(&ShouldShowColumn($CacheData, 'ChartSequence'.$sequence)) {
- next;
- }
- $name = $CacheData->{$sequence.':title'};
- $notThere .= '';
+ my $notThere = '';
+ $notThere .= '{'count'}; $index++) {
+ my $name = $doNotShow->{$index.':name'};
+ $notThere .= '';
$notThere .= $name.' '."\n";
- $missing++;
}
- if($missing) {
- $notThere .= ' ';
- } else {
- $notThere='';
- }
+ $notThere .= '';
- return $notThere.' ';
+ return $notThere;
}
=pod
@@ -497,37 +496,24 @@ for consistency of location over the col
=cut
sub CreateColumnSelectors {
- my ($headings)=@_;
-=pod
- my $found=0;
- my ($name, $length, $position);
+ my ($infoHeadings, $sequenceHeadings, $sequenceKeys)=@_;
- my $present = '';
- for(my $index=0; $index<(scalar @$headings); $index++) {
+ my $present = '';
+ for(my $index=0; $index<(scalar @$infoHeadings); $index++) {
$present .= '';
$present .= ' ';
- $present .= ' ';
- $found++;
+ $present .= 'name="HeadingColumn'.$infoHeadings->[$index].'" />';
+ $present .= ''."\n";
}
- foreach my $sequence (split(/\:/,$CacheData->{'orderedSequences'})) {
- if(!&ShouldShowColumn($CacheData, 'ChartSequence'.$sequence)) {
- next;
- }
+ for(my $index=0; $index<(scalar @$sequenceHeadings); $index++) {
$present .= '';
$present .= ' ';
- $present .= ' ';
- $found++;
+ $present .= 'name="SequenceColumn'.$sequenceKeys->[$index].'" />';
+ $present .= ''."\n";
}
- if(!$found) {
- $present = '';
- }
-
- return $present.' '."\n";;
-=cut
+ return $present;
}
#---- END Student Assessment Web Page ----------------------------------------
@@ -602,26 +588,40 @@ sub ShouldShowColumns {
my @sequenceKeys=();
my @sequenceHeadings=();
+ my %doNotShow;
+
my $index;
+ my $count = 0;
+ my $check = '';
for($index=0; $index < scalar @$headings; $index++) {
- push(@infoHeadings, $headings->[$index]);
- push(@infoKeys, $cacheKey->[$index]);
+ $check = 'HeadingColumn'.$headings->[$index];
+ if($cache->{'HeadingsFound'} =~ /$check/) {
+ push(@infoHeadings, $headings->[$index]);
+ push(@infoKeys, $cacheKey->[$index]);
+ } else {
+ $doNotShow{$count.':name'} = $headings->[$index];
+ $doNotShow{$count.':id'} = 'HeadingColumn'.$headings->[$index];
+ $count++;
+ }
}
foreach my $sequence (split(/\:/,$cache->{'orderedSequences'})) {
- push(@sequenceHeadings, $cache->{$sequence.':title'});
- push(@sequenceKeys, $sequence);
+ $check = 'SequenceColumn'.$sequence;
+ if($cache->{'SequencesFound'} eq 'All Sequences' ||
+ $cache->{'SequencesFound'} =~ /$check/) {
+ push(@sequenceHeadings, $cache->{$sequence.':title'});
+ push(@sequenceKeys, $sequence);
+ } else {
+ $doNotShow{$count.':name'} = $cache->{$sequence.':title'};
+ $doNotShow{$count.':id'} = 'SequenceColumn'.$sequence;
+ $count++;
+ }
}
-# my $headings=$cache->{'form.ChartHeadings'};
-# my $sequences=$cache->{'form.ChartSequences'};
-# if($headings eq 'ALLHEADINGS' || $sequences eq 'ALLSEQUENCES' ||
-# $headings=~/$test/ || $sequences=~/$test/) {
-# return 1;
-# }
+ $doNotShow{'count'} = $count;
return (\@infoHeadings, \@infoKeys, \@sequenceHeadings,
- \@sequenceKeys);
+ \@sequenceKeys, \%doNotShow);
}
#---- END Student Assessment Worker Functions --------------------------------