From 2c0d65743789f43b99038740106df0fb17e97899 Mon Sep 17 00:00:00 2001 From: moodler Date: Fri, 30 Apr 2004 12:40:42 +0000 Subject: [PATCH] Chat now logs "talk" events ... which also updates last access in the course so chatters appear in the online users block so Tom is happy. :-) Seriously though, it's good to have talking events in the log. --- mod/chat/db/mysql.php | 4 ++++ mod/chat/db/mysql.sql | 1 + mod/chat/db/postgres7.php | 4 ++++ mod/chat/db/postgres7.sql | 1 + mod/chat/insert.php | 6 +++++- mod/chat/version.php | 2 +- 6 files changed, 16 insertions(+), 2 deletions(-) diff --git a/mod/chat/db/mysql.php b/mod/chat/db/mysql.php index 6270ccc7a8..1bb74215a3 100644 --- a/mod/chat/db/mysql.php +++ b/mod/chat/db/mysql.php @@ -33,6 +33,10 @@ function chat_upgrade($oldversion) { chat_refresh_events(); } + if ($oldversion < 2004043000) { + modify_database("", "INSERT INTO prefix_log_display VALUES ('chat', 'talk', 'chat', 'name');"); + } + return true; } diff --git a/mod/chat/db/mysql.sql b/mod/chat/db/mysql.sql index d11b71c1a5..6efe107078 100644 --- a/mod/chat/db/mysql.sql +++ b/mod/chat/db/mysql.sql @@ -58,4 +58,5 @@ INSERT INTO prefix_log_display VALUES ('chat', 'view', 'chat', 'name'); INSERT INTO prefix_log_display VALUES ('chat', 'add', 'chat', 'name'); INSERT INTO prefix_log_display VALUES ('chat', 'update', 'chat', 'name'); INSERT INTO prefix_log_display VALUES ('chat', 'report', 'chat', 'name'); +INSERT INTO prefix_log_display VALUES ('chat', 'talk', 'chat', 'name'); diff --git a/mod/chat/db/postgres7.php b/mod/chat/db/postgres7.php index caf36d0120..5857707014 100644 --- a/mod/chat/db/postgres7.php +++ b/mod/chat/db/postgres7.php @@ -16,6 +16,10 @@ function chat_upgrade($oldversion) { chat_refresh_events(); } + if ($oldversion < 2004043000) { + modify_database("", "INSERT INTO prefix_log_display VALUES ('chat', 'talk', 'chat', 'name');"); + } + return true; } diff --git a/mod/chat/db/postgres7.sql b/mod/chat/db/postgres7.sql index bbdca03d58..b77d1187f1 100644 --- a/mod/chat/db/postgres7.sql +++ b/mod/chat/db/postgres7.sql @@ -55,3 +55,4 @@ INSERT INTO prefix_log_display VALUES ('chat', 'view', 'chat', 'name'); INSERT INTO prefix_log_display VALUES ('chat', 'add', 'chat', 'name'); INSERT INTO prefix_log_display VALUES ('chat', 'update', 'chat', 'name'); INSERT INTO prefix_log_display VALUES ('chat', 'report', 'chat', 'name'); +INSERT INTO prefix_log_display VALUES ('chat', 'talk', 'chat', 'name'); diff --git a/mod/chat/insert.php b/mod/chat/insert.php index 2b0031d1db..60a6b41d97 100644 --- a/mod/chat/insert.php +++ b/mod/chat/insert.php @@ -20,7 +20,7 @@ require_login($chat->course); if ($groupid) { - if (!isteacheredit($course->id) and !ismember($groupid)) { + if (!isteacheredit($chat->course) and !ismember($groupid)) { error("You can't chat here!"); } } @@ -45,6 +45,10 @@ $chatuser->lastmessageping = time(); update_record("chat_users", $chatuser); + + if ($cm = get_coursemodule_from_instance("chat", $chat->id, $chat->course)) { + add_to_log($chat->course, "chat", "talk", "view.php?id=$cm->id", $chat->id, $cm->id); + } } /// Go back to the other page diff --git a/mod/chat/version.php b/mod/chat/version.php index efdfdbebfa..56f054ea51 100644 --- a/mod/chat/version.php +++ b/mod/chat/version.php @@ -5,7 +5,7 @@ /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2004042500; // The (date) version of this module +$module->version = 2004043000; // The (date) version of this module $module->requires = 2004013101; // Requires this Moodle version $module->cron = 300; // How often should cron check this module (seconds)? -- 2.39.5