--- loncom/interface/statistics/lonpercentage.pm 2003/01/13 00:15:16 1.6 +++ loncom/interface/statistics/lonpercentage.pm 2008/12/12 10:01:30 1.11 @@ -1,7 +1,6 @@ # The LearningOnline Network with CAPA -# (Publication Handler # -# $Id: lonpercentage.pm,v 1.6 2003/01/13 00:15:16 minaeibi Exp $ +# $Id: lonpercentage.pm,v 1.11 2008/12/12 10:01:30 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -33,6 +32,9 @@ use strict; use Apache::lonhtmlcommon; use Apache::loncoursedata; use GDBM_File; +use lib '/home/httpd/lib/perl/'; +use LONCAPA; + sub BuildPercentageGraph { @@ -110,9 +112,7 @@ sub CreateInterface { $Ptr .= ''."\n"; my @sections = split(':',$cache->{'sectionList'}); my @sectionsSelected = split(':',$cache->{'sectionsSelected'}); - $Ptr .= &Apache::lonhtmlcommon::MultipleSectionSelect(\@sections, - \@sectionsSelected, - 'Statistics'); + $Ptr .= &Apache::lonstatistics::SectionSelect('Section','multiple',5); $Ptr .= ''."\n"; $Ptr .= ''; @@ -241,10 +241,6 @@ sub GraphData { my $max = 0; my $pno = 0; - my $xlabel = ($totalProblems >= 100 ) ? - 'Percentage_of_Problems_Correct' : - 'Number_of_Problems_Correct'; - foreach my $key (sort NumericSort keys(%percentages)) { push(@percent, $key); my @temp = split(':::', $percentages{$key}); @@ -270,7 +266,17 @@ sub GraphData { } } -# $r->print('
xlable='.$xlabel); + my $xlabel; + my $Freq; + if ($totalProblems >= 100 ) { + $xlabel = 'Percentage_of_Problems_Correct'; + $Freq=101; + } else { + $xlabel = 'Number_of_Problems_Correct'; + $Freq = $cId; + } + +# $r->print('
Freq='.$Freq); # $r->print('
max='.$max); # $r->print('
percentcount='.join(',', @percentCount)); # $r->print('
percent='.join(',', @percent)); @@ -278,7 +284,7 @@ sub GraphData { # $r->print('
percent='.join(',', @data2)); my @GData = ("Percentage",$xlabel, - 'Number_of_Students',$max,100 , + 'Number_of_Students',$max,$Freq, join(',',@data1), join(',', @data2)); $Ptr .= ''."\n"; @@ -324,11 +330,11 @@ sub TableData { foreach my $name (sort(split(':::', $percentage->{$_}))) { $Ptr .= ''; + $Ptr .= &escape($cache->{$name.':fullname'}).'">'; $Ptr .= $cache->{$name.':fullname'}; - $Ptr .= ',  '; + $Ptr .= ',  '; } $Ptr .= ''."\n";