From 2cb2ce61ad95919cd343aea8ac9ffaef61b75bf6 Mon Sep 17 00:00:00 2001 From: moodler Date: Sat, 31 Jan 2004 04:08:10 +0000 Subject: [PATCH] When separate groups are being used, only show teachers and students who have access to that group --- user/index.php | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/user/index.php b/user/index.php index 1649917cdb..ab59a9ac32 100644 --- a/user/index.php +++ b/user/index.php @@ -33,6 +33,11 @@ $participantslink = "id\">".get_string("participants").""; } + $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", "id>$course->shortname -> ". @@ -43,10 +48,14 @@ } if ($showteachers) { - if ( $teachers = get_course_teachers($course->id)) { - echo "

$course->teachers

"; + if ($teachers = get_course_teachers($course->id)) { + echo "

$course->teachers

"; 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); } } @@ -60,9 +69,16 @@ } $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 "

$totalcount $course->students

"; @@ -119,8 +135,6 @@ echo "

"; echo ""; - $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&"); -- 2.39.5