mirror of
https://github.com/moodle/moodle.git
synced 2025-07-25 08:11:39 +02:00
MDL-44278 Quiz time overrides: use the same step everywhere.
On the main form, you could select to the nearest minute. On the override form you could only select to the nearest 5 minutes.
This commit is contained in:
@@ -37,6 +37,9 @@ require_once($CFG->dirroot . '/mod/quiz/locallib.php');
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class mod_quiz_mod_form extends moodleform_mod {
|
||||
/** @var array options to be used with date_time_selector fields in the quiz. */
|
||||
public static $datefieldoptions = array('optional' => true, 'step' => 1);
|
||||
|
||||
protected $_feedbacks;
|
||||
protected static $reviewfields = array(); // Initialised in the constructor.
|
||||
|
||||
@@ -79,11 +82,11 @@ class mod_quiz_mod_form extends moodleform_mod {
|
||||
|
||||
// Open and close dates.
|
||||
$mform->addElement('date_time_selector', 'timeopen', get_string('quizopen', 'quiz'),
|
||||
array('optional' => true, 'step' => 1));
|
||||
self::$datefieldoptions);
|
||||
$mform->addHelpButton('timeopen', 'quizopenclose', 'quiz');
|
||||
|
||||
$mform->addElement('date_time_selector', 'timeclose', get_string('quizclose', 'quiz'),
|
||||
array('optional' => true, 'step' => 1));
|
||||
self::$datefieldoptions);
|
||||
|
||||
// Time limit.
|
||||
$mform->addElement('duration', 'timelimit', get_string('timelimit', 'quiz'),
|
||||
|
@@ -27,6 +27,7 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once($CFG->libdir . '/formslib.php');
|
||||
require_once($CFG->dirroot . '/mod/quiz/mod_form.php');
|
||||
|
||||
|
||||
/**
|
||||
@@ -184,11 +185,11 @@ class quiz_override_form extends moodleform {
|
||||
|
||||
// Open and close dates.
|
||||
$mform->addElement('date_time_selector', 'timeopen',
|
||||
get_string('quizopen', 'quiz'), array('optional' => true));
|
||||
get_string('quizopen', 'quiz'), mod_quiz_mod_form::$datefieldoptions);
|
||||
$mform->setDefault('timeopen', $this->quiz->timeopen);
|
||||
|
||||
$mform->addElement('date_time_selector', 'timeclose',
|
||||
get_string('quizclose', 'quiz'), array('optional' => true));
|
||||
get_string('quizclose', 'quiz'), mod_quiz_mod_form::$datefieldoptions);
|
||||
$mform->setDefault('timeclose', $this->quiz->timeclose);
|
||||
|
||||
// Time limit.
|
||||
|
Reference in New Issue
Block a user