]> git.mjollnir.org Git - moodle.git/commitdiff
Fix whitespace, and round times to the previous multiple of the 'step' option, if...
authortjhunt <tjhunt>
Mon, 23 Jul 2007 14:55:35 +0000 (14:55 +0000)
committertjhunt <tjhunt>
Mon, 23 Jul 2007 14:55:35 +0000 (14:55 +0000)
lib/form/datetimeselector.php

index 03220929d2a0973b465793198a72ade335cb5d96..0f07b4fa1363a698dc0905b303fb99203c620738 100644 (file)
@@ -133,6 +133,8 @@ class MoodleQuickForm_date_time_selector extends MoodleQuickForm_group{
                 }
                 if (!is_array($value)) {
                     $currentdate = usergetdate($value);
+                    // Round minutes to the previous multiple of step.
+                    $currentdate['minutes'] -= $currentdate['minutes'] % $this->_options['step'];
                     $value = array(
                         'minute' => $currentdate['minutes'],
                         'hour' => $currentdate['hours'],
@@ -140,12 +142,12 @@ class MoodleQuickForm_date_time_selector extends MoodleQuickForm_group{
                         'month' => $currentdate['mon'],
                         'year' => $currentdate['year']);
                     // If optional, default to off, unless a date was provided
-                     if($this->_options['optional']) {
+                    if($this->_options['optional']) {
                         $value['off'] = ($requestvalue == 0) ? true : false;
                     }
-               } else {
-                   $value['off'] = (isset($value['off'])) ? true : false;
-               }
+                } else {
+                    $value['off'] = (isset($value['off'])) ? true : false;
+                }
                 if (null !== $value){
                     $this->setValue($value);
                 }