--- loncom/interface/lonstatistics.pm 2003/06/10 19:19:57 1.76 +++ loncom/interface/lonstatistics.pm 2003/10/03 15:40:47 1.78.2.2 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstatistics.pm,v 1.76 2003/06/10 19:19:57 matthew Exp $ +# $Id: lonstatistics.pm,v 1.78.2.2 2003/10/03 15:40:47 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -805,8 +805,46 @@ sub DisplayClasslist { my @Fields = ('fullname','username','domain','id','section'); # my $Str=''; + if (! @Students) { + if ($SelectedSections[0] eq 'all') { + if (lc($ENV{'form.Status'}) eq 'any') { + $Str .= '

There are no students in the course.

'; + } elsif (lc($ENV{'form.Status'}) eq 'active') { + $Str .= '

There are no currently enrolled students in '. + 'the course.

'; + } elsif (lc($ENV{'form.Status'}) eq 'expired') { + $Str .= '

There are no previously enrolled '. + 'students in the course.

'; + } + } else { + my $sections; + if (@SelectedSections == 1) { + $sections = 'section '.$SelectedSections[0]; + } elsif (@SelectedSections > 2) { + $sections = 'sections '.join(', ',@SelectedSections); + $sections =~ s/, ([^,])*$/, and $1/; + } else { + $sections = 'sections '.join(' and ',@SelectedSections); + } + if (lc($ENV{'form.Status'}) eq 'any') { + $Str .= '

There are no students in '.$sections.'.

'; + } elsif (lc($ENV{'form.Status'}) eq 'active') { + $Str .= '

There are no currently enrolled students '. + 'in '.$sections.'.

'; + } elsif (lc($ENV{'form.Status'}) eq 'expired') { + $Str .= '

There are no previously enrolled students '. + 'in '.$sections.'.

'; + } + } + $Str.= ''. + 'Return to the chart.'; + $r->print($Str); + $r->rflush(); + return; + } + # "Click" is asinine but it is probably not my place to change the world. - $Str .= '

Click on a users name to view their chart

'; + $Str .= '

Click on a students name or username to view their chart

'; $Str .= '
'."\n"; $Str .= ''."\n"; foreach my $field (@Fields) { @@ -827,7 +865,7 @@ sub DisplayClasslist { # foreach my $field (@Fields) { $Str .= ''."\n"; - $Str .= ''."\n"; - $Str .= ''."\n"; - # - $Str .= ''; - $Str .= '\n"; - $Str .= '
'; - if ($field eq 'fullname') { + if ($field eq 'fullname' || $field eq 'username') { $Str .= '
Report:'; - $Str .= ''.(' 'x30).''. - ''. - "
'."\n"; - $Str .= '
'."\n"; + $Str = ''; +# $Str .= ''."\n"; +# $Str .= ''."\n"; +# $Str .= ''."\n"; +# # +# $Str .= ''; +# $Str .= '\n"; +# $Str .= '
Report:'; +# $Str .= ''.(' 'x30).''. +# ''. +# "
'."\n"; +# $Str .= '
'."\n"; # return $Str; } @@ -887,6 +926,10 @@ sub handler { my $r=shift; my $c = $r->connection(); # + &Apache::loncoursedata::clear_internal_caches(); + # + &Apache::loncoursedata::clear_internal_caches(); + # # Check for overloading my $loaderror=&Apache::lonnet::overloaderror($r); if ($loaderror) { return $loaderror; } @@ -987,8 +1030,6 @@ END &Apache::lonstudentassessment::BuildStudentAssessmentPage($r,$c); } elsif($GoToPage eq 'DoDiffGraph' || $GoToPage eq 'PercentWrongGraph') { # &Apache::lonproblemstatistics::BuildGraphicChart($r,$c); - } elsif($GoToPage eq 'classlist') { - &DisplayClasslist($r); } elsif($GoToPage eq 'Correct-problems Plot') { # &Apache::lonpercentage::BuildPercentageGraph($r,$c); }