]> git.mjollnir.org Git - moodle.git/commitdiff
Chat now prints something useful under recent activity
authormoodler <moodler>
Thu, 10 Jul 2003 04:46:03 +0000 (04:46 +0000)
committermoodler <moodler>
Thu, 10 Jul 2003 04:46:03 +0000 (04:46 +0000)
lang/en/chat.php
mod/chat/lib.php

index ed309e9a00f295ae53782310a3e624b2c7a96b9e..163fb0c6a80713db087db356dd6c0bdd8a026b17 100644 (file)
@@ -8,6 +8,7 @@ $string['modulenameplural'] = "Chats";
 $string['beep'] = "beep";
 $string['chatintro'] = "Introduction text";
 $string['chatname'] = "Name of this chat room";
+$string['currentchats'] = "Currently active chats";
 $string['enterchat'] = "Click here to enter the chat";
 $string['idle'] = "Idle";
 $string['messagebeepseveryone'] = "\$a beeps everyone!";
index 6320a5ed7200641c5d5613fbf8a1fe59d0cca94f..2c38cd49126ada55d4e037f45f6205d2b4b5b3fc 100644 (file)
@@ -91,15 +91,38 @@ function chat_user_complete($course, $user, $mod, $chat) {
     return true;
 }
 
-function chat_print_recent_activity(&$logs, $isteacher=false) {
-/// Given a list of logs, assumed to be those since the last login 
-/// this function prints a short list of changes related to this module
-/// If isteacher is true then perhaps additional information is printed.
+function chat_print_recent_activity($course, $isteacher, $timestart) {
+/// Given a course and a date, prints a summary of all chat rooms
+/// that currently have people in them.
 /// This function is called from course/lib.php: print_recent_activity()
 
-    global $CFG, $COURSE_TEACHER_COLOR;
+    global $CFG;
+
+    if (!$chatusers = get_records_sql("SELECT cu.chatid, u.firstname, u.lastname
+                                        FROM {$CFG->prefix}chat_users as cu,
+                                             {$CFG->prefix}user as u
+                                       WHERE cu.userid = u.id 
+                                       ORDER BY cu.chatid ASC") ) {
+        return false;
+    }
+
+    print_headline(get_string("currentchats", "chat").":");
 
-    return $content;  // True if anything was printed, otherwise false
+    $current = 0;
+    foreach ($chatusers as $chatuser) {
+        if ($current != $chatuser->chatid) {
+            if ($current) {
+                echo "</p>";
+            }
+            if ($chat = get_record("chat", "id", $chatuser->chatid)) {
+                echo "<p><font size=1><a href=\"$CFG->wwwroot/mod/chat/view.php?c=$chat->id\">$chat->name</a></font><br />";
+            }
+            $current = $chatuser->chatid;
+        }
+        echo "&nbsp;&nbsp;&nbsp;<font size=1>- $chatuser->firstname $chatuser->lastname</font><br />";
+    }
+
+    return true;
 }
 
 function chat_cron () {