Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
20  user/extendenrol.php
@@ -53,16 +53,30 @@
53 53
 $table->width = "600";
54 54
 $timeformat = get_string('strftimedate');
55 55
 $nochange = get_string('nochange');
  56
+$notavailable = get_string('notavailable');
  57
+$unlimited = get_string('unlimited');
56 58
 foreach ($_POST as $k => $v) {
57 59
     if (preg_match('/^user(\d+)$/',$k,$m)) {
58 60
         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"))) {
59 61
             continue;
60 62
         }
  63
+        if ($user->timestart) {
  64
+            $timestart = userdate($user->timestart, $timeformat);
  65
+        } else {
  66
+            $timestart = $notavailable;
  67
+        }
  68
+        if ($user->timeend) {
  69
+            $timeend = userdate($user->timeend, $timeformat);
  70
+            $checkbox = choose_from_menu($periodmenu, "extendperiod[{$m[1]}]", "0", $nochange, '', '0', true);
  71
+        } else {
  72
+            $timeend = $unlimited;
  73
+            $checkbox = '<input type="hidden" name="extendperiod['.$m[1].']" value="0" />'.$nochange;
  74
+        }
61 75
         $table->data[] = array(
62 76
         fullname($user, true),
63  
-        userdate($user->timestart, $timeformat),
64  
-        userdate($user->timeend, $timeformat),
65  
-        '<input type="hidden" name="userid['.$m[1].']" value="'.$m[1].'" >'.choose_from_menu($periodmenu, "extendperiod[{$m[1]}]", "0", $nochange, '', '0', true)
  77
+        $timestart,
  78
+        $timeend,
  79
+        '<input type="hidden" name="userid['.$m[1].']" value="'.$m[1].'" />'.$checkbox
66 80
         );
67 81
     }
68 82
 }
6  user/index.php
@@ -586,7 +586,11 @@ function checkchecked(form) {
586 586
                     $data[] = $lastaccess;
587 587
                 }
588 588
                 if ($course->enrolperiod) {
589  
-                    $data[] = userdate($student->timeend, $timeformat);
  589
+                    if ($student->timeend) {
  590
+                        $data[] = userdate($student->timeend, $timeformat);
  591
+                    } else {
  592
+                        $data[] = get_string('unlimited');
  593
+                    }
590 594
                 }
591 595
                 if ($isteacher) {
592 596
                     $data[] = '<input type="checkbox" name="user'.$student->id.'" />';

0 notes on commit 8ab5ca2

Please sign in to comment.
Something went wrong with that request. Please try again.