--- loncom/interface/statistics/lonproblemstatistics.pm 2003/09/03 16:07:06 1.58 +++ loncom/interface/statistics/lonproblemstatistics.pm 2004/02/02 19:32:11 1.65 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonproblemstatistics.pm,v 1.58 2003/09/03 16:07:06 matthew Exp $ +# $Id: lonproblemstatistics.pm,v 1.65 2004/02/02 19:32:11 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -51,11 +51,20 @@ package Apache::lonproblemstatistics; use strict; use Apache::lonnet(); +use Apache::loncommon(); use Apache::lonhtmlcommon; use Apache::loncoursedata; use Apache::lonstatistics; +use Apache::lonlocal; use Spreadsheet::WriteExcel; +## +## Localization notes: +## +## in @Fields[0]->{'long_title'} is placed in Excel files and is used as the +## header for plots created with Graph.pm, both of which more than likely do +## not support localization. +## my @Fields = ( { name => 'problem_num', title => 'P#', @@ -138,7 +147,7 @@ my @Fields = ( title => '#YES', align => 'right', color => '#FFDDDD', - format => '%d', + format => '%4.1f',# format => '%d', sortable => 'yes', graphable => 'yes', long_title => 'Number of Students able to Solve' }, @@ -146,7 +155,7 @@ my @Fields = ( title => '#yes', align => 'right', color => '#FFDDDD', - format => '%d', + format => '%4.1f',# format => '%d', sortable => 'yes', graphable => 'yes', long_title => 'Number of Students given Override' }, @@ -199,12 +208,15 @@ my @OutputOptions = sub CreateInterface { my $Str = ''; + $Str .= '
Sections | '; - $Str .= 'Enrollment Status | '; - $Str .= 'Sequences and Folders | '; - $Str .= 'Output | '; + $Str .= ''.&mt('Sections').' | '; + $Str .= ''.&mt('Enrollment Status').' | '; + $Str .= ''.&mt('Sequences and Folders').' | '; + $Str .= ''.&mt('Output').' | '; $Str .= '
'."\n"; @@ -232,9 +244,11 @@ sub CreateInterface { $Str .= $html; $Str .= ' |
".&DrawGraph(\@Data,$title,'Problem Number',$yaxis, - $Max)."
\n"); + $r->print("".&Apache::loncommon::DrawBarGraph($title, + 'Problem Number', + $yaxis, + $Max, + undef, # colors + undef, # labels + \@Data)."
\n"); # # Print out the data $ENV{'form.sortby'} = 'Contents'; @@ -747,38 +783,6 @@ sub plot_statistics { return; } -############################################### -############################################### - -=pod - -=item &DrawGraph() - -=cut - -############################################### -############################################### -sub DrawGraph { - my ($values,$title,$xaxis,$yaxis,$Max)=@_; - $title = '' if (! defined($title)); - $xaxis = '' if (! defined($xaxis)); - $yaxis = '' if (! defined($yaxis)); - $title = &Apache::lonnet::escape($title); - $xaxis = &Apache::lonnet::escape($xaxis); - $yaxis = &Apache::lonnet::escape($yaxis); - # - my $sendValues = join(',', @$values); - my $sendCount = scalar(@$values); - $Max =1 if ($Max < 1); - if ( int($Max) < $Max ) { - $Max++; - $Max = int($Max); - } - my @GData = ($title,$xaxis,$yaxis,$Max,$sendCount,$sendValues); - return ''; -} - sub get_statistics { my ($sequence,$resource,$part,$problem_num) = @_; # @@ -808,6 +812,8 @@ sub get_statistics { =item &ProblemStatisticsLegend() +HELP This needs to be localized, or at least generated automatically. + =cut ###############################################