version 1.23, 2007/02/13 01:44:02
|
version 1.29, 2009/05/14 14:23:56
|
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 122 sub get_data {
|
Line 123 sub get_data {
|
)); |
)); |
$r->print('<br />'); |
$r->print('<br />'); |
} |
} |
|
$r->print('<hr />'); |
$text = 'Resubmit last request to check for newer data'; |
$text = 'Resubmit last request to check for newer data'; |
$r->print(&Apache::loncommon::track_student_link($text,$sname,$sdom,undef, |
$r->print(&Apache::loncommon::track_student_link($text,$sname,$sdom,undef, |
$env{'form.start'})); |
$env{'form.start'})); |
Line 265 sub output_results {
|
Line 267 sub output_results {
|
if ($mode eq 'full_class') { |
if ($mode eq 'full_class') { |
$tableheader = |
$tableheader = |
'<table><tr>'. |
'<table><tr>'. |
|
'<th> </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 278 sub output_results {
|
} elsif ($mode =~ /^student:(.*):(.*)$/) { |
} elsif ($mode =~ /^student:(.*):(.*)$/) { |
$tableheader = |
$tableheader = |
'<table><tr>'. |
'<table><tr>'. |
|
'<th> </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 290 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 360 sub output_results {
|
Line 375 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 383 sub output_results {
|
Line 401 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 516 sub handler {
|
Line 558 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', |
Line 533 sub handler {
|
Line 580 sub handler {
|
$r->print('<form name="trackstudent" method="post" action="/adm/trackstudent">'); |
$r->print('<form name="trackstudent" method="post" action="/adm/trackstudent">'); |
$r->print('<br />'); |
$r->print('<br />'); |
$r->print('<div name="statusline">'. |
$r->print('<div name="statusline">'. |
&mt('Status:[_1]', |
&mt('Status: [_1]', |
'<input type="text" name="status" size="60" value="" />'). |
'<input type="text" name="status" size="60" value="" readonly="readonly" />'). |
'</div>'); |
'</div>'); |
$r->rflush(); |
$r->rflush(); |
my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin |
my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin |
Line 553 sub handler {
|
Line 600 sub handler {
|
if ($sname =~ /^$LONCAPA::username_re$/ |
if ($sname =~ /^$LONCAPA::username_re$/ |
&& $sdom =~ /^$LONCAPA::domain_re$/) { |
&& $sdom =~ /^$LONCAPA::domain_re$/) { |
$r->print('<h2>'. |
$r->print('<h2>'. |
&mt('Recent activity of [_1]:[_2]',$sname,$sdom). |
&mt('Recent activity of [_1]',$sname.':'.$sdom). |
'</h2>'); |
'</h2>'); |
$r->print('<p>'.&mt(<<END).'</p>'); |
$r->print('<p class="LC_info">' |
Compiling student activity data can take a long time. |
.&mt('Compiling student activity data can take a long time.' |
Your request continues to be processed while results are displayed. |
.' Your request continues to be processed while results are displayed.') |
END |
.'</p>' |
|
); |
&get_data($r,\%prog_state,$navmap, |
&get_data($r,\%prog_state,$navmap, |
'student:'.$env{'form.selected_student'}); |
'student:'.$env{'form.selected_student'}); |
} else { |
} else { |