MDL-55140 mod_choice: Allow independent open and close dates

This commit is contained in:
Stephen Bourget
2016-07-27 07:18:54 -04:00
parent 90a8bdbfc0
commit 2ff504c6b2
10 changed files with 142 additions and 77 deletions
+6 -13
View File
@@ -70,18 +70,16 @@ class mod_choice_mod_form extends moodleform_mod {
}
//-------------------------------------------------------------------------------
$mform->addElement('header', 'timerestricthdr', get_string('availability'));
$mform->addElement('checkbox', 'timerestrict', get_string('timerestrict', 'choice'));
$mform->addElement('header', 'availabilityhdr', get_string('availability'));
$mform->addElement('date_time_selector', 'timeopen', get_string("choiceopen", "choice"),
array('optional' => true));
$mform->addElement('date_time_selector', 'timeopen', get_string("choiceopen", "choice"));
$mform->disabledIf('timeopen', 'timerestrict');
$mform->addElement('date_time_selector', 'timeclose', get_string("choiceclose", "choice"));
$mform->disabledIf('timeclose', 'timerestrict');
$mform->addElement('date_time_selector', 'timeclose', get_string("choiceclose", "choice"),
array('optional' => true));
$mform->addElement('advcheckbox', 'showpreview', get_string('showpreview', 'choice'));
$mform->addHelpButton('showpreview', 'showpreview', 'choice');
$mform->disabledIf('showpreview', 'timerestrict');
$mform->disabledIf('showpreview', 'timeopen[enabled]');
//-------------------------------------------------------------------------------
$mform->addElement('header', 'resultshdr', get_string('results', 'choice'));
@@ -117,11 +115,6 @@ class mod_choice_mod_form extends moodleform_mod {
}
}
if (empty($default_values['timeopen'])) {
$default_values['timerestrict'] = 0;
} else {
$default_values['timerestrict'] = 1;
}
}