MDL-30764 Activity settings: do not disable grouping dropdown if it is already set

This commit is contained in:
sam marshall 2011-12-15 16:43:12 +00:00
parent acb3bf8ac1
commit 782b21dc0f

View file

@ -173,6 +173,10 @@ abstract class moodleform_mod extends moodleform {
} }
} }
// Don't disable/remove groupingid if it is currently set to something,
// otherwise you cannot turn it off at same time as turning off other
// option (MDL-30764)
if (empty($this->_cm) || !$this->_cm->groupingid) {
if ($mform->elementExists('groupmode') and !$mform->elementExists('groupmembersonly') and empty($COURSE->groupmodeforce)) { if ($mform->elementExists('groupmode') and !$mform->elementExists('groupmembersonly') and empty($COURSE->groupmodeforce)) {
$mform->disabledIf('groupingid', 'groupmode', 'eq', NOGROUPS); $mform->disabledIf('groupingid', 'groupmode', 'eq', NOGROUPS);
@ -185,6 +189,7 @@ abstract class moodleform_mod extends moodleform {
$mform->removeElement('groupingid'); $mform->removeElement('groupingid');
} }
} }
}
// Completion: If necessary, freeze fields // Completion: If necessary, freeze fields
$completion = new completion_info($COURSE); $completion = new completion_info($COURSE);