--- loncom/interface/lontrackstudent.pm 2004/12/16 22:04:41 1.10 +++ loncom/interface/lontrackstudent.pm 2005/02/09 21:21:08 1.13 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lontrackstudent.pm,v 1.10 2004/12/16 22:04:41 matthew Exp $ +# $Id: lontrackstudent.pm,v 1.13 2005/02/09 21:21:08 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -44,10 +44,10 @@ package Apache::lontrackstudent; use strict; use Apache::Constants qw(:common :http); +use Apache::lonmysql; use Apache::lonnet(); use Apache::lonlocal; use Time::HiRes; -use Time::Local; sub get_data { my ($r,$prog_state,$navmap,$mode) = @_; @@ -119,10 +119,10 @@ sub table_names { my $prefix = $course.'_'.$domain.'_'; # my %tables = - ( student => $prefix.'students', - res => $prefix.'resource', - machine => $prefix.'machine_table', - activity=> $prefix.'activity', + ( student =>&Apache::lonmysql::fix_table_name($prefix.'students'), + res =>&Apache::lonmysql::fix_table_name($prefix.'resource'), + machine =>&Apache::lonmysql::fix_table_name($prefix.'machine_table'), + activity=>&Apache::lonmysql::fix_table_name($prefix.'activity'), ); return %tables; } @@ -178,14 +178,7 @@ sub get_max_time_in_db { $timestr = &Apache::lonnet::unescape($line); } close(TIMEDATA); - my ($year,$month,$day,$hour,$min,$sec) = - ($timestr =~ /^(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)/); - $month -= 1; # Good old timelocal - my $max_time = undef; - if (eval("&timelocal($sec,$min,$hour,$day,$month,$year)")) { - $max_time = &timelocal($sec,$min,$hour,$day,$month,$year); - } - return $max_time; + return &Apache::lonmysql::unsqltime($timestr); } sub build_query { @@ -232,6 +225,11 @@ sub output_results { my ($r,$results_file,$navmap,$mode) = @_; ## ## + if (! -s $results_file) { + # results file is empty, just let them know there is no data + $r->print('
'. @@ -281,12 +279,13 @@ sub output_results { } my ($symb,$timestamp,$student,$action,$machine,$values); if ($mode eq 'full_class') { - ($symb,$timestamp,$student,$action,$machine,$values) = - map { &Apache::lonnet::unescape($_); } split(',',$line,6); + ($symb,$timestamp,$student,$action,$machine,$values) = split(',',$line,6); } else { - ($symb,$timestamp,$action,$machine,$values) = - map { &Apache::lonnet::unescape($_); } split(',',$line,5); + ($symb,$timestamp,$action,$machine,$values) = split(',',$line,5); } + foreach ($symb,$timestamp,$student,$action,$machine) { + $_=&Apache::lonnet::unescape($_); + } my ($title,$src); if ($symb =~ m:^/adm/:) { $title = $symb; @@ -294,7 +293,7 @@ sub output_results { } else { my $nav_res = $navmap->getBySymb($symb); if (defined($nav_res)) { - $title = $nav_res->title(); + $title = $nav_res->compTitle(); $src = $nav_res->src(); } else { if ($src =~ m|^/res|) { @@ -334,27 +333,27 @@ sub output_results { $class = 'warning'; } # Clean up the values - $values =~ s/counter=\d+$//; + $values = &display_values($action,$values); # # Build the row for output my $tablerow = qq{
'. + &Apache::lonnet::unescape($key). + ' | = | '. + &Apache::lonnet::unescape($values{$key}).' |