Permalink
Browse files

Merge branch 'MDL-30764-m22' of git://github.com/sammarshallou/moodle…

… into MOODLE_22_STABLE
  • Loading branch information...
2 parents 2df28fd + 782b21d commit 0cba7c0408f54453c61170cc1831291b22491038 Sam Hemelryk committed Dec 20, 2011
Showing with 15 additions and 10 deletions.
  1. +15 −10 course/moodleform_mod.php
@@ -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');
+ }
}
}

0 comments on commit 0cba7c0

Please sign in to comment.