]> git.mjollnir.org Git - moodle.git/commitdiff
When separate groups are being used, only show teachers and students who have
authormoodler <moodler>
Sat, 31 Jan 2004 04:08:10 +0000 (04:08 +0000)
committermoodler <moodler>
Sat, 31 Jan 2004 04:08:10 +0000 (04:08 +0000)
access to that group

user/index.php

index 1649917cdbd608af0305b548c5496d5a56a58e5b..ab59a9ac32543b348c553d1d5d6371c900011f06 100644 (file)
         $participantslink = "<a href=\"index.php?id=$course->id\">".get_string("participants")."</a>";
     }
 
+    $isseparategroups = ($course->groupmode == SEPARATEGROUPS and $course->groupmodeforce and 
+                         !isteacheredit($course->id));
+
+    $currentgroup = $isseparategroups ? get_current_group($course->id) : NULL;
+
     if ($course->category) {
         print_header("$course->shortname: ".get_string("participants"), "$course->fullname",
                      "<A HREF=../course/view.php?id=$course->id>$course->shortname</A> -> ".
     }
 
     if ($showteachers) {
-        if ( $teachers = get_course_teachers($course->id)) {
-            echo "<h2 align=center>$course->teachers</h2>";
+        if ($teachers = get_course_teachers($course->id)) {
+            echo "<h2 align=\"center\">$course->teachers</h2>";
             foreach ($teachers as $teacher) {
-                if ($teacher->authority > 0) {    // Don't print teachers with no authority
+                if ($isseparategroups) {
+                    if ($teacher->editall or ismember($currentgroup, $teacher->id)) {
+                        print_user($teacher, $course);
+                    }
+                } else if ($teacher->authority > 0) {    // Don't print teachers with no authority
                     print_user($teacher, $course);
                 }
             }
     }
 
     $students = get_course_students($course->id, $dsort, $dir, $page*$perpage, 
-                                    $perpage, $firstinitial, $lastinitial);
+                                    $perpage, $firstinitial, $lastinitial, $currentgroup);
+
+    $totalcount = count_course_students($course, "", "", "", $currentgroup);
+
+    if ($firstinitial or $lastinitial) {
+        $matchcount = count_course_students($course, "", $firstinitial, $lastinitial, $currentgroup);
+    } else {
+        $matchcount = $totalcount;
+    }
 
-    $totalcount = $matchcount = count_records("user_students", "course", $course->id);
 
     echo "<h2 align=center>$totalcount $course->students</h2>";
 
         echo "</p>";
         echo "</center>";
 
-        $matchcount = count_course_students($course, "", $firstinitial, $lastinitial);
-
         print_paging_bar($matchcount, $page, $perpage, 
                          "index.php?id=$course->id&sort=$sort&dir=$dir&perpage=$perpage&firstinitial=$firstinitial&lastinitial=$lastinitial&");