]> git.mjollnir.org Git - moodle.git/commitdiff
In SEPARATEGROUPS mode the student's list of teachers is now limited to
authorrkingdon <rkingdon>
Mon, 20 Sep 2004 13:04:56 +0000 (13:04 +0000)
committerrkingdon <rkingdon>
Mon, 20 Sep 2004 13:04:56 +0000 (13:04 +0000)
those in the student's group.

mod/dialogue/locallib.php

index e5d11623a2791779dfa48521e3ed38533a91c70a..2d8ffec06a7b32991e8c07068c87b795be09c84b 100644 (file)
@@ -204,12 +204,23 @@ global $USER;
     if (! $course = get_record("course", "id", $dialogue->course)) {
         error("Course is misconfigured");
         }
+    if (! $cm = get_coursemodule_from_instance("dialogue", $dialogue->id, $course->id)) {
+        error("Course Module ID was incorrect");
+    }
+
+    $groupid = get_current_group($course->id);
     // get the teachers on this course (default sort order)...
     if ($users = get_course_teachers($course->id)) {
         // $names[0] = "-----------------------";
         foreach ($users as $otheruser) {
             // ...exclude self and ...
             if ($USER->id != $otheruser->id) {
+                // ...if groupmode is SEPARATEGROUPS then exclude teachers not in student's group
+                if ($groupid and (groupmode($course, $cm) == SEPARATEGROUPS)) {
+                    if (!ismember($groupid, $otheruser->id)) {
+                        continue;
+                    }
+                }
                 // ...any already in open conversations unless multiple conversations allowed 
                 if ($dialogue->multipleconversations or count_records_select("dialogue_conversations", 
                         "dialogueid = $dialogue->id AND ((userid = $USER->id AND