--- loncom/homework/lonhomework.pm 2015/02/21 21:53:34 1.349 +++ loncom/homework/lonhomework.pm 2015/03/03 16:54:03 1.349.2.1 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.349 2015/02/21 21:53:34 raeburn Exp $ +# $Id: lonhomework.pm,v 1.349.2.1 2015/03/03 16:54:03 musolffc Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1331,10 +1331,30 @@ sub update_construct_style { } } +# Sets timer to zero for the entire folder containing the current resource for the +# current user. This is called by the done button and the javascript function +# zeroTimer() in lonmenu.pm +sub zero_timer { + my $symb = shift; + my $first_access = &Apache::lonnet::get_first_access("map",$symb); + my $done_time = time() - $first_access; + &Apache::lonparmset::storeparm_by_symb($symb,"0_interval","2",$done_time, + "date_interval",$env{'user.name'},$env{'user.domain'},,'',); +} + sub handler { #my $t0 = [&gettimeofday()]; my $request=$_[0]; + + my ($symb) = &Apache::lonnet::whichuser(); + + # Set the event timer to zero if the "done button" was clicked. + if ($env{"form.done"} eq "true") { + &zero_timer($symb); + $env{"form.done"} = ""; + } + $Apache::lonxml::request=$request; $Apache::lonxml::debug=$env{'user.debug'}; $env{'request.uri'}=$request->uri; @@ -1359,7 +1379,6 @@ sub handler { } &Apache::lonxml::debug("Permissions:$Apache::lonhomework::browse:$Apache::lonhomework::viewgrades:$Apache::lonhomework::modifygrades:$Apache::lonhomework::queuegrade"); &Apache::lonxml::debug("Problem Mode ".$env{'form.problemmode'}); - my ($symb) = &Apache::lonnet::whichuser(); &Apache::lonxml::debug('symb is '.$symb); if ($env{'request.state'} eq "construct") { if ( -e $file ) {