Commit 223419d9 authored by Tim Hunt's avatar Tim Hunt
Browse files

MDL-60682 forms: date/times should use step 1 minute by default

parent 4275ea4a
...@@ -221,9 +221,11 @@ class core_calendar_type_testcase extends advanced_testcase { ...@@ -221,9 +221,11 @@ class core_calendar_type_testcase extends advanced_testcase {
$counter++; $counter++;
if ($element == 'dateselector') { if ($element == 'dateselector') {
$el = $this->mform->addElement('date_selector', 'dateselector' . $counter, null, array('timezone' => 0.0, 'step' => 1)); $el = $this->mform->addElement('date_selector',
'dateselector' . $counter, null, array('timezone' => 0.0));
} else { } else {
$el = $this->mform->addElement('date_time_selector', 'dateselector' . $counter, null, array('timezone' => 0.0, 'step' => 1, 'optional' => false)); $el = $this->mform->addElement('date_time_selector',
'dateselector' . $counter, null, array('timezone' => 0.0, 'optional' => false));
} }
$submitvalues = array('dateselector' . $counter => $date); $submitvalues = array('dateselector' . $counter => $date);
......
...@@ -79,7 +79,7 @@ class MoodleQuickForm_date_selector extends MoodleQuickForm_group { ...@@ -79,7 +79,7 @@ class MoodleQuickForm_date_selector extends MoodleQuickForm_group {
// Get the calendar type used - see MDL-18375. // Get the calendar type used - see MDL-18375.
$calendartype = \core_calendar\type_factory::get_calendar_instance(); $calendartype = \core_calendar\type_factory::get_calendar_instance();
$this->_options = array('startyear' => $calendartype->get_min_year(), 'stopyear' => $calendartype->get_max_year(), $this->_options = array('startyear' => $calendartype->get_min_year(), 'stopyear' => $calendartype->get_max_year(),
'defaulttime' => 0, 'timezone' => 99, 'step' => 5, 'optional' => false); 'defaulttime' => 0, 'timezone' => 99, 'step' => 1, 'optional' => false);
// TODO MDL-52313 Replace with the call to parent::__construct(). // TODO MDL-52313 Replace with the call to parent::__construct().
HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes); HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true; $this->_persistantFreeze = true;
......
...@@ -81,7 +81,7 @@ class MoodleQuickForm_date_time_selector extends MoodleQuickForm_group { ...@@ -81,7 +81,7 @@ class MoodleQuickForm_date_time_selector extends MoodleQuickForm_group {
// Get the calendar type used - see MDL-18375. // Get the calendar type used - see MDL-18375.
$calendartype = \core_calendar\type_factory::get_calendar_instance(); $calendartype = \core_calendar\type_factory::get_calendar_instance();
$this->_options = array('startyear' => $calendartype->get_min_year(), 'stopyear' => $calendartype->get_max_year(), $this->_options = array('startyear' => $calendartype->get_min_year(), 'stopyear' => $calendartype->get_max_year(),
'defaulttime' => 0, 'timezone' => 99, 'step' => 5, 'optional' => false); 'defaulttime' => 0, 'timezone' => 99, 'step' => 1, 'optional' => false);
// TODO MDL-52313 Replace with the call to parent::__construct(). // TODO MDL-52313 Replace with the call to parent::__construct().
HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes); HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes);
......
...@@ -77,7 +77,7 @@ class MoodleQuickForm_defaultcustom extends MoodleQuickForm_group { ...@@ -77,7 +77,7 @@ class MoodleQuickForm_defaultcustom extends MoodleQuickForm_group {
'startyear' => $calendartype->get_min_year(), 'startyear' => $calendartype->get_min_year(),
'stopyear' => $calendartype->get_max_year(), 'stopyear' => $calendartype->get_max_year(),
'defaulttime' => 0, 'defaulttime' => 0,
'step' => 5, 'step' => 1,
'optional' => false, 'optional' => false,
]; ];
......
...@@ -37,7 +37,7 @@ require_once($CFG->dirroot . '/mod/quiz/locallib.php'); ...@@ -37,7 +37,7 @@ require_once($CFG->dirroot . '/mod/quiz/locallib.php');
*/ */
class mod_quiz_mod_form extends moodleform_mod { class mod_quiz_mod_form extends moodleform_mod {
/** @var array options to be used with date_time_selector fields in the quiz. */ /** @var array options to be used with date_time_selector fields in the quiz. */
public static $datefieldoptions = array('optional' => true, 'step' => 1); public static $datefieldoptions = array('optional' => true);
protected $_feedbacks; protected $_feedbacks;
protected static $reviewfields = array(); // Initialised in the constructor. protected static $reviewfields = array(); // Initialised in the constructor.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment