Skip to content

Commit

Permalink
MDL-30764 Activity settings: do not disable grouping dropdown if it i…
Browse files Browse the repository at this point in the history
…s already set
  • Loading branch information
sammarshallou committed Dec 15, 2011
1 parent f89a83b commit 6d02b26
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions course/moodleform_mod.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,21 @@ function definition_after_data() {
}
}

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')) {
// groupings have no use without groupmode or groupmembersonly
if ($mform->elementExists('groupingid')) {
$mform->removeElement('groupingid');
// 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')) {
// groupings have no use without groupmode or groupmembersonly
if ($mform->elementExists('groupingid')) {
$mform->removeElement('groupingid');
}
}
}

Expand Down

0 comments on commit 6d02b26

Please sign in to comment.