--- loncom/interface/statistics/lonstudentassessment.pm 2003/03/03 22:54:05 1.32 +++ loncom/interface/statistics/lonstudentassessment.pm 2003/10/07 14:38:30 1.70 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstudentassessment.pm,v 1.32 2003/03/03 22:54:05 matthew Exp $ +# $Id: lonstudentassessment.pm,v 1.70 2003/10/07 14:38:30 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -85,13 +85,25 @@ 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. + =cut ####################################################### ####################################################### my $show_links; my $output_mode; -my $show; +my $data; +my $base; +my $datadescription; +my $single_student_mode; ####################################################### ####################################################### @@ -126,27 +138,35 @@ Inputs: ####################################################### sub BuildStudentAssessmentPage { my ($r,$c)=@_; + undef($Statistics); + undef($show_links); + undef($output_mode); + undef($data); + undef($base); + undef($datadescription); + undef($single_student_mode); + + $single_student_mode = 0; + $single_student_mode = 1 if ($ENV{'form.SelectedStudent'}); + if ($ENV{'form.selectstudent'}) { + &Apache::lonstatistics::DisplayClasslist($r); + return; + } # # Print out the HTML headers for the interface # This also parses the output mode selector - # This step must always be done. + # This step must *always* be done. $r->print(&CreateInterface()); $r->print(''); + $r->print(''); $r->rflush(); - if (! exists($ENV{'form.notfirstrun'})) { - $r->print(< - -Please make your selections in the boxes above and hit -the button marked "Update Display". - -

-ENDMSG + # + if (! exists($ENV{'form.notfirstrun'}) && ! $single_student_mode) { return; } # - # my $initialize = \&html_initialize; my $output_student = \&html_outputstudent; my $finish = \&html_finish; @@ -163,9 +183,29 @@ ENDMSG # if($c->aborted()) { return ; } # + # Determine which students we want to look at + my @Students; + if ($single_student_mode) { + @Students = (&Apache::lonstatistics::current_student()); + $r->print(&next_and_previous_buttons()); + $r->rflush(); + } else { + @Students = @Apache::lonstatistics::Students; + } + # + # Perform generic initialization tasks + # Since we use lonnet::EXT to retrieve problem weights, + # to ensure current data we must clear the caches out. + # This makes sure that parameter changes at the student level + # 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); - foreach my $student (@Apache::lonstatistics::Students) { + foreach my $student (@Students) { if($c->aborted()) { $finish->($r); return ; @@ -181,6 +221,54 @@ ENDMSG ####################################################### ####################################################### +sub next_and_previous_buttons { + my $Str = ''; + $Str .= ''; + # + # Build the previous student link + my $previous = &Apache::lonstatistics::previous_student(); + my $previousbutton = ''; + if (defined($previous)) { + my $sname = $previous->{'username'}.':'.$previous->{'domain'}; + $previousbutton .= ''; + } else { + $previousbutton .= ''; + } + # + # Build the next student link + my $next = &Apache::lonstatistics::next_student(); + my $nextbutton = ''; + if (defined($next)) { + my $sname = $next->{'username'}.':'.$next->{'domain'}; + $nextbutton .= ''; + } else { + $nextbutton .= ''; + } + # + # Build the 'all students' button + my $all = ''; + $all .= ''; + $Str .= $previousbutton.(' 'x5).$all.(' 'x5).$nextbutton; + return $Str; +} + +####################################################### +####################################################### sub get_student_fields_to_show { my @to_show = @Apache::lonstatistics::SelectedStudentData; @@ -193,19 +281,6 @@ sub get_student_fields_to_show { return @to_show; } -sub get_sequences_to_show { - my @Sequences; - foreach my $map_symb (@Apache::lonstatistics::SelectedMaps) { - foreach my $sequence (@Apache::lonstatistics::Sequences) { - next if ($sequence->{'symb'} ne $map_symb && $map_symb ne 'all'); - next if ($sequence->{'num_assess'} < 1); - push (@Sequences,$sequence); - } - } - return @Sequences; -} - - ####################################################### ####################################################### @@ -232,8 +307,14 @@ sub CreateInterface { $Str .= ''; $Str .= 'Sections'; $Str .= 'Student Data'; + $Str .= 'Enrollment Status'; $Str .= 'Sequences and Folders'; - $Str .= 'Output Format'; + $Str .= 'Output Format'. + &Apache::loncommon::help_open_topic("Chart_Output_Formats"). + ''; + $Str .= 'Output Data'. + &Apache::loncommon::help_open_topic("Chart_Output_Data"). + ''; $Str .= ''."\n"; # $Str .= ''."\n"; @@ -250,12 +331,24 @@ sub CreateInterface { $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 .= ''."\n"; $Str .= &CreateAndParseOutputSelector(); + $Str .= ''."\n"; + $Str .= &CreateAndParseOutputDataSelector(); $Str .= ''."\n"; $Str .= ''."\n"; + $Str .= ''; + $Str .= ' 'x5; + $Str .= ''; + $Str .= ' 'x5; + $Str .= ''; + $Str .= ' 'x5; + $Str .= '
'; return $Str; } @@ -273,39 +366,62 @@ sub CreateInterface { my @OutputOptions = ({ name => 'HTML, with links', value => 'html, with links', - description => ''}, + description => 'Output HTML with each symbol linked to the problem '. + 'which generated it.', + mode => 'html', + show_links => 'yes', + }, + { name => 'HTML, with all links', + value => 'html, with all links', + description => 'Output HTML with each symbol linked to the problem '. + 'which generated it. '. + 'This includes links for unattempted problems.', + mode => 'html', + show_links => 'all', + }, { name => 'HTML, without links', value => 'html, without links', - description => ''}, - { name => 'HTML, totals', - value => 'html, totals', - description => ''}, - { name => 'HTML, scores only', - value => 'html, scores only', - description => ''}, - { name => 'Excel, totals', - value => 'excel, totals', - description => ''}, - { name => 'Excel, scores only', - value => 'excel, scores only', - description => ''}, - { name => 'CSV, totals', - value => 'csv, totals', - description => ''}, - { name => 'CSV, scores only', - value => 'csv, scores only', - description => ''}, - { name => 'CSV, everything', - value => 'csv, everything', - description => ''} + description => 'Output HTML. By not including links, the size of the'. + ' web page is greatly reduced. If your browser crashes on the '. + 'full display, try this.', + mode => 'html', + show_links => 'no', + }, + { name => 'Excel', + value => 'excel', + description => 'Output an Excel file (compatable with Excel 95).', + mode => 'excel', + show_links => 'no', + }, + { name => 'CSV', + value => 'csv', + description => 'Output a comma seperated 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.', + mode => 'csv', + show_links => 'no', + }, ); +sub OutputDescriptions { + my $Str = ''; + $Str .= "

Output Formats

\n"; + $Str .= "
\n"; + foreach my $outputmode (@OutputOptions) { + $Str .="
".$outputmode->{'name'}."
\n"; + $Str .="
".$outputmode->{'description'}."
\n"; + } + $Str .= "
\n"; + return $Str; +} + sub CreateAndParseOutputSelector { my $Str = ''; - my $elementname = 'outputmode'; + my $elementname = 'chartoutputmode'; # # Format for output options is 'mode, restrictions'; - my $selected = 'html, with links'; + my $selected = 'html, without links'; if (exists($ENV{'form.'.$elementname})) { if (ref($ENV{'form.'.$elementname} eq 'ARRAY')) { $selected = $ENV{'form.'.$elementname}->[0]; @@ -317,26 +433,12 @@ sub CreateAndParseOutputSelector { # Set package variables describing output mode $show_links = 'no'; $output_mode = 'html'; - $show = 'all'; - my ($mode,$restriction) = split(',',$selected); - $restriction =~ s/^\s*//; - if ($mode =~ /^(html|excel|csv)$/) { - $output_mode = $mode; - } else { - $output_mode = 'html'; - } - if ($restriction eq 'with links') { - $show_links = 'yes'; - } else { - $show_links = 'no'; - } - if ($restriction eq 'totals') { - $show = 'totals'; - } elsif ($restriction eq 'scores only') { - $show = 'scores'; - } else { - $show = 'everything'; + foreach my $option (@OutputOptions) { + next if ($option->{'value'} ne $selected); + $output_mode = $option->{'mode'}; + $show_links = $option->{'show_links'}; } + # # Build the form element $Str = qq//; + foreach my $option (@OutputDataOptions) { + $Str .= "\n".'