diff --git a/mod/quiz/mod_form.php b/mod/quiz/mod_form.php index 0b904aed55400..30eadfb2388f1 100644 --- a/mod/quiz/mod_form.php +++ b/mod/quiz/mod_form.php @@ -37,6 +37,9 @@ * @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 @@ protected function definition() { // 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'), diff --git a/mod/quiz/override_form.php b/mod/quiz/override_form.php index ca56cd692fdf8..80894495e4b74 100644 --- a/mod/quiz/override_form.php +++ b/mod/quiz/override_form.php @@ -27,6 +27,7 @@ defined('MOODLE_INTERNAL') || die(); require_once($CFG->libdir . '/formslib.php'); +require_once($CFG->dirroot . '/mod/quiz/mod_form.php'); /** @@ -189,11 +190,11 @@ protected function definition() { // 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.