File:
[LON-CAPA] /
loncom /
html /
adm /
helper /
resettimes.helper
Revision
1.3:
download - view:
text,
annotated -
select for diffs
Thu Apr 7 06:56:22 2005 UTC (19 years, 4 months ago) by
albertel
Branches:
MAIN
CVS tags:
version_2_4_0,
version_2_3_X,
version_2_3_99_0,
version_2_3_2,
version_2_3_1,
version_2_3_0,
version_2_2_X,
version_2_2_99_1,
version_2_2_99_0,
version_2_2_2,
version_2_2_1,
version_2_2_0,
version_2_1_X,
version_2_1_99_3,
version_2_1_99_2,
version_2_1_99_1,
version_2_1_99_0,
version_2_1_3,
version_2_1_2,
version_2_1_1,
version_2_1_0,
version_2_0_X,
version_2_0_99_1,
version_2_0_2,
version_2_0_1,
version_2_0_0,
version_1_99_3,
version_1_99_2,
version_1_99_1_tmcc,
version_1_99_1,
version_1_99_0_tmcc,
version_1_99_0,
HEAD
- ENV -> env
<helper title="Reset Access Times" requiredpriv="mgr">
<state name="START" title="Select Scope">
<message>
<message_text>Select </message_text>
</message>
<choices variable="harry">
<choice computer='1' nextstate="Student">Reset times on one or more maps for a single student.</choice>
<choice computer='0' nextstate="Class">Reset times on a single map for a section or whole clase.</choice>
</choices>
</state>
<state name="Student" title="Select Student">
<message nextstate="SelectAccess">
<message_text>Choose a student:<br /></message_text>
</message>
<student variable='stu1' coursepersonnel='true' activeonly='true' />
</state>
<state name="SelectAccess">
<message nextstate="ConfirmStu">
<message_text>This is a list of maps and times they were accessed, plese select those you want deleted.</message_text>
</message>
<choices variable='delete' multichoice='true'>
<exec>
my ($uname,$udom,$sec,$fullname)=split(':',$helper->{'VARS'}{'stu1'});
my %times=&Apache::lonnet::dump('firstaccesstimes',$udom,$uname,
"^$env{'request.course.id'}\0");
foreach my $res (sort(keys(%times))) {
my (undef,$symb)=split("\0",$res);
my $escsymb=&Apache::lonnet::escape($symb);
my $title=&Apache::lonnet::gettitle($symb);
my $time=&Apache::lonlocal::locallocaltime($times{$res});
my $description="<a href='/adm/navmaps?postsymb=".&Apache::lonnet::escape($symb)."'>$title</a> on $time";
push(@{$state->{CHOICES}},[$description,$escsymb]);
}
</exec>
</choices>
</state>
<state name="ConfirmStu">
<message nextstate="FinishStu">
<message_text>Will remove access times from user <ul></message_text>
</message>
<eval>
my ($uname,$udom,undef,$fullname)=split(':',$helper->{'VARS'}{'stu1'});
if (!$fullname) { $fullname="$uname\@$udom"; }
return '<li>'.$fullname.'</li>';
</eval>
<message><message_text></ul> for maps <ul></message_text></message>
<eval>
my $list;
my @symbs=split(/\|\|\|/,$helper->{'VARS'}{'delete'});
foreach my $escsymb (@symbs) {
my $symb=&Apache::lonnet::unescape($escsymb);
$list.='<li>'.&Apache::lonnet::gettitle($symb).'</li>';
}
return $list;
</eval>
</state>
<state name="FinishStu" title="Processing">
<final>
<finalcode>
&Apache::lonnet::logthis($helper->{'VARS'}{'delete'});
if ($helper->{'STATE'} ne 'FinishStu') { return; }
my $result;
my $courseid=$env{'request.course.id'};
my ($uname,$udom,$sec,$fullname)=split(':',$helper->{'VARS'}{'stu1'});
&Apache::lonnet::logthis($helper->{'VARS'}{'delete'});
foreach my $escsymb (split(/\|\|\|/,$helper->{'VARS'}{'delete'})) {
my $symb=&Apache::lonnet::unescape($escsymb);
my $res=&Apache::lonnet::del('firstaccesstimes',
["$courseid\0$symb"],$udom,$uname);
$result.="Removing access time from ".
&Apache::lonnet::gettitle($symb).": ".$res.'</li><li>';
}
$result=~s/<li>$//;
return $result;
</finalcode>
<exitpage>/adm/flip?postdata=return:</exitpage>
</final>
</state>
<state name="Class">
<message nextstate="SelectMap">
<message_text>Select:<br /></message_text>
</message>
<student variable='stu1' coursepersonnel='true' activeonly='true' multichoice='true' />
</state>
<state name="SelectMap" title="Select a map">
<message><message_text>Choose a resource</message_text></message>
<resource variable="res2">
<filterfunc>return $res->is_map()</filterfunc>
<valuefunc>return $res->symb()</valuefunc>
<nextstate>ShowPlan</nextstate>
</resource>
</state>
<state name="ShowPlan" title="Processing">
<message nextstate="FINISH"><message_text>Will remove access times for <ul></message_text></message>
<eval>
return '<li>'.&Apache::lonnet::gettitle($helper->{'VARS'}{'res2'}).'</li>';
</eval>
<message><message_text></ul> from users <ul></message_text></message>
<eval>
my $list;
my @names=split(/\|\|\|/,$helper->{'VARS'}{'stu1'});
foreach my $name (@names) {
my ($uname,$udom,$sec,$fullname)=split(':',$name);
if (!$fullname) { $fullname="$uname\@$udom"; }
$list.='<li>'.$fullname.'</li>';
}
return $list;
</eval>
</state>
<state name="FINISH" title="Processing">
<final>
<finalcode>
if ($helper->{'STATE'} ne 'FINISH') { return; }
my $result;
my $symb=$helper->{'VARS'}{'res2'};
my $key=$env{'request.course.id'}."\0".$symb;
my @names=split(/\|\|\|/,$helper->{'VARS'}{'stu1'});
foreach my $name (@names) {
my ($uname,$udom,$sec,$fullname)=split(':',$name);
if (!$fullname) { $fullname="$uname\@$udom"; }
my %times=&Apache::lonnet::get('firstaccesstimes',
[$key],$udom,$uname);
if (!$times{$key}) {
$result.="No Access times found for student ".$fullname;
} else {
$result.="Removing access times ".
&Apache::lonlocal::locallocaltime($times{$key}).
" found for student ".$fullname.": ";
$result.=&Apache::lonnet::del('firstaccesstimes',
[$key],$udom,$uname);
}
$result.="</li>\n<li>";
}
$result=~s/<li>$//;
return $result;
</finalcode>
<exitpage>/adm/flip?postdata=return:</exitpage></final>
</state>
</helper>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>