]> git.mjollnir.org Git - moodle.git/commitdiff
Hide users in "hidden" chats from students. bug 1308
authormoodler <moodler>
Wed, 5 May 2004 08:19:03 +0000 (08:19 +0000)
committermoodler <moodler>
Wed, 5 May 2004 08:19:03 +0000 (08:19 +0000)
mod/chat/lib.php

index 594c5b817117864286d023cbce97785f1f5a4be7..04bc0eba688782f00f14a47a9b093ac5148b5ced 100644 (file)
@@ -151,8 +151,9 @@ function chat_print_recent_activity($course, $isteacher, $timestart) {
         return false;
     }
 
-    print_headline(get_string("currentchats", "chat").":");
+    $isteacher = isteacher($course->id);
 
+    $outputstarted = false;
     $current = 0;
     foreach ($chatusers as $chatuser) {
         if ($current != $chatuser->chatid) {
@@ -160,6 +161,13 @@ function chat_print_recent_activity($course, $isteacher, $timestart) {
                 echo "</p>";
             }
             if ($chat = get_record("chat", "id", $chatuser->chatid)) {
+                if (!($isteacher or instance_is_visible('chat', $chat))) {  // Chat hidden to students
+                    continue;
+                }
+                if (!$outputstarted) {
+                    print_headline(get_string("currentchats", "chat").":");
+                    $outputstarted = true;
+                }
                 echo "<p><font size=1><a href=\"$CFG->wwwroot/mod/chat/view.php?c=$chat->id\">$chat->name</a></font><br />";
             }
             $current = $chatuser->chatid;