--- loncom/interface/statistics/lonstudentassessment.pm 2003/03/04 14:21:36 1.33
+++ loncom/interface/statistics/lonstudentassessment.pm 2003/11/11 22:14:28 1.74
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonstudentassessment.pm,v 1.33 2003/03/04 14:21:36 matthew Exp $
+# $Id: lonstudentassessment.pm,v 1.74 2003/11/11 22:14:28 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,28 +138,46 @@ Inputs:
#######################################################
sub BuildStudentAssessmentPage {
my ($r,$c)=@_;
+ #
undef($Statistics);
+ undef($show_links);
+ undef($output_mode);
+ undef($data);
+ undef($base);
+ undef($datadescription);
+ 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'});
+ 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
-# $r->print(&OutputDescriptions());
+ #
+ if (! exists($ENV{'form.notfirstrun'}) && ! $single_student_mode) {
return;
}
#
- #
my $initialize = \&html_initialize;
my $output_student = \&html_outputstudent;
my $finish = \&html_finish;
@@ -164,9 +194,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 ;
@@ -182,6 +232,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 +292,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,8 +318,14 @@ sub CreateInterface {
$Str .= '
'."\n";
$Str .= ''."\n";
+ $Str .= '';
+ $Str .= ' 'x5;
+ $Str .= '';
+ $Str .= ' 'x5;
+ $Str .= '';
+ $Str .= ' 'x5;
+ $Str .= ' ';
return $Str;
}
@@ -275,52 +378,46 @@ 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_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 => '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.'},
- { 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'},
- { name => 'HTML, totals',
- value => 'html, totals',
- description => 'Output HTML, but only the summary statistics for each'.
- ' sequence selected.'},
- { 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.'},
- { 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'},
- { name => 'CSV, everything',
- value => 'csv, everything',
- description => ''},
- { name => 'CSV, scores only',
- value => 'csv, scores only',
- description => ''},
- { name => 'CSV, totals',
- value => 'csv, totals',
- description => ''},
+ '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 Modes
\n";
+ $Str .= "
Output Formats
\n";
$Str .= "
\n";
foreach my $outputmode (@OutputOptions) {
$Str .="
".$outputmode->{'name'}."
\n";
@@ -332,10 +429,12 @@ sub OutputDescriptions {
sub CreateAndParseOutputSelector {
my $Str = '';
- my $elementname = 'outputmode';
+ my $elementname = 'chartoutputmode';
+ &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
+ [$elementname]);
#
# 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];
@@ -347,26 +446,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/