From: rkingdon Date: Sun, 8 Aug 2004 15:56:41 +0000 (+0000) Subject: In Separate Group mode students now see only students in their own group. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=20cfa94262859f5d4ae95ee0bc802af2f0084315;p=moodle.git In Separate Group mode students now see only students in their own group. --- diff --git a/mod/dialogue/locallib.php b/mod/dialogue/locallib.php index 5a632aa585..764026d6f2 100644 --- a/mod/dialogue/locallib.php +++ b/mod/dialogue/locallib.php @@ -133,10 +133,14 @@ 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); // add current group before list of students if it's the teacher if (isteacher($course->id) and groupmode($course)) { // show teacher their current group - $groupid = get_current_group($course->id); if ($groupid) { if (!$group = get_record("groups", "id", $groupid)) { error("Dialogue get available students: group not found"); @@ -152,13 +156,19 @@ global $USER; foreach ($users as $otheruser) { // ...exclude self and... if ($USER->id != $otheruser->id) { - // if teacher and groups then exclude students not in the current group + // ...if teacher and groups then exclude students not in the current group if (isteacher($course->id) and groupmode($course) and $groupid) { if (!ismember($groupid, $otheruser->id)) { continue; } } - // ...any already in any open conversations unless multiple conversations allowed + // ...if student and groupmode is SEPARATEGROUPS then exclude students not in student's group + if (isstudent($course->id) and (groupmode($course, $cm) == SEPARATEGROUPS)) { + if (!ismember($groupid, $otheruser->id)) { + continue; + } + } + // ... and any already in any open conversations unless multiple conversations allowed if ($dialogue->multipleconversations or count_records_select("dialogue_conversations", "dialogueid = $dialogue->id AND ((userid = $USER->id AND recipientid = $otheruser->id) OR