'."\n";
- $Str .= &Apache::lonhtmlcommon::CreateHeadings($cache,
- $sequenceKeys,
- $sequenceHeadings,
- $displayString,
- 'preformatted');
+=item $show 'all' or 'totals' determines how much data is output
- $Str .= '
Total Solved/Total Problems
';
- $Str .= '
'."\n";
+=cut
- return $Str;
-}
+#######################################################
+#######################################################
+my $show_links;
+my $output_mode;
+my $show;
+
+#######################################################
+#######################################################
+# End of package variable declarations
=pod
-=item &FormatStudentData()
+=back
-First, FormatStudentInformation is called and prefixes the course information.
-This function produces a formatted string of the student\'s course information.
-Each column of data represents all the problems for a given sequence. For
-valid grade data, a link is created for that problem to a submission record
-for that problem.
+=cut
-=over 4
+#######################################################
+#######################################################
-Input: $name, $studentInformation, $ChartDB
+=pod
-$name: The name and domain of the current student in name:domain format
+=item &BuildStudentAssessmentPage()
-$studentInformation: A pointer to an array holding the names used to
-remove data from the hash. They represent
-the name of the data to be removed.
+Inputs:
-$ChartDB: The name of the cached data database which will be tied to that
-database.
+=over 4
-Output: $Str
+=item $r Apache Request
-$Str: Formatted string that is an entire row of the chart. It is a
-concatenation of student information and student course information.
+=item $c Apache Connection
=back
=cut
-sub StudentReport {
- my ($cache,$name,$spacing,$showSequences)=@_;
- my ($username,$domain)=split(':',$name);
-
- my $Str = '';
- if(defined($cache->{$name.':error'})) {
- return $Str;
+#######################################################
+#######################################################
+sub BuildStudentAssessmentPage {
+ my ($r,$c)=@_;
+ undef($Statistics);
+ #
+ # 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->rflush();
+ if (! exists($ENV{'form.notfirstrun'})) {
+ $r->print(<
+
+Please make your selections in the boxes above and hit
+the button marked "Update Display".
+
+
+ENDMSG
+ return;
}
- if($cache->{$name.':error'} =~ /course/) {
- $Str .= 'No course data for student ';
- $Str .= ''.$username.'. ';
- return $Str;
- }
-
- my $hasVersion = 'false';
- my $hasFinalData = 'false';
- foreach my $sequence (@$showSequences) {
- my $hasData = 'false';
- my $characterCount=0;
- foreach my $problemID (split(':', $cache->{$sequence.':problems'})) {
- my $problem = $cache->{$problemID.':problem'};
- # All grades (except for versionless parts) are displayed as links
- # to their submission record. Loop through all the parts for the
- # current problem in the correct order and prepare the output links
- foreach(split(/\:/,$cache->{$sequence.':'.$problemID.
- ':parts'})) {
- if($cache->{$name.':'.$problemID.':NoVersion'} eq 'true' ||
- $cache->{$name.':'.$problemID.':'.$_.':code'} eq ' ' ||
- $cache->{$name.':'.$problemID.':'.$_.':code'} eq '') {
- $Str .= ' ';
- $characterCount++;
- next;
- }
- $hasVersion = 'true';
- $hasData = 'true';
- if (lc($ENV{'form.displaymode'}) ne 'display without links') {
- $Str .= '';
- }
- my $code = $cache->{$name.':'.$problemID.':'.$_.':code'};
- my $tries = $cache->{$name.':'.$problemID.':'.$_.':tries'};
- if($code eq '*' && $tries < 10 && $tries ne '') {
- $code = $tries;
- }
- $Str .= $code;
- if (lc($ENV{'form.displaymode'}) ne 'display without links') {
- $Str .= '';
- }
- $characterCount++;
- }
+ #
+ #
+ my $initialize = \&html_initialize;
+ my $output_student = \&html_outputstudent;
+ my $finish = \&html_finish;
+ #
+ if ($output_mode eq 'excel') {
+ $initialize = \&excel_initialize;
+ $output_student = \&excel_outputstudent;
+ $finish = \&excel_finish;
+ } elsif ($output_mode eq 'csv') {
+ $initialize = \&csv_initialize;
+ $output_student = \&csv_outputstudent;
+ $finish = \&csv_finish;
+ }
+ #
+ if($c->aborted()) { return ; }
+ #
+ # Call the initialize routine selected above
+ $initialize->($r);
+ foreach my $student (@Apache::lonstatistics::Students) {
+ if($c->aborted()) {
+ $finish->($r);
+ return ;
}
+ # Call the output_student routine selected above
+ $output_student->($r,$student);
+ }
+ # Call the "finish" routine selected above
+ $finish->($r);
+ #
+ return;
+}
- # Output the number of correct answers for the current sequence.
- # This part takes up 6 character slots, but is formated right
- # justified.
- my $spacesNeeded=$cache->{$sequence.':columnWidth'}-$characterCount;
- $spacesNeeded -= 3;
- $Str .= (' 'x$spacesNeeded);
-
-# my $outputProblemsCorrect = sprintf("%3d", $cache->{$name.':'.$sequence.
-# ':problemsCorrect'});
-
- my $outputProblemsCorrect = sprintf("%2d/%2d", $cache->{$name.':'.$sequence.
- ':problemsCorrect'},
- $characterCount);
- if($hasData eq 'true') {
- $Str .= ''.$outputProblemsCorrect.'';
- $hasFinalData = 'true';
- } else {
- $Str .= ' ';
+#######################################################
+#######################################################
+
+sub get_student_fields_to_show {
+ my @to_show = @Apache::lonstatistics::SelectedStudentData;
+ foreach (@to_show) {
+ if ($_ eq 'all') {
+ @to_show = @Apache::lonstatistics::StudentDataOrder;
+ last;
}
- $Str .= $spacing;
}
+ return @to_show;
+}
- # Output the total correct problems over the total number of problems.
- # I don't like this type of formatting, but it is a solution. Need
- # a way to dynamically determine the space requirements.
- my $outputProblemsSolved = sprintf("%4d", $cache->{$name.':problemsSolved'});
- my $outputTotalProblems = sprintf("%4d", $cache->{$name.':totalProblems'});
- if($hasFinalData eq 'true') {
- $Str .= ''.$outputProblemsSolved.
- ' / '.$outputTotalProblems.'';
- } else {
- $Str .= ' ';
+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;
+}
- if($hasVersion eq 'false') {
- $Str = 'No course data.';
- }
- return $Str;
-}
+#######################################################
+#######################################################
+=pod
-sub StudentAverageTotal {
-
- return "";
+=item &CreateInterface()
+
+Called by &BuildStudentAssessmentPage to create the top part of the
+page which displays the chart.
+
+Inputs: None
+
+Returns: A string containing the HTML for the headers and top table for
+the chart page.
- my ($cache,$name,$spacing,$showSequences)=@_;
- my $username = $name;
+=cut
+
+#######################################################
+#######################################################
+sub CreateInterface {
my $Str = '';
- my $hasVersion = 'false';
- my $hasFinalData = 'false';
- foreach my $sequence (@$showSequences) {
- my $hasData = 'false';
- my $characterCount=0;
- foreach my $problemID (split(':', $cache->{$sequence.':problems'})) {
- my $problem = $cache->{$problemID.':problem'};
- # All grades (except for versionless parts) are displayed as links
- # to their submission record. Loop through all the parts for the
- # current problem in the correct order and prepare the output links
- foreach(split(/\:/,$cache->{$sequence.':'.$problemID.
- ':parts'})) {
- if($cache->{$name.':'.$problemID.':NoVersion'} eq 'true' ||
- $cache->{$name.':'.$problemID.':'.$_.':code'} eq ' ' ||
- $cache->{$name.':'.$problemID.':'.$_.':code'} eq '') {
- $Str .= ' ';
- $characterCount++;
- next;
- }
- $hasVersion = 'true';
- $hasData = 'true';
- $Str .= '';
- my $code = $cache->{$name.':'.$problemID.':'.$_.':code'};
- my $tries = $cache->{$name.':'.$problemID.':'.$_.':tries'};
- if($code eq '*' && $tries < 10 && $tries ne '') {
- $code = $tries;
- }
- $Str .= $code;
- $Str .= '';
- $characterCount++;
- }
+# $Str .= &CreateLegend();
+ $Str .= '