Diff for /loncom/interface/lonstatistics.pm between versions 1.125 and 1.142.2.1

version 1.125, 2005/10/04 18:27:32 version 1.142.2.1, 2008/12/12 17:11:27
Line 49  use Apache::Constants qw(:common :http); Line 49  use Apache::Constants qw(:common :http);
 use vars qw(  use vars qw(
     @FullClasslist       @FullClasslist 
     @Students      @Students
     @Sections       @Sections
       @Groups 
     %StudentData      %StudentData
     @StudentDataOrder      @StudentDataOrder
     @SelectedStudentData      @SelectedStudentData
Line 62  use Apache::loncoursedata; Line 63  use Apache::loncoursedata;
 use Apache::lonhtmlcommon;  use Apache::lonhtmlcommon;
 use Apache::lonmysql;  use Apache::lonmysql;
 use Apache::lonlocal;  use Apache::lonlocal;
   use Apache::longroup;
 use Time::HiRes;  use Time::HiRes;
 #  #
 # Statistics Packages  # Statistics Packages
Line 73  use Apache::lonstudentassessment(); Line 75  use Apache::lonstudentassessment();
 use Apache::lonpercentage;  use Apache::lonpercentage;
 use Apache::lonstudentsubmissions();  use Apache::lonstudentsubmissions();
 use Apache::lonsurveyreports();  use Apache::lonsurveyreports();
   use Apache::longradinganalysis();
   use LONCAPA;
   
 #######################################################  #######################################################
 #######################################################  #######################################################
Line 87  use Apache::lonsurveyreports(); Line 91  use Apache::lonsurveyreports();
   
 =item @Sections The sections available in this class  =item @Sections The sections available in this class
   
   =item @Groups The groups available in the class
   
 =item $curr_student The student currently being examined  =item $curr_student The student currently being examined
   
 =item $prev_student The student previous in the classlist  =item $prev_student The student previous in the classlist
Line 123  undef the following package variables: Line 129  undef the following package variables:
   
 =item @Sections  =item @Sections
   
   =item @Groups
   
 =item %StudentData  =item %StudentData
   
 =item @StudentDataOrder  =item @StudentDataOrder
Line 145  sub clear_classlist_variables { Line 153  sub clear_classlist_variables {
     undef(@FullClasslist);      undef(@FullClasslist);
     undef(@Students);      undef(@Students);
     undef(@Sections);      undef(@Sections);
       undef(@Groups);
     undef(%StudentData);      undef(%StudentData);
     undef(@SelectedStudentData);      undef(@SelectedStudentData);
     undef($curr_student);      undef($curr_student);
Line 170  the following package variables: Line 179  the following package variables:
   
 =item @Sections  =item @Sections
   
   =item @Groups 
   
 =item %StudentData  =item %StudentData
   
 =item @SelectedStudentData  =item @SelectedStudentData
Line 200  sub PrepareClasslist { Line 211  sub PrepareClasslist {
     my ($classlist,$field_names) = &Apache::loncoursedata::get_classlist($cdom,      my ($classlist,$field_names) = &Apache::loncoursedata::get_classlist($cdom,
  $cnum);   $cnum);
     my @selected_sections = &get_selected_sections();      my @selected_sections = &get_selected_sections();
       my @selected_groups = &get_selected_groups();
     #      #
     # Deal with instructors with restricted section access      # Deal with instructors with restricted section access
     if ($env{'request.course.sec'} !~ /^\s*$/) {      if ($env{'request.course.sec'} !~ /^\s*$/) {
Line 207  sub PrepareClasslist { Line 219  sub PrepareClasslist {
     }      }
     #      #
     # Set up %StudentData      # Set up %StudentData
     @StudentDataOrder = qw/fullname username domain id section status comments/;      @StudentDataOrder = qw/fullname username domain id section status groups comments/;
     foreach my $field (@StudentDataOrder) {      foreach my $field (@StudentDataOrder) {
         $StudentData{$field}->{'title'} = &mt($field);          $StudentData{$field}->{'title'} = &mt($field);
         $StudentData{$field}->{'base_width'} = length(&mt($field));          $StudentData{$field}->{'base_width'} = length(&mt($field));
Line 219  sub PrepareClasslist { Line 231  sub PrepareClasslist {
     $enrollment_status = 'Active';      $enrollment_status = 'Active';
     $enrollment_status = $env{'form.Status'} if (exists($env{'form.Status'}));      $enrollment_status = $env{'form.Status'} if (exists($env{'form.Status'}));
     #      #
       # Get groupmembership
       my ($classgroups,$studentgroups);
       my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum);
       if (%curr_groups) {
           ($classgroups,$studentgroups) = 
       &Apache::loncoursedata::get_group_memberships($classlist,
                                                             $field_names,
     $cdom,$cnum);
       }
       my $now = time;
   
     # Process the classlist      # Process the classlist
     while (my ($student,$student_data) = each (%$classlist)) {      while (my ($student,$student_data) = each (%$classlist)) {
         my $studenthash = ();          my $studenthash = ();
Line 233  sub PrepareClasslist { Line 256  sub PrepareClasslist {
                 $StudentData{$field}->{'width'} = $length;                   $StudentData{$field}->{'width'} = $length; 
             }              }
         }          }
           my @studentsgroups = &Apache::loncoursedata::get_students_groups
                                                      ($student,$enrollment_status,
                                                       $classgroups);
           if (@studentsgroups) {
               $studenthash->{'groups'} = join(', ',@studentsgroups);
               $studenthash->{'groupref'} = \@studentsgroups;
           } else {
               $studenthash->{'groups'} = 'none';
               $studenthash->{'groupref'} = []; 
           }
         push (@FullClasslist,$studenthash);          push (@FullClasslist,$studenthash);
         #          #
         # Build up a list of sections          # Build up a list of sections
Line 250  sub PrepareClasslist { Line 283  sub PrepareClasslist {
                  (($studenthash->{'status'} eq $enrollment_status) ||                    (($studenthash->{'status'} eq $enrollment_status) || 
                   ($enrollment_status eq 'Any'))                     ($enrollment_status eq 'Any')) 
                  ){                   ){
                 push (@Students,$studenthash);                  my $groupcheck = 0;
                 last;                  if (grep(/^all$/,@selected_groups)) {
                       push(@Students,$studenthash);
                       last;
                   } elsif (grep(/^none$/,@selected_groups)) {
                       if ($studenthash->{'groups'} eq 'none') {
                           push(@Students,$studenthash);
                           last;
                       }     
                   } else {
                       foreach my $group (@selected_groups) {
                           if (grep(/^$group$/,@studentsgroups)) {
                               push(@Students,$studenthash);
                               $groupcheck = 1;
                               last;
                           }
                       }
                       if ($groupcheck) {
                           last;
                       }
                   }
             }              }
         }          }
     }      }
Line 260  sub PrepareClasslist { Line 312  sub PrepareClasslist {
     if ($env{'request.course.sec'} !~ /^\s*$/) {      if ($env{'request.course.sec'} !~ /^\s*$/) {
         @Sections = ($env{'request.course.sec'});          @Sections = ($env{'request.course.sec'});
     } else {      } else {
         @Sections = sort {$a cmp $b} keys(%Sections);          @Sections = sort {
       if ($a == $a && $b == $b ) { return $a <=> $b; }
       return $a cmp $b;
    } keys(%Sections);
   
         unshift(@Sections,'all'); # Put 'all' at the front of the list          unshift(@Sections,'all'); # Put 'all' at the front of the list
     }      }
       # Sort the groups
       @Groups = sort {$a cmp $b} keys(%{$studentgroups});
       unshift(@Groups,'all'); # Put 'all' at the front of the list
   
     #      #
     # Sort the Students      # Sort the Students
     my $sortby = 'fullname';      my $sortby = 'fullname';
     $sortby = $env{'form.sort'} if (exists($env{'form.sort'}));      $sortby = $env{'form.sort'} if (exists($env{'form.sort'}));
     my @TmpStudents = sort { $a->{$sortby} cmp $b->{$sortby} ||      my @TmpStudents = sort { lc($a->{$sortby}) cmp lc($b->{$sortby}) ||
                              $a->{'fullname'} cmp $b->{'fullname'} } @Students;                               lc($a->{'fullname'}) cmp lc($b->{'fullname'}) ||
        lc($a->{'username'}) cmp lc($b->{'username'}) } @Students;
     @Students = @TmpStudents;      @Students = @TmpStudents;
     #       # 
     # Now deal with that current student thing....      # Now deal with that current student thing....
Line 345  sub get_selected_sections { Line 406  sub get_selected_sections {
   
 #######################################################  #######################################################
 #######################################################  #######################################################
                                                                                       
   =pod
                                                                                       
   =item get_selected_groups
                                                                                       
   Returns an array of the selected groups
                                                                                       
   =cut
                                                                                       
   #######################################################
   #######################################################
   sub get_selected_groups {
       my @selected_groups =
           &Apache::loncommon::get_env_multiple('form.Group');
       @selected_groups = ('all') if (! @selected_groups);
       foreach my $grp (@selected_groups) {
           if ($grp eq 'all') {
               @selected_groups = ('all');
               last;
           }
       }
       return @selected_groups;
   }
                                                                                       
 =pod  =pod
   
 =item &section_and_enrollment_description  =item &section_and_enrollment_description
   
 Returns a string describing the currenly selected section(s) and   Returns a string describing the currently selected section(s), group(s) and 
 enrollment status.    access status.  
   
 Inputs: mode = 'plaintext' or 'localized'  (defaults to 'localized')  Inputs: mode = 'plaintext' or 'localized'  (defaults to 'localized')
     'plaintext' is used for example in Excel spreadsheets.      'plaintext' is used for example in Excel spreadsheets.
Line 365  sub section_and_enrollment_description { Line 449  sub section_and_enrollment_description {
     my ($mode) = @_;      my ($mode) = @_;
     if (! defined($mode)) { $mode = 'localized'; }      if (! defined($mode)) { $mode = 'localized'; }
     my @sections = &Apache::lonstatistics::get_selected_sections();      my @sections = &Apache::lonstatistics::get_selected_sections();
       my @groups = &Apache::lonstatistics::get_selected_groups();
     my $description;      my $description;
     if ($mode eq 'localized') {      if ($mode eq 'localized') {
         $description = &mt('Unable to determine section and enrollment');          $description = &mt('Unable to determine section, groups and access status');
     } elsif ($mode eq 'plaintext') {      } elsif ($mode eq 'plaintext') {
         $description = 'Unable to determine section and enrollment';          $description = 'Unable to determine section, groups and access status';
     } else {      } else {
         $description = 'Bad parameter passed to lonstatistics::section_and_enrollment_description';          $description = 'Bad parameter passed to lonstatistics::section_and_enrollment_description';
         &Apache::lonnet::logthis($description);          &Apache::lonnet::logthis($description);
     }      }
     if (scalar(@sections) == 1 && $sections[0] ne 'all') {      $description = &section_or_group_text($mode,'section',@sections).
    ' '.&section_or_group_text($mode,'group',@groups);
       if ($mode eq 'localized') {
           $description .= ' '.&mt($env{'form.Status'}.' access status.');
       } elsif ($mode eq 'plaintext') {
           $description .= ' '.$env{'form.Status'}.' access status.';
       }
       return $description;
   }
   
   #######################################################
   #######################################################
   
   sub section_or_group_text {
       my ($mode,$type,@items) = @_;
       my $text;
       my %phrases = ();
       %{$phrases{'section'}} = (
                                 single => 'Section',
                                 all => 'All sections',
                                 plural => 'Sections',
                                );
       %{$phrases{'group'}} = (
                                 single => 'Group',
                                 all => 'All groups',
                                 plural => 'Groups',
                                );
       if (scalar(@items) == 1 && $items[0] ne 'all') {
         if ($mode eq 'localized') {          if ($mode eq 'localized') {
             $description = &mt('Section [_1]. [_2] enrollment status.',              $text = &mt($phrases{$type}{single}.' [_1].',$items[0]);
                                $sections[0],$env{'form.Status'});  
         } elsif ($mode eq 'plaintext') {          } elsif ($mode eq 'plaintext') {
             $description = 'Section '.$sections[0].'. '.              $text = $phrases{$type}{single}.' '.$items[0].'.';
                 $env{'form.Status'}.' enrollment status.';  
         }          }
     } elsif (scalar(@sections) && $sections[0] eq 'all') {      } elsif (scalar(@items) && $items[0] eq 'all') {
         if ($mode eq 'localized') {          if ($mode eq 'localized') {
             $description = &mt('All sections. [_1] enrollment status.',              $text = &mt($phrases{$type}{all}.'.');
                                $env{'form.Status'});  
         } elsif ($mode eq 'plaintext') {          } elsif ($mode eq 'plaintext') {
             $description = 'All sections. '.              $text = $phrases{$type}{all}.'.';
                 $env{'form.Status'}.' enrollment status.';  
         }          }
     } elsif (scalar(@sections)) {      } elsif (scalar(@items)) {
         my $lastsection = pop(@sections);          my $lastitem = pop(@items);
         if ($mode eq 'localized') {          if ($mode eq 'localized') {
             $description = &mt('Sections [_1] and [_2]. [_3] enrollment status.',              $text = &mt($phrases{$type}{plural}.' [_1] and [_2].',
                                join(', ',@sections),$lastsection,                          join(', ',@items),$lastitem);
                                $env{'form.Status'});  
         } elsif ($mode eq 'plaintext') {          } elsif ($mode eq 'plaintext') {
             $description =               $text = $phrases{$type}{plural}.' '.join(', ',@items).' and '.
                 'Sections '.join(', ',@sections).' and '.$lastsection.'. '.                      $lastitem.'.';
                 $env{'form.Status'}.' enrollment status.';  
         }          }
     }      }
     return $description;      return $text;
 }  }
   
 #######################################################  
 #######################################################  
   
 =pod  =pod
   
Line 602  sub selected_sequences_with_assessments Line 707  sub selected_sequences_with_assessments
     #      #
     my @sequences = $navmap->retrieveResources(undef,      my @sequences = $navmap->retrieveResources(undef,
                                                sub { shift->is_map(); },1,0,1);                                                 sub { shift->is_map(); },1,0,1);
       my $toplevelseq = $navmap->getById('0.0');
       if (!grep(/^\Q$toplevelseq\E$/,@sequences)) {
           unshift(@sequences,$toplevelseq);
       }
   
     my @sequences_with_assessments;      my @sequences_with_assessments;
     for my $sequence ($navmap->getById('0.0'), @sequences) {      foreach my $sequence (@sequences) {
  if ($navmap->hasResource($sequence,sub { shift->is_problem(); },0,1)){   if ($navmap->hasResource($sequence,sub { shift->is_problem(); },0,1)){
             push(@sequences_with_assessments,$sequence);              push(@sequences_with_assessments,$sequence);
         }          }
Line 756  sub SectionSelect { Line 866  sub SectionSelect {
     return $Str;      return $Str;
 }  }
   
   ##############################################
   ##############################################
                                                                                       
   =pod
                                                                                       
   =item &GroupSelect($elementname,$status,$numvisible)
                                                                                       
   Returns html for a selection box allowing the user to choose one (or more)
   of the groups in the course.
                                                                                       
   Uses the package variables @Groups
   =over 4
                                                                                       
   =item $elementname The name of the HTML form element
                                                                                       
   =item $status 'multiple' or 'single' selection box
                                                                                       
   =item $numvisible The number of options to be visible
                                                                                       
   =back
                                                                                       
   =cut
                                                                                       
   ##############################################
   ##############################################
   sub GroupSelect {
       my ($elementname,$status,$numvisible)=@_;
       if ($numvisible < 1) {
           return;
       }
       #
       # Make sure we have the data we need to continue
       if (! @Groups) {
           &PrepareClasslist();
       }
       #
       # Build the form element
       my $Str = "\n";
       $Str .= '<select name="'.$elementname.'" ';
       if ($status ne 'single') {
           $Str .= 'multiple="true" ';
       }
       $Str .= 'size="'.$numvisible.'" >'."\n";
       #
       # Loop through the groups
       foreach my $s (@Groups) {
           $Str .= '    <option value="'.$s.'" ';
           foreach my $group (&get_selected_groups()) {
               if ($s eq $group) {
                   $Str .= 'selected ';
                   last;
               }
           }
           $Str .= '>'.$s."</option>\n";
       }
       $Str .= "</select>\n";
   }
   
   
 ##################################################  ##################################################
 ##################################################  ##################################################
 sub DisplayClasslist {  sub DisplayClasslist {
Line 765  sub DisplayClasslist { Line 934  sub DisplayClasslist {
     #      #
     # Output some of the standard interface components      # Output some of the standard interface components
     my $Str;      my $Str;
     $Str .= &Apache::lonhtmlcommon::breadcrumbs(undef,'Select One Student');      $Str .= &Apache::lonhtmlcommon::breadcrumbs('Select One Student');
     $Str .= '<p><table cellspacing="5">'."\n";      $Str .= '<p><table cellspacing="5">'."\n";
     $Str .= '<tr>';      $Str .= '<tr>';
     $Str .= '<th align="center"><b>'.&mt('Sections').'</b></th>';      $Str .= '<th align="center"><b>'.&mt('Sections').'</b></th>';
     $Str .= '<th align="center"><b>'.&mt('Enrollment Status').'</b></th>';      $Str .= '<th align="center"><b>'.&mt('Groups').'</b></th>';
       $Str .= '<th align="center"><b>'.&mt('Access Status').'</b></th>';
     $Str .= '</tr>'.$/;      $Str .= '</tr>'.$/;
     $Str .= '<tr>';      $Str .= '<tr>';
     $Str .= '<td>'.      $Str .= '<td>'.
         &Apache::lonstatistics::SectionSelect('Section','multiple',5).          &Apache::lonstatistics::SectionSelect('Section','multiple',5).
         '</td>';          '</td>';
       $Str .=  '<td>'.
           &Apache::lonstatistics::GroupSelect('Group','multiple',5).
           '</td>';
     $Str .= '<td>'.      $Str .= '<td>'.
         &Apache::lonhtmlcommon::StatusOptions(undef,undef,5).          &Apache::lonhtmlcommon::StatusOptions(undef,undef,5).
         '</td>';          '</td>';
Line 786  sub DisplayClasslist { Line 959  sub DisplayClasslist {
     $r->print($Str);      $r->print($Str);
     $r->rflush();      $r->rflush();
     #      #
     my @Fields = ('fullname','username','domain','id','section','status');      my @Fields = ('fullname','username','domain','id','section','status','groups');
     #      #
     $Str = '';      $Str = '';
     my @selected_sections = &get_selected_sections();      my @selected_sections = &get_selected_sections();
     if (! @Students) {      if (! @Students) {
         if ($selected_sections[0] eq 'all') {           if ($selected_sections[0] eq 'all') { 
             if (lc($env{'form.Status'}) eq 'any') {              if (lc($env{'form.Status'}) eq 'active') {
                 $Str .= '<h2>'.                  $Str .= '<p class="LC_info">'.
                     &mt('There are no students in the course.').  
                     '</h2>';  
             } elsif (lc($env{'form.Status'}) eq 'active') {  
                 $Str .= '<h2>'.  
                 &mt('There are no currently enrolled students in the course.').                  &mt('There are no currently enrolled students in the course.').
                     '</h2>';                      '</p>';
             } elsif (lc($env{'form.Status'}) eq 'expired') {              } elsif (lc($env{'form.Status'}) eq 'expired') {
                 $Str .= '<h2>'.                  $Str .= '<p class="LC_info">'.
                     &mt('There are no previously enrolled students in the course.').                      &mt('There are no previously enrolled students in the course.').
                         '</h2>';                          '</p>';
               } elsif (lc($env{'form.Status'}) eq 'future') {
                   $Str .= '<p class="LC_info">'.
                       &mt('There are no students with future access in the course.').
                           '</p>';
               } else { # 'any' and any others
                  $Str .= '<p class="LC_info">'.
                       &mt('There are no students in the course.').
                       '</p>';
             }              }
         } else {           } else { 
             my $sections;              if (lc($env{'form.Status'}) eq 'active') {
             if (lc($env{'form.Status'}) eq 'any') {                  $Str .= '<p class="LC_info">'.
                 $Str .= '<h2>'.  
                     &mt('There are no students in the selected sections.').  
                     '</h2>';  
             } elsif (lc($env{'form.Status'}) eq 'active') {  
                 $Str .= '<h2>'.  
                     &mt('There are no currently enrolled students in the selected sections.').                      &mt('There are no currently enrolled students in the selected sections.').
                     '</h2>';                      '</p>';
             } elsif (lc($env{'form.Status'}) eq 'expired') {              } elsif (lc($env{'form.Status'}) eq 'expired') {
                 $Str .= '<h2>'.                  $Str .= '<p class="LC_info">'.
                     &mt('There are no previously enrolled students in the selected sections.').                      &mt('There are no previously enrolled students in the selected sections.').
                     '</h2>';                      '</p>';
               } elsif (lc($env{'form.Status'}) eq 'future') {
                   $Str .= '<p class="LC_info">'.
                       &mt('There are no students with future access in the selected sections.').
                           '</p>';
               } else { # 'any' and any others
                   $Str .= '<p class="LC_info">'.
                       &mt('There are no students in the selected sections.').
                       '</p>';
             }              }
         }          }
         $Str.= '<a href="/adm/statistics?reportSelected=student_assessment">'.          $Str.= '<p>'
             &mt('Click here to return to the chart').'</a>';                .'<a href="/adm/statistics?reportSelected=student_assessment">'
                 .&mt('Return to the chart').'</a>'
                 .'</p>';
         $r->print($Str);          $r->print($Str);
         $r->rflush();          $r->rflush();
         return;          return;
     }      }
   
     # "Click" is asinine but it is probably not my place to change the world.      $Str .= '<h2>'.&mt('Select One Student').'</h2>'
     $Str .= '<h2>Click on a students name or username to view their chart</h2>';             .'<p>'.&mt("Click on a student's name or username to view their chart").'</p>'
     $Str .= '<table border="0"><tr><td bgcolor="#777777">'."\n";             .&Apache::loncommon::start_data_table()
     $Str .= '<table border="0" cellpadding="3"><tr bgcolor="#e6ffff">'."\n";             .&Apache::loncommon::start_data_table_header_row();
     foreach my $field (@Fields) {      foreach my $field (@Fields) {
         $Str .= '<th><a href="/adm/statistics?'.          $Str .= '<th><a href="/adm/statistics?'.
             'reportSelected=student_assessment&'.              'reportSelected=student_assessment&'.
Line 839  sub DisplayClasslist { Line 1021  sub DisplayClasslist {
             'sort='.$field.'">'.&mt($field).              'sort='.$field.'">'.&mt($field).
             '</a></th>';              '</a></th>';
     }      }
     $Str .= '</tr>'."\n";      $Str .= &Apache::loncommon::end_data_table_header_row();
     #      #
     my $alternate = 0;  
     foreach my $student (@Students) { # @Students is a package variable      foreach my $student (@Students) { # @Students is a package variable
         my $sname = $student->{'username'}.':'.$student->{'domain'};          my $sname = $student->{'username'}.':'.$student->{'domain'};
         if($alternate) {          $Str .= &Apache::loncommon::start_data_table_row();
             $Str .= '<tr bgcolor="#ffffe6">';  
         } else {  
             $Str .= '<tr bgcolor="#ffffc6">';  
         }  
         $alternate = ($alternate + 1) % 2;  
         #          #
         foreach my $field (@Fields) {          foreach my $field (@Fields) {
             $Str .= '<td>';              $Str .= '<td>';
             if ($field eq 'fullname' || $field eq 'username') {              if ($field eq 'fullname' || $field eq 'username') {
                 $Str .= '<a href="/adm/statistics?reportSelected=';                  $Str .= '<a href="/adm/statistics?reportSelected=';
                 $Str .= &Apache::lonnet::escape('student_assessment');                  $Str .= &escape('student_assessment');
                 $Str .= '&sort='.&Apache::lonnet::escape($env{'form.sort'});                  $Str .= '&sort='.&escape($env{'form.sort'});
                 $Str .= '&SelectedStudent=';                  $Str .= '&SelectedStudent=';
                 $Str .= &Apache::lonnet::escape($sname).'">';                  $Str .= &escape($sname).'">';
                 $Str .= $student->{$field}.'&nbsp';                  $Str .= $student->{$field}.'&nbsp;';
                 $Str .= '</a>';                  $Str .= '</a>';
             } elsif ($field eq 'status') {              } elsif ($field eq 'status') {
                 $Str .= &mt($student->{$field});                  $Str .= &mt($student->{$field});
Line 868  sub DisplayClasslist { Line 1044  sub DisplayClasslist {
             }              }
             $Str .= '</td>';              $Str .= '</td>';
         }          }
         $Str .= "</tr>\n";          $Str .= &Apache::loncommon::end_data_table_row();
     }      }
     $Str .= '</table></td></tr></table>'."\n";      $Str .= &Apache::loncommon::end_data_table();
     #      #
     $r->print($Str);      $r->print($Str);
     $r->rflush();      $r->rflush();
Line 913  sub CreateMainMenu { Line 1089  sub CreateMainMenu {
                      short_description =>                        short_description => 
     &mt('Display a histogram of student performance in the course.'),      &mt('Display a histogram of student performance in the course.'),
                  },                   },
   #                   { internal_name => 'grading_analysis',
   #                     name => &mt('Detailed Grading Analysis'),
   #                     short_description => 
   #    &mt('Display statistics about who graded who.'),
   #                 },
 #                   { internal_name => 'student_assessment',  #                   { internal_name => 'student_assessment',
 #                     name => &mt('Problem Status Chart'),  #                     name => &mt('Problem Status Chart'),
 #                     short_description =>   #                     short_description => 
Line 983  sub handler { Line 1164  sub handler {
     td.essay          { border: 1px solid gray; }      td.essay          { border: 1px solid gray; }
 </style>  </style>
 ENDSTYLE  ENDSTYLE
     my $html=&Apache::lonxml::xmlbegin();        
     $r->print($html.'<head><title>'.      $r->print(&Apache::loncommon::start_page('Course Statistics and Charts',
               &mt('Course Statistics and Charts').       $style));
               '</title>'.$style.  
               "</head>\n".  
               &Apache::loncommon::bodytag('Course Statistics and Charts'));  
     $r->rflush();      $r->rflush();
     #       # 
     # Either print out a menu for them or send them to a report      # Either print out a menu for them or send them to a report
Line 1000  ENDSTYLE Line 1178  ENDSTYLE
                                             bug=>'Statistics and Charts'});                                              bug=>'Statistics and Charts'});
     if (! exists($env{'form.reportSelected'}) ||       if (! exists($env{'form.reportSelected'}) || 
         $env{'form.reportSelected'} eq '') {          $env{'form.reportSelected'} eq '') {
         $r->print(&Apache::lonhtmlcommon::breadcrumbs          $r->print(&Apache::lonhtmlcommon::breadcrumbs('Statistics Main Page').
                   (undef,&mt('Statistics Main Page')).  
                   &CreateMainMenu());                    &CreateMainMenu());
     } else {      } else {
     #      #
         if (! &Apache::lonmysql::verify_sql_connection()) {          if (! &Apache::lonmysql::verify_sql_connection()) {
             my $serveradmin = $r->dir_config('lonAdmEMail');              my $serveradmin = $r->dir_config('lonAdmEMail');
             $r->print('<h2><font color="Red">'.              $r->print('<h2 class="LC_error">'.
                       &mt('Unable to connect to database!').                        &mt('Unable to connect to database!').
                       '</font></h2>');                        '</h2>');
             $r->print('<p>'.              $r->print('<p>'
                       &mt('Please notify the server administrator ').                       .&mt('Please notify the server administrator [_1]',
                       '<b>'.$serveradmin.'</b></p>');                           ,'<b>'.$serveradmin.'</b>')
                        .'</p>');
             $r->print('<p>'.              $r->print('<p>'.
                       &mt('Course Statistics and Charts cannot be '.                        &mt('Course Statistics and Charts cannot be '.
                           'retrieved until the database is restarted.  '.                            'retrieved until the database is restarted.  '.
                           'Your data is intact but cannot be displayed '.                            'Your data is intact but cannot be displayed '.
                           'at this time.').'</p>');                            'at this time.').'</p>');
             $r->print('</body></html>');              $r->print(&Apache::loncommon::end_page());
             return;              return;
         }          }
         #          #
Line 1077  ENDSTYLE Line 1255  ENDSTYLE
                 ({href=>'/adm/statistics?reportselected=student_assessment',                  ({href=>'/adm/statistics?reportselected=student_assessment',
                   text=>'Chart'});                    text=>'Chart'});
             &Apache::lonstudentassessment::BuildStudentAssessmentPage($r,$c);              &Apache::lonstudentassessment::BuildStudentAssessmentPage($r,$c);
         }          } elsif($GoToPage eq 'grading_analysis') {
               &Apache::lonhtmlcommon::add_breadcrumb
                   ({href=>'/adm/statistics?reportselected=grading_anaylsis',
                     text=>'Grading Analysis'});
               &Apache::longradinganalysis::build_grading_analysis_page($r,$c);
    }
         #          #
         $r->print("</form>\n");          $r->print("</form>\n");
     }      }
     $r->print("</body>\n</html>\n");      $r->print(&Apache::loncommon::end_page());
     $r->rflush();      $r->rflush();
     #      #
     return OK;      return OK;

Removed from v.1.125  
changed lines
  Added in v.1.142.2.1


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>