--- loncom/interface/statistics/lonstudentassessment.pm 2003/06/17 17:47:54 1.60 +++ loncom/interface/statistics/lonstudentassessment.pm 2005/02/25 19:48:01 1.114 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstudentassessment.pm,v 1.60 2003/06/17 17:47:54 matthew Exp $ +# $Id: lonstudentassessment.pm,v 1.114 2005/02/25 19:48:01 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -52,9 +52,13 @@ package Apache::lonstudentassessment; use strict; use Apache::lonstatistics; use Apache::lonhtmlcommon; +use Apache::loncommon(); use Apache::loncoursedata; use Apache::lonnet; # for logging porpoises +use Apache::lonlocal; +use Time::HiRes; use Spreadsheet::WriteExcel; +use Spreadsheet::WriteExcel::Utility(); ####################################################### ####################################################### @@ -85,12 +89,6 @@ my $Statistics; =item $show 'all', 'totals', or 'scores' determines how much data is output -=item $data determines what performance data is shown - -=item $datadescription A short description of the output data selected. - -=item $base 'tries' or 'scores' determines the base of the performance shown - =item $single_student_mode evaluates to true if we are showing only one student. @@ -100,9 +98,7 @@ student. ####################################################### my $show_links; my $output_mode; -my $data; -my $base; -my $datadescription; +my $chosen_output; my $single_student_mode; ####################################################### @@ -138,8 +134,28 @@ Inputs: ####################################################### sub BuildStudentAssessmentPage { my ($r,$c)=@_; + # undef($Statistics); + undef($show_links); + undef($output_mode); + undef($chosen_output); + undef($single_student_mode); + # + my %Saveable_Parameters = ('Status' => 'scalar', + 'chartoutputmode' => 'scalar', + 'chartoutputdata' => 'scalar', + 'Section' => 'array', + 'StudentData' => 'array', + 'Maps' => 'array'); + &Apache::loncommon::store_course_settings('chart',\%Saveable_Parameters); + &Apache::loncommon::restore_course_settings('chart',\%Saveable_Parameters); + # + &Apache::lonstatistics::PrepareClasslist(); + # + $single_student_mode = 0; $single_student_mode = 1 if ($ENV{'form.SelectedStudent'}); + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, + ['selectstudent']); if ($ENV{'form.selectstudent'}) { &Apache::lonstatistics::DisplayClasslist($r); return; @@ -161,6 +177,7 @@ sub BuildStudentAssessmentPage { my $initialize = \&html_initialize; my $output_student = \&html_outputstudent; my $finish = \&html_finish; + &Apache::lonnet::logthis('got here! 1'); # if ($output_mode eq 'excel') { $initialize = \&excel_initialize; @@ -172,6 +189,7 @@ sub BuildStudentAssessmentPage { $finish = \&csv_finish; } # + &Apache::lonnet::logthis('got here! 2'); if($c->aborted()) { return ; } # # Determine which students we want to look at @@ -191,8 +209,12 @@ sub BuildStudentAssessmentPage { # are immediately reflected in the chart. &Apache::lonnet::clear_EXT_cache_status(); # + # Clean out loncoursedata's package data, just to be safe. + &Apache::loncoursedata::clear_internal_caches(); + # # Call the initialize routine selected above $initialize->($r); + &Apache::lonnet::logthis('got here! 3'); foreach my $student (@Students) { if($c->aborted()) { $finish->($r); @@ -290,17 +312,18 @@ the chart page. ####################################################### sub CreateInterface { my $Str = ''; + $Str .= &Apache::lonhtmlcommon::breadcrumbs(undef,'Chart'); # $Str .= &CreateLegend(); $Str .= ''."\n"; $Str .= ''; - $Str .= ''; - $Str .= ''; - $Str .= ''; - $Str .= ''; - $Str .= ''; + $Str .= ''; + $Str .= ''; + $Str .= ''; + $Str .= ''; - $Str .= ''; $Str .= ''."\n"; @@ -308,34 +331,31 @@ sub CreateInterface { $Str .= ''."\n"; $Str .= '
SectionsStudent DataEnrollment StatusSequences and FoldersOutput Format'. + $Str .= ''.&mt('Sections').''.&mt('Student Data').''.&mt('Enrollment Status').''.&mt('Sequences and Folders').''.&mt('Output Format').''. &Apache::loncommon::help_open_topic("Chart_Output_Formats"). 'Output Data'. + $Str .= ''.&mt('Output Data').''. &Apache::loncommon::help_open_topic("Chart_Output_Data"). '
'."\n"; $Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5); $Str .= ''; - my $only_seq_with_assessments = sub { - my $s=shift; - if ($s->{'num_assess'} < 1) { - return 0; - } else { - return 1; - } - }; $Str .= &Apache::lonstatistics::StudentDataSelect('StudentData','multiple', 5,undef); $Str .= ''."\n"; $Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5); $Str .= ''."\n"; - $Str .= &Apache::lonstatistics::MapSelect('Maps','multiple,all',5, - $only_seq_with_assessments); + $Str .= &Apache::lonstatistics::map_select('Maps','multiple,all',5); $Str .= ''."\n"; $Str .= &CreateAndParseOutputSelector(); $Str .= ''."\n"; $Str .= &CreateAndParseOutputDataSelector(); $Str .= '
'."\n"; - $Str .= ''; + $Str .= ''; + $Str .= ' 'x5; + $Str .= ''; $Str .= ' 'x5; - $Str .= ''; + $Str .= ''; $Str .= ' 'x5; - $Str .= ''; - $Str .= ' 'x5.'
'; + $Str .= + &mt('Status[_1]', + ''); + $Str .= '
'; return $Str; } @@ -382,7 +402,7 @@ my @OutputOptions = }, { name => 'CSV', value => 'csv', - description => 'Output a comma seperated values file suitable for '. + description => 'Output a comma separated values file suitable for '. 'import into a spreadsheet program. Using this method as opposed '. 'to Excel output allows you to organize your data before importing'. ' it into a spreadsheet program.', @@ -406,6 +426,8 @@ sub OutputDescriptions { sub CreateAndParseOutputSelector { my $Str = ''; my $elementname = 'chartoutputmode'; + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, + [$elementname]); # # Format for output options is 'mode, restrictions'; my $selected = 'html, without links'; @@ -432,7 +454,7 @@ sub CreateAndParseOutputSelector { foreach my $option (@OutputOptions) { $Str .= "\n".'