Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refined some wording and logic for extend enrolment period

  • Loading branch information...
commit 8ab5ca2f946e51dca66b74f695f42b8c23bd3f7a 1 parent 986935e
patrickslee authored
Showing with 22 additions and 4 deletions.
  1. +17 −3 user/extendenrol.php
  2. +5 −1 user/index.php
View
20 user/extendenrol.php
@@ -53,16 +53,30 @@
$table->width = "600";
$timeformat = get_string('strftimedate');
$nochange = get_string('nochange');
+$notavailable = get_string('notavailable');
+$unlimited = get_string('unlimited');
foreach ($_POST as $k => $v) {
if (preg_match('/^user(\d+)$/',$k,$m)) {
if (!($user = get_record_sql("SELECT * FROM {$CFG->prefix}user u INNER JOIN {$CFG->prefix}user_students s ON u.id=s.userid WHERE u.id={$m[1]} AND s.course=$course->id"))) {
continue;
}
+ if ($user->timestart) {
+ $timestart = userdate($user->timestart, $timeformat);
+ } else {
+ $timestart = $notavailable;
+ }
+ if ($user->timeend) {
+ $timeend = userdate($user->timeend, $timeformat);
+ $checkbox = choose_from_menu($periodmenu, "extendperiod[{$m[1]}]", "0", $nochange, '', '0', true);
+ } else {
+ $timeend = $unlimited;
+ $checkbox = '<input type="hidden" name="extendperiod['.$m[1].']" value="0" />'.$nochange;
+ }
$table->data[] = array(
fullname($user, true),
- userdate($user->timestart, $timeformat),
- userdate($user->timeend, $timeformat),
- '<input type="hidden" name="userid['.$m[1].']" value="'.$m[1].'" >'.choose_from_menu($periodmenu, "extendperiod[{$m[1]}]", "0", $nochange, '', '0', true)
+ $timestart,
+ $timeend,
+ '<input type="hidden" name="userid['.$m[1].']" value="'.$m[1].'" />'.$checkbox
);
}
}
View
6 user/index.php
@@ -586,7 +586,11 @@ function checkchecked(form) {
$data[] = $lastaccess;
}
if ($course->enrolperiod) {
- $data[] = userdate($student->timeend, $timeformat);
+ if ($student->timeend) {
+ $data[] = userdate($student->timeend, $timeformat);
+ } else {
+ $data[] = get_string('unlimited');
+ }
}
if ($isteacher) {
$data[] = '<input type="checkbox" name="user'.$student->id.'" />';
Please sign in to comment.
Something went wrong with that request. Please try again.