Diff for /loncom/interface/statistics/lonstudentsubmissions.pm between versions 1.63.2.3 and 1.64

version 1.63.2.3, 2011/11/22 01:34:39 version 1.64, 2011/11/18 21:08:22
Line 30  use strict; Line 30  use strict;
 use Apache::lonnet;  use Apache::lonnet;
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::lonhtmlcommon();  use Apache::lonhtmlcommon();
   use Apache::lonquickgrades();
 use Apache::loncoursedata();  use Apache::loncoursedata();
 use Apache::lonstatistics;  use Apache::lonstatistics;
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::lonstathelpers;  use Apache::lonstathelpers;
 use Apache::lonmsgdisplay();  
 use HTML::Entities();  use HTML::Entities();
 use Time::Local();  use Time::Local();
 use Spreadsheet::WriteExcel();  use Spreadsheet::WriteExcel();
Line 62  sub BuildStudentSubmissionsPage { Line 62  sub BuildStudentSubmissionsPage {
     #      #
     &Apache::lonstatistics::PrepareClasslist();      &Apache::lonstatistics::PrepareClasslist();
     #      #
       $r->print( &Apache::lonhtmlcommon::breadcrumbs('Student Submission Reports'));
       &Apache::lonquickgrades::startGradeScreen($r,'statistics');
     $r->print(&CreateInterface());      $r->print(&CreateInterface());
     #      #
     my @Students = @Apache::lonstatistics::Students;      my @Students = @Apache::lonstatistics::Students;
Line 322  sub prepare_html_output { Line 324  sub prepare_html_output {
     my @extra_resp_headers = &get_extra_response_headers($show_named);      my @extra_resp_headers = &get_extra_response_headers($show_named);
     #      #
     # Create the table header      # Create the table header
     my @student_columns = &get_student_columns($show_named);      my @student_columns;
       if ($show_named) {
           @student_columns = @Apache::lonstatistics::SelectedStudentData;
           if (grep(/^all$/,@student_columns)) {
               @student_columns = qw(fullname username domain id section status groups comments);
           }
       } else {
           @student_columns = ('username');
       }
       #
     my %headers;      my %headers;
     my $student_column_count = scalar(@student_columns);      my $student_column_count = scalar(@student_columns);
     $headers{'problem'} = qq{<th colspan="$student_column_count">\&nbsp;</th>};      $headers{'problem'} = qq{<th colspan="$student_column_count">\&nbsp;</th>};
     foreach my $field (@student_columns) {      foreach (@student_columns) {
         $headers{'student'}.= '<th>'.ucfirst($field).'</th>';          $headers{'student'}.= '<th>'.ucfirst($_).'</th>';
     }      }
     #      #
     # we put the headers into the %headers hash      # we put the headers into the %headers hash
     my $total_col = $student_column_count;      my $total_col = scalar(@student_columns);
     my $nonempty_part_headers = 0;      my $nonempty_part_headers = 0;
     #      #
     my %problem_analysis;      my %problem_analysis;
Line 828  sub prepare_excel_output { Line 839  sub prepare_excel_output {
     $worksheet->write($partid_row,0,'Part ID',$format->{'bold'});      $worksheet->write($partid_row,0,'Part ID',$format->{'bold'});
     $worksheet->write($respid_row,0,'Response ID',$format->{'bold'});      $worksheet->write($respid_row,0,'Response ID',$format->{'bold'});
     # Student headers      # Student headers
     my @StudentColumns = &get_student_columns($show_named);      my @StudentColumns;
     foreach my $field (@StudentColumns) {      if ($show_named) {
         $worksheet->write($header_row,$cols_output++,ucfirst($field),          @StudentColumns = qw(username domain id section);
       } else {
            @StudentColumns = qw(username);
       }
       foreach (@StudentColumns) {
           $worksheet->write($header_row,$cols_output++,ucfirst($_),
                           $format->{'bold'});                            $format->{'bold'});
     }      }
     # Problem headers      # Problem headers
Line 940  sub prepare_excel_output { Line 956  sub prepare_excel_output {
             my $cols = 0;              my $cols = 0;
             foreach my $field (@StudentColumns) {              foreach my $field (@StudentColumns) {
                 if ($show_named) {                  if ($show_named) {
                     my $value = $student->{$field};                      $worksheet->write($row,$cols++,
                     if ($field eq 'comments') {                                        $student->{$field});
                         $value = &Apache::lonmsgdisplay::retrieve_instructor_comments  
                                  ($student->{'username'},$student->{'domain'});  
                     }  
                     $worksheet->write($row,$cols++,$value);  
                 } else {                  } else {
                     $worksheet->write($row,$cols++,                      $worksheet->write($row,$cols++,
                                       &mt('Anonymized'));                                        &mt('Anonymized'));
Line 1094  sub prepare_csv_output { Line 1106  sub prepare_csv_output {
     my @extra_resp_headers = &get_extra_response_headers($show_named);      my @extra_resp_headers = &get_extra_response_headers($show_named);
     #      #
     # Create the table header      # Create the table header
     my @student_columns = &get_student_columns($show_named);      my @student_columns = ('username','domain','id','section');
       if ($show_named) {
           @student_columns = qw(username domain id section);
       } else {
           @student_columns = qw(username);
       }
     my $student_column_count = scalar(@student_columns);      my $student_column_count = scalar(@student_columns);
     #      #
     my %headers;      my %headers;
Line 1107  sub prepare_csv_output { Line 1124  sub prepare_csv_output {
     # we put the headers into the %headers hash      # we put the headers into the %headers hash
     my %problem_analysis;      my %problem_analysis;
     my %start_col;      my %start_col;
     my $max_column = $student_column_count;      my $max_column = scalar(@student_columns);
     foreach my $prob (@$problems) {      foreach my $prob (@$problems) {
         my $symb = $prob->symb();          my $symb = $prob->symb();
         my %analysis = &Apache::lonstathelpers::get_problem_data($prob->src);          my %analysis = &Apache::lonstathelpers::get_problem_data($prob->src);
Line 1198  sub prepare_csv_output { Line 1215  sub prepare_csv_output {
         foreach my $row (@rows) {          foreach my $row (@rows) {
             my $student_row_data = '';              my $student_row_data = '';
             if ($show_named) {              if ($show_named) {
                 foreach my $field (@student_columns) {                  $student_row_data = '"'.join('","',
                     my $value = $student->{$field};                                          map { $student->{$_}; }
                     if ($field eq 'comments') {                                          @student_columns).'"';
                         $value = &Apache::lonmsgdisplay::retrieve_instructor_comments  
                                  ($student->{'username'},$student->{'domain'});  
                     }  
                     $student_row_data .= '"'.&Apache::loncommon::csv_translate($value).'",';  
                 }  
                 $student_row_data =~ s/,$//;  
             } else {              } else {
                 $student_row_data = '"'.&mt('Anonymized').'"';                  $student_row_data = '"'.&mt('Anonymized').'"';
             }              }
Line 1265  sub CreateInterface { Line 1276  sub CreateInterface {
     ##      ##
     ## Environment variable initialization      ## Environment variable initialization
     my $Str = '';      my $Str = '';
     $Str .= &Apache::lonhtmlcommon::breadcrumbs('Student Submission Reports');  
     $Str .= '<br />';      $Str .= '<br />';
     $Str .= &Apache::loncommon::start_data_table();      $Str .= &Apache::loncommon::start_data_table();
     $Str .= &Apache::loncommon::start_data_table_header_row();      $Str .= &Apache::loncommon::start_data_table_header_row();
Line 1354  sub CreateInterface { Line 1364  sub CreateInterface {
     return $Str;      return $Str;
 }  }
   
 sub get_student_columns {  
     my ($show_named) = @_;  
     my @student_columns;  
     if ($show_named) {  
         @student_columns = @Apache::lonstatistics::SelectedStudentData;  
         if (grep(/^all$/,@student_columns)) {  
             @student_columns = qw(fullname username domain id section status groups comments);  
         }  
     } else {  
         @student_columns = ('username');  
     }  
     return @student_columns;  
 }  
   
 1;  1;
   
 __END__  __END__

Removed from v.1.63.2.3  
changed lines
  Added in v.1.64


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>
500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.