mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-64557 modform: switch disabledIf to hideIf, where appropriate
This commit is contained in:
parent
694513e2fe
commit
87c7fb6e9a
@ -283,7 +283,7 @@ abstract class moodleform_mod extends moodleform {
|
||||
// option (MDL-30764)
|
||||
if (empty($this->_cm) || !$this->_cm->groupingid) {
|
||||
if ($mform->elementExists('groupmode') && empty($COURSE->groupmodeforce)) {
|
||||
$mform->disabledIf('groupingid', 'groupmode', 'eq', NOGROUPS);
|
||||
$mform->hideIf('groupingid', 'groupmode', 'eq', NOGROUPS);
|
||||
|
||||
} else if (!$mform->elementExists('groupmode')) {
|
||||
// Groupings have no use without groupmode.
|
||||
@ -545,19 +545,19 @@ abstract class moodleform_mod extends moodleform {
|
||||
}
|
||||
}
|
||||
$mform->addElement('modgrade', 'scale', get_string('scale'), $gradeoptions);
|
||||
$mform->disabledIf('scale', 'assessed', 'eq', 0);
|
||||
$mform->hideIf('scale', 'assessed', 'eq', 0);
|
||||
$mform->addHelpButton('scale', 'modgrade', 'grades');
|
||||
$mform->setDefault('scale', $CFG->gradepointdefault);
|
||||
|
||||
$mform->addElement('checkbox', 'ratingtime', get_string('ratingtime', 'rating'));
|
||||
$mform->disabledIf('ratingtime', 'assessed', 'eq', 0);
|
||||
$mform->hideIf('ratingtime', 'assessed', 'eq', 0);
|
||||
|
||||
$mform->addElement('date_time_selector', 'assesstimestart', get_string('from'));
|
||||
$mform->disabledIf('assesstimestart', 'assessed', 'eq', 0);
|
||||
$mform->hideIf('assesstimestart', 'assessed', 'eq', 0);
|
||||
$mform->disabledIf('assesstimestart', 'ratingtime');
|
||||
|
||||
$mform->addElement('date_time_selector', 'assesstimefinish', get_string('to'));
|
||||
$mform->disabledIf('assesstimefinish', 'assessed', 'eq', 0);
|
||||
$mform->hideIf('assesstimefinish', 'assessed', 'eq', 0);
|
||||
$mform->disabledIf('assesstimefinish', 'ratingtime');
|
||||
}
|
||||
|
||||
@ -677,7 +677,7 @@ abstract class moodleform_mod extends moodleform {
|
||||
if (plugin_supports('mod', $this->_modname, FEATURE_COMPLETION_TRACKS_VIEWS, false)) {
|
||||
$mform->addElement('checkbox', 'completionview', get_string('completionview', 'completion'),
|
||||
get_string('completionview_desc', 'completion'));
|
||||
$mform->disabledIf('completionview', 'completion', 'ne', COMPLETION_TRACKING_AUTOMATIC);
|
||||
$mform->hideIf('completionview', 'completion', 'ne', COMPLETION_TRACKING_AUTOMATIC);
|
||||
// Check by default if automatic completion tracking is set.
|
||||
if ($trackingdefault == COMPLETION_TRACKING_AUTOMATIC) {
|
||||
$mform->setDefault('completionview', 1);
|
||||
@ -689,7 +689,7 @@ abstract class moodleform_mod extends moodleform {
|
||||
if (plugin_supports('mod', $this->_modname, FEATURE_GRADE_HAS_GRADE, false)) {
|
||||
$mform->addElement('checkbox', 'completionusegrade', get_string('completionusegrade', 'completion'),
|
||||
get_string('completionusegrade_desc', 'completion'));
|
||||
$mform->disabledIf('completionusegrade', 'completion', 'ne', COMPLETION_TRACKING_AUTOMATIC);
|
||||
$mform->hideIf('completionusegrade', 'completion', 'ne', COMPLETION_TRACKING_AUTOMATIC);
|
||||
$mform->addHelpButton('completionusegrade', 'completionusegrade', 'completion');
|
||||
$gotcompletionoptions = true;
|
||||
|
||||
@ -702,7 +702,7 @@ abstract class moodleform_mod extends moodleform {
|
||||
// Automatic completion according to module-specific rules
|
||||
$this->_customcompletionelements = $this->add_completion_rules();
|
||||
foreach ($this->_customcompletionelements as $element) {
|
||||
$mform->disabledIf($element, 'completion', 'ne', COMPLETION_TRACKING_AUTOMATIC);
|
||||
$mform->hideIf($element, 'completion', 'ne', COMPLETION_TRACKING_AUTOMATIC);
|
||||
}
|
||||
|
||||
$gotcompletionoptions = $gotcompletionoptions ||
|
||||
@ -719,7 +719,7 @@ abstract class moodleform_mod extends moodleform {
|
||||
$mform->addElement('date_time_selector', 'completionexpected', get_string('completionexpected', 'completion'),
|
||||
array('optional' => true));
|
||||
$mform->addHelpButton('completionexpected', 'completionexpected', 'completion');
|
||||
$mform->disabledIf('completionexpected', 'completion', 'eq', COMPLETION_TRACKING_NONE);
|
||||
$mform->hideIf('completionexpected', 'completion', 'eq', COMPLETION_TRACKING_NONE);
|
||||
}
|
||||
|
||||
// Populate module tags.
|
||||
@ -859,7 +859,7 @@ abstract class moodleform_mod extends moodleform {
|
||||
get_string('gradingmethod', 'core_grading'), $this->current->_advancedgradingdata['methods']);
|
||||
$mform->addHelpButton('advancedgradingmethod_'.$areaname, 'gradingmethod', 'core_grading');
|
||||
if (!$this->_features->rating) {
|
||||
$mform->disabledIf('advancedgradingmethod_'.$areaname, 'grade[modgrade_type]', 'eq', 'none');
|
||||
$mform->hideIf('advancedgradingmethod_'.$areaname, 'grade[modgrade_type]', 'eq', 'none');
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -882,7 +882,7 @@ abstract class moodleform_mod extends moodleform {
|
||||
grade_get_categories_menu($COURSE->id, $this->_outcomesused));
|
||||
$mform->addHelpButton('gradecat', 'gradecategoryonmodform', 'grades');
|
||||
if (!$this->_features->rating) {
|
||||
$mform->disabledIf('gradecat', 'grade[modgrade_type]', 'eq', 'none');
|
||||
$mform->hideIf('gradecat', 'grade[modgrade_type]', 'eq', 'none');
|
||||
}
|
||||
}
|
||||
|
||||
@ -892,9 +892,9 @@ abstract class moodleform_mod extends moodleform {
|
||||
$mform->setDefault('gradepass', '');
|
||||
$mform->setType('gradepass', PARAM_RAW);
|
||||
if (!$this->_features->rating) {
|
||||
$mform->disabledIf('gradepass', 'grade[modgrade_type]', 'eq', 'none');
|
||||
$mform->hideIf('gradepass', 'grade[modgrade_type]', 'eq', 'none');
|
||||
} else {
|
||||
$mform->disabledIf('gradepass', 'assessed', 'eq', '0');
|
||||
$mform->hideIf('gradepass', 'assessed', 'eq', '0');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -349,9 +349,9 @@ class MoodleQuickForm_modgrade extends MoodleQuickForm_group {
|
||||
$name = $arg[0];
|
||||
|
||||
// Set disable actions.
|
||||
$caller->disabledIf($name.'[modgrade_scale]', $name.'[modgrade_type]', 'neq', 'scale');
|
||||
$caller->disabledIf($name.'[modgrade_point]', $name.'[modgrade_type]', 'neq', 'point');
|
||||
$caller->disabledIf($name.'[modgrade_rescalegrades]', $name.'[modgrade_type]', 'neq', 'point');
|
||||
$caller->hideIf($name.'[modgrade_scale]', $name.'[modgrade_type]', 'neq', 'scale');
|
||||
$caller->hideIf($name.'[modgrade_point]', $name.'[modgrade_type]', 'neq', 'point');
|
||||
$caller->hideIf($name.'[modgrade_rescalegrades]', $name.'[modgrade_type]', 'neq', 'point');
|
||||
|
||||
// Set validation rules for the sub-elements belonging to this element.
|
||||
// A handy note: the parent scope of a closure is the function in which the closure was declared.
|
||||
|
Loading…
x
Reference in New Issue
Block a user