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 acb3bf8 commit 782b21d
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions course/moodleform_mod.php
Original file line number Original file line 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)) { // Don't disable/remove groupingid if it is currently set to something,
$mform->disabledIf('groupingid', 'groupmode', 'eq', NOGROUPS); // otherwise you cannot turn it off at same time as turning off other

// option (MDL-30764)
} else if (!$mform->elementExists('groupmode') and $mform->elementExists('groupmembersonly')) { if (empty($this->_cm) || !$this->_cm->groupingid) {
$mform->disabledIf('groupingid', 'groupmembersonly', 'notchecked'); 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')) {
// groupings have no use without groupmode or groupmembersonly } else if (!$mform->elementExists('groupmode') and $mform->elementExists('groupmembersonly')) {
if ($mform->elementExists('groupingid')) { $mform->disabledIf('groupingid', 'groupmembersonly', 'notchecked');
$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');
}
} }
} }


Expand Down

0 comments on commit 782b21d

Please sign in to comment.