MDL-30764 Activity settings: do not disable grouping dropdown if it is already set
This commit is contained in:
@@ -173,16 +173,21 @@ abstract class moodleform_mod extends moodleform {
|
||||
}
|
||||
}
|
||||
|
||||
if ($mform->elementExists('groupmode') and !$mform->elementExists('groupmembersonly') and empty($COURSE->groupmodeforce)) {
|
||||
$mform->disabledIf('groupingid', 'groupmode', 'eq', NOGROUPS);
|
||||
// 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)) {
|
||||
$mform->disabledIf('groupingid', 'groupmode', 'eq', NOGROUPS);
|
||||
|
||||
} else if (!$mform->elementExists('groupmode') and $mform->elementExists('groupmembersonly')) {
|
||||
$mform->disabledIf('groupingid', 'groupmembersonly', 'notchecked');
|
||||
} else if (!$mform->elementExists('groupmode') and $mform->elementExists('groupmembersonly')) {
|
||||
$mform->disabledIf('groupingid', 'groupmembersonly', 'notchecked');
|
||||
|
||||
} else if (!$mform->elementExists('groupmode') and !$mform->elementExists('groupmembersonly')) {
|
||||
// groupings have no use without groupmode or groupmembersonly
|
||||
if ($mform->elementExists('groupingid')) {
|
||||
$mform->removeElement('groupingid');
|
||||
} else if (!$mform->elementExists('groupmode') and !$mform->elementExists('groupmembersonly')) {
|
||||
// groupings have no use without groupmode or groupmembersonly
|
||||
if ($mform->elementExists('groupingid')) {
|
||||
$mform->removeElement('groupingid');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user