Annotation of loncom/html/adm/helper/resettimes.helper, revision 1.1
1.1 ! albertel 1: <helper title="Reset Access Times" requiredpriv="mgr">
! 2: <state name="START" title="Select Scope">
! 3: <message>
! 4: <message_text>Select </message_text>
! 5: </message>
! 6: <choices variable="harry">
! 7: <choice computer='1' nextstate="Student">Reset times on one or more maps for a single student.</choice>
! 8: <choice computer='0' nextstate="Class">Reset times on a single map for a section or whole clase.</choice>
! 9: </choices>
! 10: </state>
! 11: <state name="Student" title="Select Student">
! 12: <message nextstate="SelectAccess">
! 13: <message_text>Choose a student:<br /></message_text>
! 14: </message>
! 15: <student variable='stu1' coursepersonnel='true' activeonly='true' />
! 16: </state>
! 17:
! 18: <state name="SelectAccess">
! 19: <choices variable='delete' multichoice='true'>
! 20: <nextstate>FinishStu</nextstate>
! 21: <exec>
! 22: my ($uname,$udom,$sec,$fullname)=split(':',$helper->{'VARS'}{'stu1'});
! 23: my %times=&Apache::lonnet::dump('firstaccesstimes',$udom,$uname,
! 24: "^$ENV{'request.course.id'}\0");
! 25: foreach my $res (sort(keys(%times))) {
! 26: my (undef,$symb)=split("\0",$res);
! 27: my $escsymb=&Apache::lonnet::escape($symb);
! 28: my $title=&Apache::lonnet::gettitle($symb);
! 29: my $time=&Apache::lonlocal::locallocaltime($times{$res});
! 30: my $description="<a href='/adm/navmaps?postsymb=".&Apache::lonnet::escape($symb)."'>$title</a>";
! 31: push(@{$state->{CHOICES}},[$description,$escsymb]);
! 32: }
! 33: </exec>
! 34: </choices>
! 35: </state>
! 36:
! 37: <state name="FinishStu" title="Processing">
! 38: <final>
! 39: <finalcode>
! 40: &Apache::lonnet::logthis($helper->{'VARS'}{'delete'});
! 41: if ($helper->{'STATE'} ne 'FinishStu') { return; }
! 42: my $result;
! 43: my $courseid=$ENV{'request.course.id'};
! 44: my ($uname,$udom,$sec,$fullname)=split(':',$helper->{'VARS'}{'stu1'});
! 45: &Apache::lonnet::logthis($helper->{'VARS'}{'delete'});
! 46: foreach my $escsymb (split(/\|\|\|/,$helper->{'VARS'}{'delete'})) {
! 47: my $symb=&Apache::lonnet::unescape($escsymb);
! 48: my $res=&Apache::lonnet::del('firstaccesstimes',
! 49: ["$courseid\0$symb"],$udom,$uname);
! 50: $result.="Removing access time from ".
! 51: &Apache::lonnet::gettitle($symb).": ".$res.'</li><li>';
! 52: }
! 53: $result=~s/<li>$//;
! 54: return $result;
! 55: </finalcode>
! 56: <exitpage>/adm/flip?postdata=return:</exitpage>
! 57: </final>
! 58: </state>
! 59:
! 60: <state name="Class">
! 61: <message nextstate="SelectMap">
! 62: <message_text>Select:<br /></message_text>
! 63: </message>
! 64: <student variable='stu1' coursepersonnel='true' activeonly='true' multichoice='true' />
! 65: </state>
! 66:
! 67: <state name="SelectMap" title="Select a map">
! 68: <message><message_text>Choose a resource</message_text></message>
! 69: <resource variable="res2">
! 70: <filterfunc>return $res->is_map()</filterfunc>
! 71: <valuefunc>return $res->symb()</valuefunc>
! 72: <nextstate>ShowPlan</nextstate>
! 73: </resource>
! 74: </state>
! 75:
! 76: <state name="ShowPlan" title="Processing">
! 77: <message nextstate="FINISH"><message_text>Will remove access times for <ul></message_text></message>
! 78:
! 79: <eval>
! 80: return '<li>'.&Apache::lonnet::gettitle($helper->{'VARS'}{'res2'}).'</li>';
! 81: </eval>
! 82: <message><message_text></ul> from users <ul></message_text></message>
! 83: <eval>
! 84: my $list;
! 85: my @names=split(/\|\|\|/,$helper->{'VARS'}{'stu1'});
! 86: foreach my $name (@names) {
! 87: my ($uname,$udom,$sec,$fullname)=split(':',$name);
! 88: if (!$fullname) { $fullname="$uname\@$udom"; }
! 89: $list.='<li>'.$fullname.'</li>';
! 90: }
! 91: return $list;
! 92: </eval>
! 93: </state>
! 94:
! 95: <state name="FINISH" title="Processing">
! 96: <final>
! 97: <finalcode>
! 98: if ($helper->{'STATE'} ne 'FINISH') { return; }
! 99: my $result;
! 100: my $symb=$helper->{'VARS'}{'res2'};
! 101: my $key=$ENV{'request.course.id'}."\0".$symb;
! 102: my @names=split(/\|\|\|/,$helper->{'VARS'}{'stu1'});
! 103: foreach my $name (@names) {
! 104: my ($uname,$udom,$sec,$fullname)=split(':',$name);
! 105: if (!$fullname) { $fullname="$uname\@$udom"; }
! 106: my %times=&Apache::lonnet::get('firstaccesstimes',
! 107: [$key],$udom,$uname);
! 108: if (!$times{$key}) {
! 109: $result.="No Access times found for student ".$fullname;
! 110: } else {
! 111: $result.="Removing access times ".
! 112: &Apache::lonlocal::locallocaltime($times{$key}).
! 113: " found for student ".$fullname.": ";
! 114: $result.=&Apache::lonnet::del('firstaccesstimes',
! 115: [$key],$udom,$uname);
! 116: }
! 117: $result.="</li>\n<li>";
! 118: }
! 119: $result=~s/<li>$//;
! 120: return $result;
! 121: </finalcode>
! 122: <exitpage>/adm/flip?postdata=return:</exitpage></final>
! 123: </state>
! 124: </helper>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>