From: moodler Date: Thu, 19 Feb 2004 17:57:22 +0000 (+0000) Subject: Cleaned up group menus X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=2ab76925a253139c37e7fa92cc1d28fa87e09c5c;p=moodle.git Cleaned up group menus --- diff --git a/mod/forum/discuss.php b/mod/forum/discuss.php index ef8a79f77d..e9baa094ae 100644 --- a/mod/forum/discuss.php +++ b/mod/forum/discuss.php @@ -133,20 +133,7 @@ if ($groupmode == VISIBLEGROUPS or ($groupmode and isteacheredit($course->id))) { if ($groups = get_records_menu("groups", "courseid", $course->id, "name ASC", "id,name")) { - - echo '
'; - if ($groupmode == VISIBLEGROUPS) { - print_string('groupsvisible'); - } else { - print_string('groupsseparate'); - } - echo ':'; - echo ''; - popup_form("view.php?id=$cm->id&group=", $groups, 'selectgroup', - $discussion->groupid, "", "", "", false, "self"); - echo '
'; - - echo ''; + print_group_menu($groups, $groupmode, $discussion->groupid, "view.php?id=$cm->id&group="); } } diff --git a/mod/forum/view.php b/mod/forum/view.php index a4892ba469..82a3fd12a4 100644 --- a/mod/forum/view.php +++ b/mod/forum/view.php @@ -8,7 +8,7 @@ optional_variable($mode); // Display mode (for single forum) optional_variable($search, ""); // search string optional_variable($showall, ""); // show all discussions on one page - optional_variable($group, ""); // choose the current group + optional_variable($group, -1); // choose the current group $strforums = get_string("modulenameplural", "forum"); $strforum = get_string("modulename", "forum"); @@ -78,12 +78,13 @@ /// Check to see if groups are being used in this forum /// and if so, set $currentgroup to reflect the current group + $changegroup = isset($_GET['group']) ? $_GET['group'] : -1; // Group change requested? $groupmode = groupmode($course, $cm); // Groups are being used - $currentgroup = get_and_set_current_group($course, $groupmode, $_GET['group']); + $currentgroup = get_and_set_current_group($course, $groupmode, $changegroup); - if (!isteacheredit($course->id) and $groupmode and !$currentgroup) { - print_heading("Sorry, but you need to be part of a group to see this forum."); - print_footer(); + if ($groupmode and ($currentgroup === false) and !isteacheredit($course->id)) { + print_heading(get_string("notingroup", "forum")); + print_footer($course); exit; } @@ -95,18 +96,7 @@ if ($groupmode == VISIBLEGROUPS or ($groupmode and isteacheredit($course->id))) { if ($groups = get_records_menu("groups", "courseid", $course->id, "name ASC", "id,name")) { echo ''; - - echo '
'; - if ($groupmode == VISIBLEGROUPS) { - print_string('groupsvisible'); - } else { - print_string('groupsseparate'); - } - echo ':'; - echo ''; - popup_form("view.php?id=$cm->id&group=", $groups, 'selectgroup', $currentgroup, "", "", "", false, "self"); - echo '
'; - + print_group_menu($groups, $groupmode, $currentgroup, "view.php?id=$cm->id&group="); echo ''; } }