Diff for /loncom/interface/lonstatistics.pm between versions 1.133 and 1.140

version 1.133, 2006/05/09 14:38:10 version 1.140, 2008/09/16 12:32:18
Line 63  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 75  use Apache::lonpercentage; Line 76  use Apache::lonpercentage;
 use Apache::lonstudentsubmissions();  use Apache::lonstudentsubmissions();
 use Apache::lonsurveyreports();  use Apache::lonsurveyreports();
 use Apache::longradinganalysis();  use Apache::longradinganalysis();
   use LONCAPA;
   
 #######################################################  #######################################################
 #######################################################  #######################################################
Line 231  sub PrepareClasslist { Line 233  sub PrepareClasslist {
     #      #
     # Get groupmembership      # Get groupmembership
     my ($classgroups,$studentgroups);      my ($classgroups,$studentgroups);
     my %curr_groups = &Apache::loncommon::coursegroups($cdom,$cnum);      my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum);
     if (%curr_groups) {      if (%curr_groups) {
         ($classgroups,$studentgroups) =           ($classgroups,$studentgroups) = 
     &Apache::loncoursedata::get_group_memberships($classlist,      &Apache::loncoursedata::get_group_memberships($classlist,
                                                             $field_names,
   $cdom,$cnum);    $cdom,$cnum);
     }      }
     my $now = time;      my $now = time;
Line 309  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      # Sort the groups
Line 428  sub get_selected_groups { Line 435  sub get_selected_groups {
 =item &section_and_enrollment_description  =item &section_and_enrollment_description
   
 Returns a string describing the currently selected section(s), group(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 445  sub section_and_enrollment_description { Line 452  sub section_and_enrollment_description {
     my @groups = &Apache::lonstatistics::get_selected_groups();      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, groups 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, groups 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);
Line 455  sub section_and_enrollment_description { Line 462  sub section_and_enrollment_description {
     $description = &section_or_group_text($mode,'section',@sections).      $description = &section_or_group_text($mode,'section',@sections).
  ' '.&section_or_group_text($mode,'group',@groups);   ' '.&section_or_group_text($mode,'group',@groups);
     if ($mode eq 'localized') {      if ($mode eq 'localized') {
         $description .= &mt(' [_1] enrollment status.',$env{'form.Status'});          $description .= &mt(' [_1] access status.',$env{'form.Status'});
     } elsif ($mode eq 'plaintext') {      } elsif ($mode eq 'plaintext') {
         $description .= ' '.$env{'form.Status'}.' enrollment status.';          $description .= ' '.$env{'form.Status'}.' access status.';
     }      }
     return $description;      return $description;
 }  }
Line 700  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 927  sub DisplayClasslist { Line 939  sub DisplayClasslist {
     $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('Groups').'</b></th>';      $Str .= '<th align="center"><b>'.&mt('Groups').'</b></th>';
     $Str .= '<th align="center"><b>'.&mt('Enrollment Status').'</b></th>';      $Str .= '<th align="center"><b>'.&mt('Access Status').'</b></th>';
     $Str .= '</tr>'.$/;      $Str .= '</tr>'.$/;
     $Str .= '<tr>';      $Str .= '<tr>';
     $Str .= '<td>'.      $Str .= '<td>'.
Line 1016  sub DisplayClasslist { Line 1028  sub DisplayClasslist {
             $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') {
Line 1169  ENDSTYLE Line 1181  ENDSTYLE
     #      #
         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.  '.

Removed from v.1.133  
changed lines
  Added in v.1.140


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