--- loncom/interface/statistics/lonstudentassessment.pm 2003/10/29 16:20:14 1.73 +++ loncom/interface/statistics/lonstudentassessment.pm 2009/05/17 23:13:49 1.155 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstudentassessment.pm,v 1.73 2003/10/29 16:20:14 matthew Exp $ +# $Id: lonstudentassessment.pm,v 1.155 2009/05/17 23:13:49 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -50,11 +50,20 @@ Presents assessment data about a student package Apache::lonstudentassessment; use strict; -use Apache::lonstatistics; -use Apache::lonhtmlcommon; +use Apache::lonstatistics(); +use Apache::lonhtmlcommon(); +use Apache::loncommon(); use Apache::loncoursedata; use Apache::lonnet; # for logging porpoises +use Apache::lonlocal; +use Apache::grades(); +use Apache::lonmsgdisplay(); +use Time::HiRes; use Spreadsheet::WriteExcel; +use Spreadsheet::WriteExcel::Utility(); +use lib '/home/httpd/lib/perl/'; +use LONCAPA; + ####################################################### ####################################################### @@ -85,12 +94,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 +103,7 @@ student. ####################################################### my $show_links; my $output_mode; -my $data; -my $base; -my $datadescription; +my $chosen_output; my $single_student_mode; ####################################################### @@ -138,18 +139,30 @@ Inputs: ####################################################### sub BuildStudentAssessmentPage { my ($r,$c)=@_; - + # undef($Statistics); undef($show_links); undef($output_mode); - undef($data); - undef($base); - undef($datadescription); + undef($chosen_output); undef($single_student_mode); - + # + my %Saveable_Parameters = ('Status' => 'scalar', + 'chartoutputmode' => 'scalar', + 'chartoutputdata' => 'scalar', + 'Section' => 'array', + 'Groups' => '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'}); - if ($ENV{'form.selectstudent'}) { + $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; } @@ -160,12 +173,15 @@ sub BuildStudentAssessmentPage { $r->print(&CreateInterface()); $r->print(''); $r->print(''); + $env{'form.sort'}.'" />'); $r->rflush(); # - if (! exists($ENV{'form.notfirstrun'}) && ! $single_student_mode) { + if (! exists($env{'form.notfirstrun'}) && ! $single_student_mode) { return; } + $r->print('

'. + &Apache::lonstatistics::section_and_enrollment_description(). + '

'); # my $initialize = \&html_initialize; my $output_student = \&html_outputstudent; @@ -224,7 +240,7 @@ sub BuildStudentAssessmentPage { sub next_and_previous_buttons { my $Str = ''; $Str .= ''; + $env{'form.SelectedStudent'}.'" />'; # # Build the previous student link my $previous = &Apache::lonstatistics::previous_student(); @@ -232,14 +248,14 @@ sub next_and_previous_buttons { if (defined($previous)) { my $sname = $previous->{'username'}.':'.$previous->{'domain'}; $previousbutton .= ''; } else { $previousbutton .= ''; + &mt('Previous Student').'" disabled="disabled" />'; } # # Build the next student link @@ -248,19 +264,19 @@ sub next_and_previous_buttons { if (defined($next)) { my $sname = $next->{'username'}.':'.$next->{'domain'}; $nextbutton .= ''; } else { $nextbutton .= ''; + &mt('Next Student').'" disabled="disabled" />'; } # # Build the 'all students' button my $all = ''; - $all .= ''; $Str .= $previousbutton.(' 'x5).$all.(' 'x5).$nextbutton; @@ -302,17 +318,28 @@ the chart page. ####################################################### sub CreateInterface { my $Str = ''; + $Str .= &Apache::lonhtmlcommon::breadcrumbs('Chart','Chart_Description:Chart_Sections:Chart_Student_Data:Chart_Enrollment_Status:Chart_Sequences:Chart_Output_Formats:Chart_Output_Data'); # $Str .= &CreateLegend(); $Str .= ''."\n"; $Str .= ''; - $Str .= ''; - $Str .= ''; - $Str .= ''; - $Str .= ''; - $Str .= ''; + $Str .= ''; + $Str .= ''; + $Str .= ''; + $Str .= ''; + $Str .= ''; - $Str .= ''; $Str .= ''."\n"; @@ -320,35 +347,33 @@ sub CreateInterface { $Str .= ''."\n"; $Str .= '
SectionsStudent DataEnrollment StatusSequences and FoldersOutput Format'. + $Str .= ''.&mt('Sections').''. + &Apache::loncommon::help_open_topic("Chart_Sections"). + ''.&mt('Groups').''. + ''.&mt('Student Data'). + &Apache::loncommon::help_open_topic("Chart_Student_Data"). + ''.&mt('Access Status').''. + &Apache::loncommon::help_open_topic("Chart_Enrollment_Status"). + ''.&mt('Sequences and Folders').''. + &Apache::loncommon::help_open_topic("Chart_Sequences"). + ''.&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::GroupSelect('Group','multiple',5); + $Str .= ''; $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 .= ' 'x5; - $Str .= ''; + $Str .= ''; $Str .= ' 'x5; - $Str .= ''; + $Str .= ''; $Str .= ' 'x5; - $Str .= '
'; + $Str .= ''; + $Str .= '

'; + $Str .= + &mt('Status [_1]', + ''); + $Str .= '

'; return $Str; } @@ -395,7 +420,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.', @@ -423,14 +448,9 @@ sub CreateAndParseOutputSelector { [$elementname]); # # Format for output options is 'mode, restrictions'; - my $selected = 'html, without links'; - if (exists($ENV{'form.'.$elementname})) { - if (ref($ENV{'form.'.$elementname} eq 'ARRAY')) { - $selected = $ENV{'form.'.$elementname}->[0]; - } else { - $selected = $ENV{'form.'.$elementname}; - } - } + my $selected = (&Apache::loncommon::get_env_multiple('form.'.$elementname))[0]; + $selected = 'html, without links' if (!$selected); + # # Set package variables describing output mode $show_links = 'no'; @@ -447,7 +467,7 @@ sub CreateAndParseOutputSelector { foreach my $option (@OutputOptions) { $Str .= "\n".'