diff --git a/group/index.php b/group/index.php index fd9bef51da8..7c89781ddcc 100644 --- a/group/index.php +++ b/group/index.php @@ -67,6 +67,9 @@ if ($success) { switch ($action) { + case false: //OK, display form. + break; + case 'ajax_getgroupsingrouping': if (GROUP_NOT_IN_GROUPING == $groupingid) { $groupids = groups_get_groups_not_in_any_grouping($courseid); @@ -94,6 +97,7 @@ if ($success) { case 'showgroupingpermsform': break; case 'deletegrouping': + redirect(groups_grouping_edit_url($courseid, $groupingid, $html=false, $param='delete=1')); break; case 'showcreategroupingform': redirect(groups_grouping_edit_url($courseid, null, false)); @@ -106,7 +110,7 @@ if ($success) { redirect(groups_group_edit_url($courseid, $groupid, $groupingid, false)); break; case 'deletegroup': - redirect(groups_group_edit_url($courseid, $groupid, $groupingid, false, 'delete=1')); + redirect(groups_group_edit_url($courseid, $groupid, $groupingid, $html=false, $param='delete=1')); break; case 'removegroup': break; @@ -128,11 +132,13 @@ if ($success) { break; case 'updatemembers': //Currently reloading. break; - default: - //print_error('Unknown action.'); - break; - } + default: //ERROR. + if (debugging()) { + error('Error, unknown button/action. Probably a user-interface bug!', groups_home_url($courseid)); + break; + } + } // Print the page and form $strgroups = get_string('groups'); @@ -198,8 +204,8 @@ if ($success) {

-

+

@@ -254,7 +260,7 @@ if ($success) { } if (isset($userids)) { //&& is_array($userids) // Put the groupings into a hash and sort them - $user_names = groups_userids_to_user_names($userids); + $user_names = groups_userids_to_user_names($userids, $courseid); foreach ($user_names as $user) { echo "\n"; @@ -271,7 +277,7 @@ if ($success) { - + ?> wwwroot.'/group/grouping.php?courseid='.$courseid; if ($groupingid) { $url .= $sep.'grouping='.$groupingid; } + if ($param) { + $url .= $sep.$param; + } return $url; } -/** Internal use only. */ +/** + * Return the address for the add/remove users page - Internal group use only. + * @param $courseid + * @param $groupid + * @param $groupingid Default false, or optionally a grouping ID. + * @param $html Default true for HTML pages, eg. on error. False for HTTP redirects. + * @return string An absolute URL. + */ function groups_members_add_url($courseid, $groupid, $groupingid=false, $html=true) { global $CFG; $html ? $sep = '&' : $sep = '&'; @@ -323,8 +341,12 @@ function groups_members_add_url($courseid, $groupid, $groupingid=false, $html=tr } /** - * Return the address for the main group management page. - * (For admin block.) + * Return the address for the main group management page. (For admin block etc.) + * @param $courseid + * @param $groupid Default false, or optionally a group ID. + * @param $groupingid Default false, or optionally a grouping ID. + * @param $html Default true for HTML pages, eg. on error. False for HTTP redirects. + * @return string An absolute URL. */ function groups_home_url($courseid, $groupid=false, $groupingid=false, $html=true) { global $CFG;