Diff for /loncom/interface/lontrackstudent.pm between versions 1.22 and 1.26

version 1.22, 2007/02/12 23:58:42 version 1.26, 2009/01/02 23:07:55
Line 48  use Apache::lonmysql; Line 48  use Apache::lonmysql;
 use Apache::lonnet;  use Apache::lonnet;
 use Apache::lonlocal;  use Apache::lonlocal;
 use Time::HiRes;  use Time::HiRes;
   use DateTime();
 use lib '/home/httpd/lib/perl/';  use lib '/home/httpd/lib/perl/';
 use LONCAPA;  use LONCAPA;
   
Line 265  sub output_results { Line 266  sub output_results {
     if ($mode eq 'full_class') {       if ($mode eq 'full_class') { 
         $tableheader =           $tableheader = 
             '<table><tr>'.              '<table><tr>'.
               '<th>&nbsp;</th>'.
             '<th>'.&mt('Resource').'</th>'.              '<th>'.&mt('Resource').'</th>'.
             '<th>'.&mt('Time').'</th>'.              '<th>'.&mt('Time').'</th>'.
             '<th>'.&mt('Student').'</th>'.              '<th>'.&mt('Student').'</th>'.
Line 275  sub output_results { Line 277  sub output_results {
     } elsif ($mode =~ /^student:(.*):(.*)$/) {      } elsif ($mode =~ /^student:(.*):(.*)$/) {
         $tableheader =           $tableheader = 
             '<table><tr>'.              '<table><tr>'.
               '<th>&nbsp;</th>'.
             '<th>'.&mt('Resource').'</th>'.              '<th>'.&mt('Resource').'</th>'.
             '<th>'.&mt('Time').'</th>'.              '<th>'.&mt('Time').'</th>'.
             '<th>'.&mt('Action').'</th>'.              '<th>'.&mt('Action').'</th>'.
Line 286  sub output_results { Line 289  sub output_results {
     $r->rflush();      $r->rflush();
     ##      ##
     ##      ##
   
       my $cid = $env{'request.course.id'};
       my $cnum = $env{'course.'.$cid.'.num'};
       my $cdom = $env{'course.'.$cid.'.domain'};   
       my $server_timezone = &Apache::lonnet::get_server_timezone($cnum,$cdom);
       if ($server_timezone ne '') {
           if (&Apache::lonlocal::gettimezone($server_timezone) eq 'local') {
               $server_timezone = '';
           }
       }
   
     while (my $line = <ACTIVITYDATA>) {      while (my $line = <ACTIVITYDATA>) {
         # FIXME: does not pass symbs along :(          # FIXME: does not pass symbs along :(
         chomp($line);          chomp($line);
Line 316  sub output_results { Line 330  sub output_results {
                 $title = $nav_res->compTitle();                  $title = $nav_res->compTitle();
                 $src   = $nav_res->src();                  $src   = $nav_res->src();
             } else {              } else {
                 if ($src =~ m|^/res|) {   $src = $symb;
                     $title = $src;   if ($src !~ m{/adm}) {
                 } elsif ($values =~ /^\s*$/ &&       $title = &Apache::lonnet::gettitle($src);
                          (! defined($src) || $src =~ /^\s*$/)) {   } elsif ($values =~ /^\s*$/ && 
       (! defined($src) || $src =~ /^\s*$/)) {
                     next;                      next;
                 } elsif ($values =~ /^\s*$/) {                  } elsif ($values =~ /^\s*$/) {
                     $values = $src;                      $values = $src;
Line 359  sub output_results { Line 374  sub output_results {
         my $tablerow = qq{<tr class="$class"><td>}.($count+1).qq{</td>};          my $tablerow = qq{<tr class="$class"><td>}.($count+1).qq{</td>};
         if ($src =~ m|^/adm/|) {          if ($src =~ m|^/adm/|) {
             $tablerow .=               $tablerow .= 
                 '<td valign="top"><nobr>'.$title.'</nobr></td>';                  '<td valign="top"><span class="LC_nobreak">'.$title.'</span></td>';
         } else {          } else {
             $tablerow .=               $tablerow .= 
                 '<td valign="top"><nobr>'.                  '<td valign="top"><span class="LC_nobreak">'.
                 '<a href="'.$src.'">'.$title.'</a>'.                  '<a href="'.$src.'">'.$title.'</a>'.
                 '</nobr></td>';                  '</span></td>';
           }
           if ($server_timezone ne '') {
               $timestamp = &convert_timezone($server_timezone,$timestamp);
         }          }
         $tablerow .= '<td valign="top"><nobr>'.$timestamp.'</nobr></td>';          $tablerow .= '<td valign="top"><span class="LC_nobreak">'.$timestamp.'</span></td>';
         if ($mode eq 'full_class') {          if ($mode eq 'full_class') {
             $tablerow.='<td valign="top">'.$student.'</td>';              $tablerow.='<td valign="top">'.$student.'</td>';
         }          }
Line 382  sub output_results { Line 400  sub output_results {
     return $count;      return $count;
 }  }
   
   sub convert_timezone {
       my ($server_timezone,$timestamp) = @_;
       if ($server_timezone && $timestamp) {
           my ($date,$time) = split(/\s+/,$timestamp);
           my ($year,$month,$day) = split(/\-/,$date);
           my ($hour,$minute,$sec) = split(/:/,$time);
           foreach ($month,$day,$hour,$minute,$sec) {
               return $timestamp if $_ eq '';
               $_ =~ s/^0//;
           }
           my $dt = DateTime->new(year      => $year,
                                  month     => $month,
                                  day       => $day,
                                  hour      => $hour,
                                  minute    => $minute,
                                  second    => $sec,
                                  time_zone => $server_timezone,
                                 );
           my $unixtime = $dt->epoch;
           $timestamp = &Apache::lonlocal::locallocaltime($unixtime);
       }
       return $timestamp;
   }
   
 ###################################################################  ###################################################################
 ###################################################################  ###################################################################
 sub display_values {  sub display_values {
Line 397  sub display_values { Line 439  sub display_values {
  }   }
  $result.='</table>';   $result.='</table>';
     } elsif ($action eq 'POST') {      } elsif ($action eq 'POST') {
  my %values=   my %values;
     map {split('=',&unescape($_),-1)} split(/\&/,$values);          foreach my $pair (split(/\&/,$values)) {
               my ($key,$value) = split('=',&unescape($pair),-1);
               $values{$key} = $value;
           }
  foreach my $key (sort(keys(%values))) {   foreach my $key (sort(keys(%values))) {
     if ($key eq 'counter') { next; }      if ($key eq 'counter') { next; }
     $result.='<tr><td align="right">'.$key.'</td>'.      $result.='<tr><td align="right">'.$key.'</td>'.
Line 512  sub handler { Line 557  sub handler {
     #      #
     # We will almost always need this...      # We will almost always need this...
     my $navmap = Apache::lonnavmaps::navmap->new();      my $navmap = Apache::lonnavmaps::navmap->new();
       if (!defined($navmap)) {
           my $requrl = $r->uri;
           $env{'user.error.msg'} = "$requrl:bre:0:0:Navmap initialization failed.";
           return HTTP_NOT_ACCEPTABLE;
       }
     #       # 
     &Apache::lonhtmlcommon::clear_breadcrumbs();      &Apache::lonhtmlcommon::clear_breadcrumbs();
     &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/studentactivity',      &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/studentactivity',

Removed from v.1.22  
changed lines
  Added in v.1.26


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