version 1.59, 2003/09/29 16:20:18
|
version 1.62, 2003/12/08 19:37:44
|
Line 51 package Apache::lonproblemstatistics;
|
Line 51 package Apache::lonproblemstatistics;
|
|
|
use strict; |
use strict; |
use Apache::lonnet(); |
use Apache::lonnet(); |
|
use Apache::loncommon(); |
use Apache::lonhtmlcommon; |
use Apache::lonhtmlcommon; |
use Apache::loncoursedata; |
use Apache::loncoursedata; |
use Apache::lonstatistics; |
use Apache::lonstatistics; |
Line 265 Main interface to problem statistics.
|
Line 266 Main interface to problem statistics.
|
sub BuildProblemStatisticsPage { |
sub BuildProblemStatisticsPage { |
my ($r,$c)=@_; |
my ($r,$c)=@_; |
# |
# |
|
my %Saveable_Parameters = ('Status' => 'scalar', |
|
'statsoutputmode' => 'scalar', |
|
'Section' => 'array', |
|
'StudentData' => 'array', |
|
'Maps' => 'array'); |
|
&Apache::loncommon::store_course_settings('statistics', |
|
\%Saveable_Parameters); |
|
&Apache::loncommon::restore_course_settings('statistics', |
|
\%Saveable_Parameters); |
|
# |
|
&Apache::lonstatistics::PrepareClasslist(); |
|
# |
my ($interface,$output_mode,$show) = &CreateInterface(); |
my ($interface,$output_mode,$show) = &CreateInterface(); |
$r->print($interface); |
$r->print($interface); |
$r->print('<input type="hidden" name="statsfirstcall" value="no" />'); |
$r->print('<input type="hidden" name="statsfirstcall" value="no" />'); |
Line 517 sub output_excel {
|
Line 530 sub output_excel {
|
if (length($sheetname) > 31) { |
if (length($sheetname) > 31) { |
$sheetname = substr($sheetname,0,31); |
$sheetname = substr($sheetname,0,31); |
} |
} |
$excel_sheet = $excel_workbook->addworksheet($sheetname); |
$excel_sheet = $excel_workbook->addworksheet( |
|
&Apache::loncommon::clean_excel_name($sheetname) |
|
); |
# |
# |
# Put the course description in the header |
# Put the course description in the header |
$excel_sheet->write($rows_output,$cols_output++, |
$excel_sheet->write($rows_output,$cols_output++, |
Line 751 sub plot_statistics {
|
Line 766 sub plot_statistics {
|
} |
} |
} |
} |
|
|
$r->print("<p>".&DrawGraph(\@Data,$title,'Problem Number',$yaxis, |
$r->print("<p>".&Apache::loncommon::DrawBarGraph($title, |
$Max)."</p>\n"); |
'Problem Number', |
|
$yaxis, |
|
$Max, |
|
undef, |
|
\@Data)."</p>\n"); |
# |
# |
# Print out the data |
# Print out the data |
$ENV{'form.sortby'} = 'Contents'; |
$ENV{'form.sortby'} = 'Contents'; |
Line 760 sub plot_statistics {
|
Line 779 sub plot_statistics {
|
return; |
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 '<IMG src="/cgi-bin/graph.png?'. |
|
(join('&', @GData)).'" border="1" />'; |
|
} |
|
|
|
sub get_statistics { |
sub get_statistics { |
my ($sequence,$resource,$part,$problem_num) = @_; |
my ($sequence,$resource,$part,$problem_num) = @_; |
# |
# |