MDL-9038: Groups can now be created outside of any groupings. The number of groups within [Not in a grouping] is also correct now.

This commit is contained in:
nicolasconnault 2007-03-26 08:00:21 +00:00
parent 96c50eddd7
commit 4b3b962514
2 changed files with 17 additions and 2 deletions

View File

@ -68,17 +68,29 @@ if ($success) {
}
elseif (isset($frm->update)) {
if (! $groupid) { //OK, new group.
// Allow groups to be created outside of groupings
/*
if (GROUP_NOT_IN_GROUPING == $groupingid) {
print_error('errornotingrouping', 'group', groups_home_url($courseid), get_string('notingrouping', 'group'));
}
*/
$success = (bool)$groupid = groups_create_group($courseid); //$groupsettings);
$success = groups_add_group_to_grouping($groupid, $groupingid);
if ($groupingid != GROUP_NOT_IN_GROUPING) {
$success = groups_add_group_to_grouping($groupid, $groupingid);
}
}
elseif ($groupingid != $newgrouping) { //OK, move group.
// Allow groups to be created outside of groupings
/*
if (GROUP_NOT_IN_GROUPING == $newgrouping) {
print_error('errornotingrouping', 'group', groups_home_url($courseid), get_string('notingrouping', 'group'));
}
$success = $success && groups_remove_group_from_grouping($groupid, $groupingid);
*/
if ($groupingid != GROUP_NOT_IN_GROUPING) {
$success = $success && groups_remove_group_from_grouping($groupid, $groupingid);
}
$success = $success && groups_add_group_to_grouping($groupid, $newgrouping);
}
if ($success) {

View File

@ -115,9 +115,12 @@ if ($success) {
case 'removegroup':
break;
case 'showcreategroupform':
// Allow groups to be created outside of groupings
/*
if (GROUP_NOT_IN_GROUPING == $groupingid) {
print_error('errornotingrouping', 'group', groups_home_url($courseid), get_string('notingrouping', 'group'));
}
*/
redirect(groups_group_edit_url($courseid, null, $groupingid, false));
break;
case 'addgroupstogroupingform':