Skip to content

Commit

Permalink
Merge branch 'MDL-44278' of git://github.com/timhunt/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski committed Mar 4, 2014
2 parents cf77b7c + 7346574 commit 3071e2b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions mod/quiz/mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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'),
Expand Down
5 changes: 3 additions & 2 deletions mod/quiz/override_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
defined('MOODLE_INTERNAL') || die();

require_once($CFG->libdir . '/formslib.php');
require_once($CFG->dirroot . '/mod/quiz/mod_form.php');


/**
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 3071e2b

Please sign in to comment.