]> git.mjollnir.org Git - moodle.git/commitdiff
Cleaned up group menus
authormoodler <moodler>
Thu, 19 Feb 2004 17:57:22 +0000 (17:57 +0000)
committermoodler <moodler>
Thu, 19 Feb 2004 17:57:22 +0000 (17:57 +0000)
mod/forum/discuss.php
mod/forum/view.php

index ef8a79f77dc8f526d1720091d429ce41d69676e9..e9baa094aee5c10bada0e775c4c6f42c54bfa9b8 100644 (file)
 
     if ($groupmode == VISIBLEGROUPS or ($groupmode and isteacheredit($course->id))) {
         if ($groups = get_records_menu("groups", "courseid", $course->id, "name ASC", "id,name")) {
-
-            echo '<table><tr><td>';
-            if ($groupmode == VISIBLEGROUPS) {
-                print_string('groupsvisible');
-            } else {
-                print_string('groupsseparate');
-            }
-            echo ':';
-            echo '</td><td nowrap="nowrap" align="left" width="50%">';
-            popup_form("view.php?id=$cm->id&group=", $groups, 'selectgroup', 
-                       $discussion->groupid, "", "", "", false, "self");
-            echo '</tr></table>';
-
-            echo '</td>';
+            print_group_menu($groups, $groupmode, $discussion->groupid, "view.php?id=$cm->id&group=");
         }
     }
 
index a4892ba469407a91de6806b2b34e20a6368f40cc..82a3fd12a4dc709320ba1d2e65e0a0839b9a3fa3 100644 (file)
@@ -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");
 /// 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;
     }
 
     if ($groupmode == VISIBLEGROUPS or ($groupmode and isteacheredit($course->id))) {
         if ($groups = get_records_menu("groups", "courseid", $course->id, "name ASC", "id,name")) {
             echo '<td>';
-
-            echo '<table><tr><td>';
-            if ($groupmode == VISIBLEGROUPS) {
-                print_string('groupsvisible');
-            } else {
-                print_string('groupsseparate');
-            }
-            echo ':';
-            echo '</td><td nowrap="nowrap" align="left" width="50%">';
-            popup_form("view.php?id=$cm->id&group=", $groups, 'selectgroup', $currentgroup, "", "", "", false, "self");
-            echo '</tr></table>';
-
+            print_group_menu($groups, $groupmode, $currentgroup, "view.php?id=$cm->id&group=");
             echo '</td>';
         }
     }