]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-10181 manual enrolment changes
authortoyomoyo <toyomoyo>
Wed, 4 Jul 2007 02:35:52 +0000 (02:35 +0000)
committertoyomoyo <toyomoyo>
Wed, 4 Jul 2007 02:35:52 +0000 (02:35 +0000)
admin/roles/assign.html
admin/roles/assign.php

index 158c5ca87c3bd1d931d8cf38a7dcde37a3389558..2369b5d038ee7add23f356096e895e04d47bfb09 100755 (executable)
@@ -1,7 +1,7 @@
 <form id="assignform" method="post" action="">
 <div style="text-align:center;">
 <label for="extendperiod"><?php print_string('enrolperiod') ?></label> <?php choose_from_menu($periodmenu, "extendperiod", $defaultperiod, $unlimitedperiod); ?>
-<label for="extendperiod"><?php print_string('startingfrom') ?></label> <?php choose_from_menu($basemenu, "extendbase", 3, ""); ?>
+<label for="extendbase"><?php print_string('startingfrom') ?></label> <?php choose_from_menu($basemenu, "extendbase", 3, ""); ?>
 
 <input type="hidden" name="previoussearch" value="<?php p($previoussearch) ?>" />
 <input type="hidden" name="userid" value="<?php p($userid) ?>" />
index a0788e5259033211c420a933576c9e96df25b067..b1d507144bc2766cf5a80ef3f47b49d54e847726 100755 (executable)
@@ -15,9 +15,8 @@
     $searchtext     = optional_param('searchtext', '', PARAM_RAW); // search string
     $previoussearch = optional_param('previoussearch', 0, PARAM_BOOL);
     $hidden         = optional_param('hidden', 0, PARAM_BOOL); // whether this assignment is hidden
-    $timestart      = optional_param('timestart', 0, PARAM_INT);
-    $timeend        = optional_param('timened', 0, PARAM_INT);
     $extendperiod   = optional_param('extendperiod', 0, PARAM_INT);
+    $extendbase     = optional_param('extendbase', 0, PARAM_INT);
     $userid         = optional_param('userid', 0, PARAM_INT); // needed for user tabs
     $courseid       = optional_param('courseid', 0, PARAM_INT); // needed for user tabs
 
     }
 
     $timeformat = get_string('strftimedate');
+    $today = time();
+    $today = make_timestamp(date('Y', $today), date('m', $today), date('d', $today), 0, 0, 0);
+    
     $basemenu[0] = get_string('startdate') . ' (' . userdate($course->startdate, $timeformat) . ')';
-    if(time() > $course->startdate) {
-        $basemenu[3] = get_string('today') . ' (' . userdate(time(), $timeformat) . ')' ;
+    if ($course->enrollable != 2 || ($course->enrolstartdate == 0 || $course->enrolstartdate <= $today) && ($course->enrolenddate == 0 || $course->enrolenddate > $today)) {
+        $basemenu[3] = get_string('today') . ' (' . userdate($today, $timeformat) . ')' ;
     }
     if($course->enrollable == 2) {
         if($course->enrolstartdate > 0) {
 
         if ($add and !empty($frm->addselect) and confirm_sesskey()) {
 
-            $timemodified = time();
-
             foreach ($frm->addselect as $adduser) {
                 if (!$adduser = clean_param($adduser, PARAM_INT)) {
                     continue;
                     }
                 }
                 if ($allow) {
-                    $timestart = $timemodified;
+                    switch($extendbase) {
+                        case 0:
+                            $timestart = $course->startdate;
+                            break;
+                        case 3:
+                            $timestart = $today;
+                            break;
+                        case 4:
+                            $timestart = $course->enrolstartdate;
+                            break;
+                        case 5:
+                            $timestart = $course->enrolenddate;
+                            break;
+                    }
+                    
                     if($extendperiod > 0) {
                         $timeend = $timestart + $extendperiod;
                     } else {