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

version 1.25, 2008/12/20 04:31:55 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 367  sub output_results { Line 381  sub output_results {
                 '<a href="'.$src.'">'.$title.'</a>'.                  '<a href="'.$src.'">'.$title.'</a>'.
                 '</span></td>';                  '</span></td>';
         }          }
           if ($server_timezone ne '') {
               $timestamp = &convert_timezone($server_timezone,$timestamp);
           }
         $tablerow .= '<td valign="top"><span class="LC_nobreak">'.$timestamp.'</span></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 383  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 {

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


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