]> git.mjollnir.org Git - moodle.git/commitdiff
Use the new short way of setting up groups
authormoodler <moodler>
Sun, 15 Feb 2004 07:18:07 +0000 (07:18 +0000)
committermoodler <moodler>
Sun, 15 Feb 2004 07:18:07 +0000 (07:18 +0000)
mod/assignment/submissions.php
mod/journal/report.php
mod/quiz/report/overview/report.php
mod/quiz/report/simplestat/report.php

index 15d02c328b6f160f250445f9f9ae9f5dd1fe1e8f..0d7f626db47cdebca848ea2d912f41b60654d1cf 100644 (file)
                   <a href=\"view.php?a=$assignment->id\">$assignment->name</a> -> $strsubmissions", 
                   "", "", true);
 
-/// Check to see if groups are being used in this forum
-/// and if so, set $currentgroup to reflect the current group
-
-    $groupmode = groupmode($course, $cm);   // Groups are being used
-    $currentgroup = get_and_set_current_group($course, $groupmode, $_GET['group']);
-
-    if (!isteacheredit($course->id) and $groupmode and !$currentgroup) {
-        print_heading("Sorry, but you can't see this group");
-        print_footer();
-        exit;
-    }
-
-    if ($groupmode == VISIBLEGROUPS or ($groupmode and isteacheredit($course->id))) {
-        if ($groups = get_records_menu("groups", "courseid", $course->id, "name ASC", "id,name")) {
-            echo '<table align="center"><tr><td>';
-            if ($groupmode == VISIBLEGROUPS) {
-                print_string('groupsvisible');
-            } else {
-                print_string('groupsseparate');
-            }
-            echo ':';
-            echo '</td><td nowrap="nowrap" align="left" width="50%">';
-            popup_form("submissions.php?id=$assignment->id&sort=$sort&dir=$dir&group=", 
-                       $groups, 'selectgroup', $currentgroup, "", "", "", false, "self");
-            echo '</tr></table>';
-        }
+/// Check to see if groups are being used in this assignment
+    if ($groupmode = groupmode($course, $cm)) {   // Groups are being used
+        $currentgroup = setup_and_print_groups($course, $groupmode, "submissions.php?id=$assignment->id&sort=$sort&dir=$dir");
+    } else {
+        $currentgroup = false;
     }
 
-
 /// Get all teachers and students
     $teachers = get_course_teachers($course->id);
 
 
     // Submission sorting
 
-
     $sorttypes = array('firstname', 'lastname', 'timemodified', 'grade');
 
     print_simple_box_start("center", "50%");
index 34372bcf15ede7793299dbe0c6ddc8455f7d9f74..7c83c4a5e346a3ba20ef17657e2df6d5696ffb95 100644 (file)
 
 
 /// Check to see if groups are being used in this journal
-/// and if so, set $currentgroup to reflect the current group
-
-    $groupmode = groupmode($course, $cm);   // Groups are being used
-    $currentgroup = get_and_set_current_group($course, $groupmode, $_GET['group']);
-
-    if (!isteacheredit($course->id) and $groupmode and !$currentgroup) {
-        print_heading("Sorry, but you can't see this group");
-        print_footer();
-        exit;
-    }
-
-    if ($groupmode == VISIBLEGROUPS or ($groupmode and isteacheredit($course->id))) {
-        if ($groups = get_records_menu("groups", "courseid", $course->id, "name ASC", "id,name")) {
-            echo '<table align="center"><tr><td>';
-            if ($groupmode == VISIBLEGROUPS) {
-                print_string('groupsvisible');
-            } else {
-                print_string('groupsseparate');
-            }
-            echo ':';
-            echo '</td><td nowrap="nowrap" align="left" width="50%">';
-            popup_form("report.php?id=$cm->id&sort=$sort&dir=$dir&group=", 
-                       $groups, 'selectgroup', $currentgroup, "", "", "", false, "self");
-            echo '</tr></table>';
-        }
+    if ($groupmode = groupmode($course, $cm)) {   // Groups are being used
+        $currentgroup = setup_and_print_groups($course, $groupmode, "report.php?id=$cm->id");
+    } else {
+        $currentgroup = false;
     }
 
-
 /// Process incoming data if there is any
     if ($data = data_submitted()) {
        
index 79e0652ff7b94c8f4ad9b487e55190abbdeb2ab1..073cfc598d7ced87deda88669a86a331154704ec 100644 (file)
@@ -68,34 +68,12 @@ class quiz_report extends quiz_default_report {
         }
 
     /// Check to see if groups are being used in this quiz
-    /// and if so, set $currentgroup to reflect the current group
-
-        $groupmode = groupmode($course, $cm);   // Groups are being used
-        $currentgroup = get_and_set_current_group($course, $groupmode, $_GET['group']);
-
-        if ($groupmode and !$currentgroup and !isteacheredit($course->id)) {
-            print_heading("Sorry, but you can't see this group");
-            print_footer();
-            exit;
+        if ($groupmode = groupmode($course, $cm)) {   // Groups are being used
+            $currentgroup = setup_and_print_groups($course, $groupmode, "report.php?id=$cm->id&mode=overview");
+        } else {
+            $currentgroup = false;
         }
 
-        if ($groupmode == VISIBLEGROUPS or ($groupmode and isteacheredit($course->id))) {
-            if ($groups = get_records_menu("groups", "courseid", $course->id, "name ASC", "id,name")) {
-                echo '<table align="center"><tr><td>';
-                if ($groupmode == VISIBLEGROUPS) {
-                    print_string('groupsvisible');
-                } else {
-                    print_string('groupsseparate');
-                }
-                echo ':';
-                echo '</td><td nowrap="nowrap" align="left" width="50%">';
-                popup_form("report.php?id=$cm->id&mode=overview&group=", 
-                           $groups, 'selectgroup', $currentgroup, "", "", "", false, "self");
-                echo '</tr></table>';
-            }
-        }
-
-
     /// Get all teachers and students
         if ($currentgroup) {
             $users = get_users_in_group($currentgroup);
index 2d2c5b997b3424e34ac649b1d9ecf690c2ed587c..b5ca2c348092651a04b548f70887a87ff0323451 100644 (file)
@@ -12,34 +12,12 @@ class quiz_report extends quiz_default_report {
         optional_variable($download, "");
 
     /// Check to see if groups are being used in this quiz
-    /// and if so, set $currentgroup to reflect the current group
-
-        $groupmode = groupmode($course, $cm);   // Groups are being used
-        $currentgroup = get_and_set_current_group($course, $groupmode, $_GET['group']);
-
-        if ($groupmode and !$currentgroup and !isteacheredit($course->id)) {
-            print_heading("Sorry, but you can't see this group");
-            print_footer();
-            exit;
-        }
-
-        if ($groupmode == VISIBLEGROUPS or ($groupmode and isteacheredit($course->id))) {
-            if ($groups = get_records_menu("groups", "courseid", $course->id, "name ASC", "id,name")) {
-                echo '<table align="center"><tr><td>';
-                if ($groupmode == VISIBLEGROUPS) {
-                    print_string('groupsvisible');
-                } else {
-                    print_string('groupsseparate');
-                }
-                echo ':';
-                echo '</td><td nowrap="nowrap" align="left" width="50%">';
-                popup_form("report.php?id=$cm->id&mode=simplestat&group=", 
-                           $groups, 'selectgroup', $currentgroup, "", "", "", false, "self");
-                echo '</tr></table>';
-            }
+        if ($groupmode = groupmode($course, $cm)) {   // Groups are being used
+            $currentgroup = setup_and_print_groups($course, $groupmode, "report.php?id=$cm->id&mode=simplestat");
+        } else {
+            $currentgroup = false;
         }
 
-
         if ($currentgroup) {
             $users = get_users_in_group($currentgroup, "u.lastname ASC");
         } else {