MDL-44725 Availability: Replace groupmembersonly - forms (4)
authorsam marshall <s.marshall@open.ac.uk>
Fri, 1 Aug 2014 16:13:05 +0000 (17:13 +0100)
committersam marshall <s.marshall@open.ac.uk>
Tue, 2 Sep 2014 12:03:13 +0000 (13:03 +0100)
Remove groupmembersonly option from module editing forms.

course/modedit.php
course/modlib.php
course/moodleform_mod.php
lang/en/group.php

index a769cca..b2d8ede 100644 (file)
@@ -73,7 +73,6 @@ if (!empty($add)) {
     $data->modulename       = $module->name;
     $data->groupmode        = $course->groupmode;
     $data->groupingid       = $course->defaultgroupingid;
-    $data->groupmembersonly = 0;
     $data->id               = '';
     $data->instance         = '';
     $data->coursemodule     = '';
@@ -146,7 +145,6 @@ if (!empty($add)) {
     $data->cmidnumber         = $cm->idnumber;          // The cm IDnumber
     $data->groupmode          = groups_get_activity_groupmode($cm); // locked later if forced
     $data->groupingid         = $cm->groupingid;
-    $data->groupmembersonly   = $cm->groupmembersonly;
     $data->course             = $course->id;
     $data->module             = $module->id;
     $data->modulename         = $module->name;
index 14c91bf..da7292d 100644 (file)
@@ -66,7 +66,6 @@ function add_moduleinfo($moduleinfo, $course, $mform = null) {
     }
     $newcm->groupmode        = $moduleinfo->groupmode;
     $newcm->groupingid       = $moduleinfo->groupingid;
-    $newcm->groupmembersonly = $moduleinfo->groupmembersonly;
     $completion = new completion_info($course);
     if ($completion->is_enabled()) {
         $newcm->completion                = $moduleinfo->completion;
@@ -358,10 +357,6 @@ function set_moduleinfo_defaults($moduleinfo) {
         $moduleinfo->groupingid = 0;
     }
 
-    if (!isset($moduleinfo->groupmembersonly)) {
-        $moduleinfo->groupmembersonly = 0;
-    }
-
     if (!isset($moduleinfo->name)) { // Label.
         $moduleinfo->name = $moduleinfo->modulename;
     }
@@ -477,9 +472,6 @@ function update_moduleinfo($cm, $moduleinfo, $course, $mform = null) {
     if (isset($moduleinfo->groupingid)) {
         $cm->groupingid = $moduleinfo->groupingid;
     }
-    if (isset($moduleinfo->groupmembersonly)) {
-        $cm->groupmembersonly = $moduleinfo->groupmembersonly;
-    }
 
     $completion = new completion_info($course);
     if ($completion->is_enabled() && !empty($moduleinfo->completionunlocked)) {
index acd66f5..1f5b051 100644 (file)
@@ -92,7 +92,6 @@ abstract class moodleform_mod extends moodleform {
         $this->_features = new stdClass();
         $this->_features->groups            = plugin_supports('mod', $this->_modname, FEATURE_GROUPS, true);
         $this->_features->groupings         = plugin_supports('mod', $this->_modname, FEATURE_GROUPINGS, false);
-        $this->_features->groupmembersonly  = (!empty($CFG->enablegroupmembersonly) and plugin_supports('mod', $this->_modname, FEATURE_GROUPMEMBERSONLY, false));
         $this->_features->outcomes          = (!empty($CFG->enableoutcomes) and plugin_supports('mod', $this->_modname, FEATURE_GRADE_OUTCOMES, true));
         $this->_features->hasgrades         = plugin_supports('mod', $this->_modname, FEATURE_GRADE_HAS_GRADE, false);
         $this->_features->idnumber          = plugin_supports('mod', $this->_modname, FEATURE_IDNUMBER, true);
@@ -192,14 +191,11 @@ abstract class moodleform_mod extends moodleform {
         // 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') && 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
+            } else if (!$mform->elementExists('groupmode')) {
+                // Groupings have no use without groupmode.
                 if ($mform->elementExists('groupingid')) {
                     $mform->removeElement('groupingid');
                 }
@@ -417,8 +413,8 @@ abstract class moodleform_mod extends moodleform {
             $mform->addHelpButton('groupmode', 'groupmode', 'group');
         }
 
-        if ($this->_features->groupings or $this->_features->groupmembersonly) {
-            //groupings selector - used for normal grouping mode or also when restricting access with groupmembersonly
+        if ($this->_features->groupings) {
+            // Groupings selector - used to select grouping for groups in activity.
             $options = array();
             if ($groupings = $DB->get_records('groupings', array('courseid'=>$COURSE->id))) {
                 foreach ($groupings as $grouping) {
@@ -431,11 +427,6 @@ abstract class moodleform_mod extends moodleform {
             $mform->addHelpButton('groupingid', 'grouping', 'group');
         }
 
-        if ($this->_features->groupmembersonly) {
-            $mform->addElement('checkbox', 'groupmembersonly', get_string('groupmembersonly', 'group'));
-            $mform->addHelpButton('groupmembersonly', 'groupmembersonly', 'group');
-        }
-
         if (!empty($CFG->enableavailability)) {
             // Availability field. This is just a textarea; the user interface
             // interaction is all implemented in JavaScript.
index 46c1d93..63f3bb6 100644 (file)
@@ -101,9 +101,6 @@ $string['groupingsonly'] = 'Groupings only';
 $string['groupmember'] = 'Group member';
 $string['groupmemberdesc'] = 'Standard role for a member of a group.';
 $string['groupmembers'] = 'Group members';
-$string['groupmembersonly'] = 'Available for group members only';
-$string['groupmembersonly_help'] = 'If this checkbox is ticked, the activity (or resource) will only be available to students assigned to groups within the selected grouping.';
-$string['groupmembersonlyerror'] = 'Sorry, you must be member of at least one group that is used in this activity.';
 $string['groupmemberssee'] = 'See group members';
 $string['groupmembersselected'] = 'Members of selected group';
 $string['groupmode'] = 'Group mode';