Fixes Bug MDL-8533 "Can't add a user to more than 1 group in groupings" (merge from HEAD)
This commit is contained in:
+14
-11
@@ -23,7 +23,11 @@ $groupid = required_param('group', PARAM_INT);
|
||||
$course = groups_get_course_info($courseid);
|
||||
if (! $course) {
|
||||
$success = false;
|
||||
print_error('The course ID is invalid');
|
||||
print_error('invalidcourse');
|
||||
}
|
||||
if (empty($groupid)) {
|
||||
$success = false;
|
||||
print_error('errorinvalidgroup', 'group', groups_home_url($courseid));
|
||||
}
|
||||
|
||||
if ($success) {
|
||||
@@ -47,10 +51,9 @@ if ($success) {
|
||||
if (! $userid = clean_param($userid, PARAM_INT)) {
|
||||
continue;
|
||||
}
|
||||
//echo "Try user $userid, group $groupid<br/>\n";
|
||||
$success = groups_add_member($groupid, $userid);
|
||||
if (! $success) {
|
||||
print_error('Failed to add user $userid to group.');
|
||||
print_error('erroraddremoveuser', 'group', groups_home_url($courseid));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,7 +65,7 @@ if ($success) {
|
||||
}
|
||||
$success = groups_remove_member($groupid, $userid);
|
||||
if (! $success) {
|
||||
print_error('Failed to remove user $userid from group.');
|
||||
print_error('erroraddremoveuser', 'group', groups_home_url($courseid));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,7 +83,6 @@ if ($success) {
|
||||
"-> <a href=\"$CFG->wwwroot/user/index.php?id=$courseid\">$strparticipants</a> ".
|
||||
"-> $strgroups", '', '', true, '', user_login_string($course, $USER));
|
||||
|
||||
//require_once('assign-form.html');
|
||||
?>
|
||||
<div id="addmembersform">
|
||||
<h3 class="main"><?php print_string('adduserstogroup', 'group'); echo " $groupname"; ?></h3>
|
||||
@@ -136,9 +138,10 @@ if ($success) {
|
||||
document.assignform.remove.disabled=true;
|
||||
document.assignform.removeselect.selectedIndex=-1;">
|
||||
<?php
|
||||
$showall = 0;
|
||||
//TODO: If no 'showall' button, then set true.
|
||||
$showall = true;
|
||||
unset($userids);
|
||||
if ($showall == 0 && $groupingid != GROUP_NOT_IN_GROUPING) {
|
||||
if (!$showall && $groupingid != GROUP_NOT_IN_GROUPING) {
|
||||
$userids = groups_get_users_not_in_any_group_in_grouping($courseid, $groupingid, $groupid);
|
||||
} else {
|
||||
$userids = groups_get_users_not_in_group($courseid, $groupid);
|
||||
@@ -159,11 +162,11 @@ if ($success) {
|
||||
?>
|
||||
</select>
|
||||
<br />
|
||||
<?php //TODO: Search box
|
||||
<?php //TODO: Search box?
|
||||
|
||||
if (!empty($searchtext)) {
|
||||
echo '<input name="showall" id="showall" type="submit" value="'.$strshowall.'" />'."\n";
|
||||
}
|
||||
/*if (!empty($searchtext)) {
|
||||
echo '<input name="showall" type="submit" value="'.get_string('showall').'" />'."\n";
|
||||
}*/
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
$string['groupmember'] = 'Group Member';
|
||||
$string['groupmemberdesc'] = 'Standard role for a member of a group.';
|
||||
$string['notingrouping'] = '[Not in a grouping]';
|
||||
$string['anygrouping'] = '[Any grouping]';
|
||||
|
||||
$string['errornotingrouping'] = 'Sorry, you can\'t create a group in $a';
|
||||
$string['errornotingroupingedit'] = 'Sorry, you can\'t edit grouping $a';
|
||||
@@ -18,15 +19,16 @@ $string['errorinvalidgrouping'] = 'Error, invalid grouping $a';
|
||||
$string['errorinvalidgroup'] = 'Error, invalid group $a';
|
||||
$string['erroreditgrouping'] = 'Error creating/updating grouping $a';
|
||||
$string['erroreditgroup'] = 'Error creating/updating group $a';
|
||||
$string['erroraddremoveuser'] = 'Error adding/removing user $a to group';
|
||||
|
||||
$string['upgradeconfirm'] = 'Sorry, groups tables created in Moodle 1.8 dev have to be deleted for this upgrade. Do you want to continue?';
|
||||
$string['upgradeconfirm'] = 'Sorry, groups tables created in Moodle 1.8 DEV have to be deleted for this upgrade. Do you want to continue?';
|
||||
|
||||
$string['groupings'] = 'Groupings';
|
||||
$string['grouping'] = 'Grouping';
|
||||
$string['groups'] = 'Groups';
|
||||
$string['group'] = 'Group';
|
||||
$string['groupsinselectedgrouping'] = 'Groups in selected grouping';
|
||||
$string['membersofselectedgroup'] = 'Members of selected group';
|
||||
$string['groupsinselectedgrouping'] = 'Groups in grouping'; //'selected'
|
||||
$string['membersofselectedgroup'] = 'Members of group';
|
||||
|
||||
$string['showgroupsingrouping'] = 'Show groups in grouping';
|
||||
$string['showmembersforgroup'] = 'Show members for group';
|
||||
@@ -40,17 +42,17 @@ $string['editgroupingpermissions'] = 'Edit grouping permissions';
|
||||
$string['deletegrouping'] = 'Delete grouping';
|
||||
$string['creategrouping'] = 'Create grouping';
|
||||
$string['createautomaticgrouping'] = 'Create automatic grouping';
|
||||
$string['printerfriendly'] = 'Printer-friendly display of grouping';
|
||||
$string['printerfriendly'] = 'Printer-friendly display'; //'of grouping'
|
||||
|
||||
$string['editgroupsettings'] = 'Edit group settings';
|
||||
$string['deleteselectedgroup'] = 'Delete selected group';
|
||||
$string['removegroupfromselectedgrouping'] = 'Remove group from selected grouping';
|
||||
$string['creategroupinselectedgrouping'] = 'Create group in selected grouping';
|
||||
$string['removegroupfromselectedgrouping'] = 'Remove group from grouping'; //'selected'
|
||||
$string['creategroupinselectedgrouping'] = 'Create group in grouping';
|
||||
$string['addexistinggroupstogrouping'] = 'Add existing groups to grouping';
|
||||
$string['addgroupstogrouping'] = 'Add groups to grouping';
|
||||
|
||||
$string['removeselectedusers'] = 'Remove selected users';
|
||||
$string['adduserstogroup'] = 'Add/remove users from group'; //'Add users to group';
|
||||
$string['adduserstogroup'] = 'Add/remove users'; //'from group'
|
||||
|
||||
$string['groupingname'] = 'Grouping name';
|
||||
$string['defaultgroupingname'] = 'Grouping';
|
||||
|
||||
Reference in New Issue
Block a user