--- loncom/interface/statistics/lonstudentassessment.pm 2003/03/04 16:10:09 1.34 +++ loncom/interface/statistics/lonstudentassessment.pm 2003/05/29 21:38:32 1.49 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstudentassessment.pm,v 1.34 2003/03/04 16:10:09 matthew Exp $ +# $Id: lonstudentassessment.pm,v 1.49 2003/05/29 21:38:32 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -85,6 +85,9 @@ my $Statistics; =item $show 'all', 'totals', or 'scores' determines how much data is output +=item $single_student_mode evaluates to true if we are showing only one +student. + =cut ####################################################### @@ -92,6 +95,7 @@ my $Statistics; my $show_links; my $output_mode; my $show; +my $single_student_mode; ####################################################### ####################################################### @@ -127,17 +131,20 @@ Inputs: sub BuildStudentAssessmentPage { my ($r,$c)=@_; undef($Statistics); + $single_student_mode = 1 if ($ENV{'form.SelectedStudent'}); # # Print out the HTML headers for the interface # This also parses the output mode selector # This step must always be done. $r->print(&CreateInterface()); $r->print(''); + $r->print(''); $r->rflush(); - if (! exists($ENV{'form.notfirstrun'})) { + if (! exists($ENV{'form.notfirstrun'}) && ! $single_student_mode) { $r->print(< - + Please make your selections in the boxes above and hit the button marked "Update Display". @@ -156,6 +163,10 @@ ENDMSG $initialize = \&excel_initialize; $output_student = \&excel_outputstudent; $finish = \&excel_finish; +# } elsif ($output_mode eq 'multi-sheet excel') { +# $initialize = \&multi_sheet_excel_initialize; +# $output_student = \&multi_sheet_excel_outputstudent; +# $finish = \&multi_sheet_excel_finish; } elsif ($output_mode eq 'csv') { $initialize = \&csv_initialize; $output_student = \&csv_outputstudent; @@ -164,9 +175,19 @@ 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; + } + # # Call the initialize routine selected above $initialize->($r); - foreach my $student (@Apache::lonstatistics::Students) { + foreach my $student (@Students) { if($c->aborted()) { $finish->($r); return ; @@ -182,6 +203,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; @@ -194,19 +263,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; -} - - ####################################################### ####################################################### @@ -233,6 +289,7 @@ sub CreateInterface { $Str .= ''; $Str .= 'Sections'; $Str .= 'Student Data'; + $Str .= 'Enrollment Status'; $Str .= 'Sequences and Folders'; $Str .= 'Output Format'; $Str .= ''."\n"; @@ -251,6 +308,8 @@ 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"; @@ -275,47 +334,114 @@ my @OutputOptions = ({ name => 'HTML, with links', value => 'html, with links', description => 'Output HTML with each symbol linked to the problem '. - 'which generated it.'}, + 'which generated it.', + mode => 'html', + show => 'all', + 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 => 'all', + show_links => 'all', + }, { name => 'HTML, without links', value => 'html, without links', 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.'}, + 'full display, try this.', + mode => 'html', + show => 'all', + show_links => 'no', + }, { name => 'HTML, scores only', value => 'html, scores only', description => 'Output HTML, only showing the total number of correct'. ' problems (or problem parts) and not the maximum possible for '. - 'each student'}, + 'each student', + mode => 'html', + show => 'scores', + show_links => 'no', + }, { name => 'HTML, totals', value => 'html, totals', description => 'Output HTML, but only the summary statistics for each'. - ' sequence selected.'}, + ' sequence selected for each student.', + mode => 'html', + show => 'totals', + show_links => 'no', + }, + { name => 'HTML, summary table only', + value => 'html summary table only', + description => 'Output HTML, but only the final summary table for '. + 'all students across all sequences.', + mode => 'html', + show => 'final table', + show_links => 'no', + }, { name => 'Excel, scores only', value => 'excel, scores only', description => 'Output an Excel file (compatable with Excel 95), '. 'with a single column for each sequence showing the students '. - 'score.'}, -# { name => 'Excel, everything', -# value => 'excel, everything', -# description => 'Output an Excel file (compatable with Excel 95), '. -# 'with a seperate worksheet for each sequence you have selected '. -# 'the data for each problem part '. -# '(number of tries, status, points awarded) '. -# 'will be listed.'}, + 'score.', + mode => 'excel', + show => 'scores', + show_links => 'no', + }, { name => 'Excel, totals', value => 'excel, totals', description => 'Output an Excel file (compatable with Excel 95), '. 'with two columns for each sequence, the students score on the '. - 'sequence and the students maximum possible on the sequence'}, + 'sequence and the students maximum possible on the sequence', + mode => 'excel', + show => 'totals', + show_links => 'no', + }, +# { name => 'multi-sheet Excel', +# value => 'multi-sheet excel', +# description => 'Output an Excel file (compatable with Excel 95), '. +# 'with a seperate worksheet for each sequence you have selected '. +# 'the data for each problem part '. +# '(number of tries, status, points awarded) will be listed.', +# mode => 'multi-sheet excel', +# show => 'totals', +# show_links => 'no', +# }, +# { name => 'multi-sheet Excel, by section', +# value => 'multi-sheet excel, by section', +# description => 'Output an Excel file (compatable with Excel 95), '. +# 'with a seperate worksheet for each sequence you have selected '. +# 'the data for each problem part '. +# '(number of tries, status, points awarded) will be listed. '. +# 'There will be one Excel workbook for each section selected.', +# mode => 'multi-sheet excel', +# show => 'by section', +# show_links => 'no', +# }, { name => 'CSV, everything', value => 'csv, everything', - description => ''}, + description => '', + mode => 'csv', + show => 'all', + show_links => 'no', + }, { name => 'CSV, scores only', value => 'csv, scores only', - description => ''}, + description => '', + mode => 'csv', + show => 'scores', + show_links => 'no', + }, { name => 'CSV, totals', value => 'csv, totals', - description => ''}, + description => '', + mode => 'csv', + show => 'totals', + show_links => 'no', + }, ); sub OutputDescriptions { @@ -332,7 +458,7 @@ sub OutputDescriptions { sub CreateAndParseOutputSelector { my $Str = ''; - my $elementname = 'outputmode'; + my $elementname = 'chartoutputmode'; # # Format for output options is 'mode, restrictions'; my $selected = 'html, with links'; @@ -348,25 +474,13 @@ sub CreateAndParseOutputSelector { $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 = $option->{'show'}; + $show_links = $option->{'show_links'}; } + # # Build the form element $Str = qq/