]> git.mjollnir.org Git - moodle.git/commitdiff
OK, some big improvements to the logs.
authormoodler <moodler>
Sat, 31 Jan 2004 14:47:57 +0000 (14:47 +0000)
committermoodler <moodler>
Sat, 31 Jan 2004 14:47:57 +0000 (14:47 +0000)
Logs now include a field called modid which contains the coursemodule id.

This makes it now possible to

   - see complete logs per-activity

   - do backup/restore of logs

The upgrade process will currently try to scan all the old logs and
rebuild this field based on available data (especially forums).

STILL TO DO:  alter all the non-forum modules to send the coursemodule id

16 files changed:
course/lib.php
course/log.php
lib/datalib.php
lib/db/mysql.php
lib/db/mysql.sql
lib/db/postgres7.php
lib/db/postgres7.sql
lib/weblib.php
mod/forum/discuss.php
mod/forum/lib.php
mod/forum/post.php
mod/forum/subscribe.php
mod/forum/subscribers.php
mod/forum/version.php
mod/forum/view.php
version.php

index dd66733012fea35ec152393021828264039cefdf..4953e0589a4c3713dc7dc9d52cac02813d9e22af 100644 (file)
@@ -22,7 +22,7 @@ define("FRONTPAGECATEGORYNAMES",  2);
 
 
 function print_log_selector_form($course, $selecteduser=0, $selecteddate="today",
-                                 $mod="", $modpage="", $modid=0) {
+                                 $mod="", $modid=0, $modaction="") {
 
     global $USER, $CFG;
 
@@ -84,10 +84,10 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate="today"
             if (!$mod->visible) {
                 $mod->name = "(".$mod->name.")";
             }
-            $activities["$mod->mod/view.php?id=$mod->cm"] = $mod->name;
+            $activities["$mod->cm"] = $mod->name;
 
             if ($mod->cm == $modid) {
-                $selectedactivity = "$mod->mod/view.php?id=$mod->cm";
+                $selectedactivity = "$mod->cm";
             }
         }
     }
@@ -135,7 +135,7 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate="today"
     }
     choose_from_menu ($users, "user", $selecteduser, get_string("allparticipants") );
     choose_from_menu ($dates, "date", $selecteddate, get_string("alldays"));
-    choose_from_menu ($activities, "url", $selectedactivity, get_string("allactivities"), "", "");
+    choose_from_menu ($activities, "modid", $selectedactivity, get_string("allactivities"), "", "");
     echo "<input type=submit value=\"".get_string("showtheselogs")."\">";
     echo "</form>";
     echo "</center>";
@@ -159,7 +159,7 @@ function make_log_url($module, $url) {
 
 
 function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $perpage=100, 
-                   $url="", $mod="", $modpage="", $modid=0) {
+                   $url="", $mod="", $modid=0, $modaction="") {
 
 // It is assumed that $date is the GMT time of midnight for that day, 
 // and so the next 86400 seconds worth of logs are printed.
@@ -182,9 +182,12 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per
         $selector .= " AND l.module = '$mod'";
     }
 
-    if ($modpage and $modid) {
-        $LIKE = $CFG->dbtype == "mysql" ? "LIKE" : "ILIKE";
-        $selector .= " AND l.url $LIKE '%id=$modid%'";
+    if ($modid) {
+        $selector .= " AND l.cmid = '$modid'";
+    }
+
+    if ($modaction) {
+        $selector .= " AND l.action = '$modaction'";
     }
 
     if ($user) {
index bfcc979ea2d91f99afa7dac06d0042272cb00f74..28ca916a4adb0e2685ea085aba9a15a821fd9425 100644 (file)
@@ -7,7 +7,8 @@
     require_variable($id);    // Course ID
     optional_variable($user, 0); // User to display
     optional_variable($date, 0); // Date to display
-    optional_variable($url, ""); // eg resource/view.php?id=66
+    optional_variable($modid, ""); // course_module->id
+    optional_variable($modaction, ""); // an action as recorded in the logs
     optional_variable($page, "0");     // which page to show
     optional_variable($perpage, "100"); // how many per page
 
             $dateinfo = userdate($date, get_string("strftimedaydate"));
         }
 
-        if ($url) {     // parse into parts:  resource/view.php?id=66 
-            $urlraw = urldecode($url);
-            $urlparts = split("/", $urlraw);
-            if ($urlparts[0] != "section" and $urlparts[0] != "") {
-                $modname = $urlparts[0];
-                $modparts = split('.php\?id=', $urlparts[1]);
-                if (count($modparts) == 2) {
-                    if (record_exists('course_modules', 'id', $modparts[1], 'course', $course->id)) {
-                        $modpage = $modparts[0];
-                        $modid = $modparts[1];
-                    }
-                }
-            }
-        }
-
         if ($course->category) {
             print_header("$course->shortname: $strlogs", "$course->fullname", 
                          "<a href=\"view.php?id=$course->id\">$course->shortname</a> ->
         
         print_heading("$course->fullname: $userinfo, $dateinfo (".usertimezone().")");
 
-        print_log_selector_form($course, $user, $date, $modname, $modpage, $modid);
+        print_log_selector_form($course, $user, $date, $modname, $modid, $modaction);
 
         print_log($course, $user, $date, "l.time DESC", $page, $perpage, 
-                  "log.php?id=$course->id&chooselog=1&user=$user&date=$date&url=$url", 
-                  $modname, $modpage, $modid);
+                  "log.php?id=$course->id&chooselog=1&user=$user&date=$date&modid=$modid&modaction=$modaction", 
+                  $modname, $modid, $modaction);
 
     } else {
         if ($course->category) {
index f6858d7af60f14b37306895261b6722a886fadd2..a2c1d4ab3b806c20b0445b16f14ecc7846d58994 100644 (file)
@@ -1985,14 +1985,15 @@ function instance_is_visible($moduletype, $module) {
 * than web server hits, and provide a way to easily reconstruct what 
 * any particular student has been doing.
 *
-* @param       int     $course the course id
-* @param       string  $module the module name - e.g. forum, journal, resource, course, user etc
-* @param       string  $action view, edit, post (often but not always the same as the file.php)
-* @param       string  $url    the file and parameters used to see the results of the action
-* @param       string  $info   additional description information 
-* @param       string  $user   optional, if log regards $user other than $USER
+* @param       int         $course  the course id
+* @param       string  $module  the module name - e.g. forum, journal, resource, course, user etc
+* @param       string  $action  view, edit, post (often but not always the same as the file.php)
+* @param       string  $url     the file and parameters used to see the results of the action
+* @param       string  $info    additional description information 
+* @param       string  $cm          the course_module->id if there is one
+* @param       string  $user    if log regards $user other than $USER
 */
-function add_to_log($courseid, $module, $action, $url="", $info="", $user="") {
+function add_to_log($courseid, $module, $action, $url="", $info="", $cm=0, $user=0) {
 
     global $db, $CFG, $USER, $REMOTE_ADDR;
 
@@ -2008,22 +2009,8 @@ function add_to_log($courseid, $module, $action, $url="", $info="", $user="") {
     $timenow = time();
     $info = addslashes($info);
 
-    $result = $db->Execute("INSERT INTO {$CFG->prefix}log (time,
-                                        userid,
-                                        course,
-                                        ip,
-                                        module,
-                                        action,
-                                        url,
-                                        info)
-                             VALUES ('$timenow',
-                                        '$userid',
-                                        '$courseid',
-                                        '$REMOTE_ADDR',
-                                        '$module',
-                                        '$action',
-                                        '$url',
-                                        '$info')");
+    $result = $db->Execute("INSERT INTO {$CFG->prefix}log (time, userid, course, ip, module, cmid, action, url, info)
+        VALUES ('$timenow', '$userid', '$courseid', '$REMOTE_ADDR', '$module', '$cm', '$action', '$url', '$info')");
 
     if (!$result and ($CFG->debug > 7)) {
         echo "<P>Error: Could not insert a new entry to the Moodle log</P>";  // Don't throw an error
index 1fe42506f7e0b1e0adfcc32ee55c09585ae1d621..0064c24fd1c15b59c4559d22c490d5500248ff56 100644 (file)
@@ -634,6 +634,32 @@ function main_upgrade($oldversion=0) {
         table_column("config", "value", "value", "text", "", "", "");
     }
 
+    if ($oldversion < 2004013101) {
+        table_column("log", "", "cmid", "integer", "10", "unsigned", "0", "", "module");
+
+        /// try and extract as many cmids as possible from the existing logs
+
+        if ($coursemodules = get_records_sql("SELECT cm.*, m.name 
+                                                FROM {$CFG->prefix}course_modules cm, 
+                                                     {$CFG->prefix}modules m
+                                                WHERE cm.module = m.id")) {
+            foreach ($coursemodules as $cm) {
+                execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id' 
+                             WHERE module = '$cm->name' AND url LIKE 'view.php?id=$cm->id%'");
+                if ($cm->name == "forum") {
+                    execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id' 
+                                 WHERE module = 'forum' AND url LIKE '%?f=$cm->instance%'");
+                    if ($discussions = get_records("forum_discussions", "forum", $cm->instance)) {
+                        foreach ($discussions as $discussion) {
+                            execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id' 
+                                         WHERE module = 'forum' AND url LIKE '%?d=$discussion->id%'");
+                        }
+                    }
+                }
+            }
+        }
+    }
+
     return $result;
 
 }
index b875ebf4c2091d95827bb8d938c902ddc13d500f..e484452981011d9bcddf38efecd9b78dc4223313 100644 (file)
@@ -201,6 +201,7 @@ CREATE TABLE `prefix_log` (
   `ip` varchar(15) NOT NULL default '',
   `course` int(10) unsigned NOT NULL default '0',
   `module` varchar(10) NOT NULL default '',
+  `cmid` int(10) unsigned NOT NULL default '0',
   `action` varchar(15) NOT NULL default '',
   `url` varchar(100) NOT NULL default '',
   `info` varchar(255) NOT NULL default '',
index dadb93faf67a0094629769260031120a853356d6..ee402e341c1ef008256acf10aadbac9325a1f460 100644 (file)
@@ -379,6 +379,32 @@ function main_upgrade($oldversion=0) {
     if ($oldversion < 2004012900) {
         table_column("config", "value", "value", "text", "", "", "");
     }
+
+    if ($oldversion < 2004013101) {
+        table_column("log", "", "cmid", "integer", "10", "unsigned", "0", "", "module");
+
+        /// try and extract as many cmids as possible from the existing logs
+
+        if ($coursemodules = get_records_sql("SELECT cm.*, m.name 
+                                                FROM {$CFG->prefix}course_modules cm, 
+                                                     {$CFG->prefix}modules m
+                                                WHERE cm.module = m.id")) {
+            foreach ($coursemodules as $cm) {
+                execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id' 
+                             WHERE module = '$cm->name' AND url ILIKE 'view.php?id=$cm->id%'");
+                if ($cm->name == "forum") {
+                    execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id' 
+                                 WHERE module = 'forum' AND url ILIKE '%?f=$cm->instance%'");
+                    if ($discussions = get_records("forum_discussions", "forum", $cm->instance)) {
+                        foreach ($discussions as $discussion) {
+                            execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id' 
+                                         WHERE module = 'forum' AND url ILIKE '%?d=$discussion->id%'");
+                        }
+                    }
+                }
+            }
+        }
+    }
     
     return $result;
 }
index ba5c44e8448fb837dfc02fea83a08c20e30725de..00833233cce198d0b37c8a3ad4c12eba0d283dd6 100644 (file)
@@ -127,6 +127,7 @@ CREATE TABLE prefix_log (
    ip varchar(15) NOT NULL default '',
    course integer NOT NULL default '0',
    module varchar(20) NOT NULL default '',
+   cmid integer NOT NULL default '0',
    action varchar(20) NOT NULL default '',
    url varchar(100) NOT NULL default '',
    info varchar(255) NOT NULL default ''
index 23b9808ca7b57ac79ec13c806ef1b41da9d0aaf5..607e1c4dcb67a07888757c094e9665c276ffde36 100644 (file)
@@ -1701,10 +1701,10 @@ function navmenu($course, $cm=NULL, $targetwindow="self") {
             $previousmod = $mod;
         }
     }
-    if ($selected and $isteacher) {
-        $logslink = "<td><a href=\"$CFG->wwwroot/course/log.php?chooselog=1&user=0&date=0&id=$course->id&url=".
-                     urlencode($selected).
-                    "\"><img border=\"0\" height=\"16\" width=\"16\" src=\"$CFG->pixpath/i/log.gif\"></a></td>";
+    if ($selectmod and $isteacher) {
+        $logslink = "<td><a href=".
+                    "\"$CFG->wwwroot/course/log.php?chooselog=1&user=0&date=0&id=$course->id&modid=$selectmod->cm\">".
+                    "<img border=\"0\" height=\"16\" width=\"16\" src=\"$CFG->pixpath/i/log.gif\"></a></td>";
         
     }
     if ($backmod) {
index bd3c74dc0ce4e541f082c21ad1a412534ac195aa..ef8a79f77dc8f526d1720091d429ce41d69676e9 100644 (file)
             }
             set_field("forum_discussions", "forum", $forum->id, "id", $discussion->id);
             $discussion->forum = $forum->id;
-            add_to_log($course->id, "forum", "move discussion", "discuss.php?d=$discussion->id", "$discussion->id");
+            if ($cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) {
+                add_to_log($course->id, "forum", "move discussion", "discuss.php?d=$discussion->id", "$discussion->id",
+                           $cm->id);
+            } else {
+                add_to_log($course->id, "forum", "move discussion", "discuss.php?d=$discussion->id", "$discussion->id");
+            }
             $discussionmoved = true;
         } else {
             error("You can't move to that forum - it doesn't exist!");
         }
     }
 
-    if (!$cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) {
-        //notify("Bad coursemodule for this discussion");  // Only affects navmenu
-    }
-
     $logparameters = "d=$discussion->id";
     if ($parent) {
         $logparameters .= "&parent=$parent";
     }
-    add_to_log($course->id, "forum", "view discussion", "discuss.php?$logparameters", "$discussion->id");
+
+    if ($cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) {
+        add_to_log($course->id, "forum", "view discussion", "discuss.php?$logparameters", "$discussion->id", $cm->id);
+    } else {
+        add_to_log($course->id, "forum", "view discussion", "discuss.php?$logparameters", "$discussion->id");
+    }
 
     unset($SESSION->fromdiscussion);
 
index 47e0543ef1c5b97a31eb5aa68a67637cfeeca7e5..c7f77de23ecf7c28ce72d391f996491287785a99 100644 (file)
@@ -86,7 +86,6 @@ function forum_add_instance($forum) {
             error("Could not add the discussion for this forum");
         }
     }
-    add_to_log($forum->course, "forum", "add", "index.php?f=$forum->id", "$forum->id");
 
     return $forum->id;
 }
@@ -142,12 +141,7 @@ function forum_update_instance($forum) {
         }
     }
 
-    if (update_record("forum", $forum)) {
-        add_to_log($forum->course, "forum", "update", "index.php?f=$forum->id", "$forum->id");
-        return true;
-    } else {
-        return false;
-    }
+    return update_record("forum", $forum);
 }
 
 
@@ -244,7 +238,9 @@ function forum_cron () {
                         continue;                                            // Be safe and don't send it to anyone
                     }
                 }
-            } 
+            } else {
+                $cm->id = 0;
+            }
 
 
             if ($users = forum_subscribed_users($course, $forum)) {
@@ -329,7 +325,7 @@ function forum_cron () {
    
                     if (! email_to_user($userto, $userfrom, $postsubject, $posttext, $posthtml)) {
                         echo "Error: mod/forum/cron.php: Could not send out mail for id $post->id to user $userto->id ($userto->email) .. not trying again.\n";
-                        add_to_log($course->id, 'forum', 'mail error', "discuss.php?d=$discussion->id#$post->id", substr($post->subject,0,15), $userto->id);
+                        add_to_log($course->id, 'forum', 'mail error', "discuss.php?d=$discussion->id#$post->id", substr($post->subject,0,15), $cm->id, $userto->id);
                         $errorcount++;
                     } else {
                         $mailcount++;
index c0b97b83651913917cd8e27c2c574feb209fd707..bd784010a06e9fcfa4feb1617a06253a3991f879 100644 (file)
 
         $post->attachment = $_FILES["attachment"];
 
+        if (!$cm = get_coursemodule_from_instance("forum", $post->forum, $post->course)) { // For the logs
+            $cm->id = 0;
+        }
+
         if (!$post->subject or !$post->message) {
             $post->error = get_string("emptymessage", "forum");
 
         } else if ($post->edit) {           // Updating a post
             $post->id = $post->edit;
             if (forum_update_post($post)) {
-                add_to_log($post->course, "forum", "update post", "discuss.php?d=$post->discussion&parent=$post->id", "$post->id");
+
+                add_to_log($post->course, "forum", "update post", 
+                          "discuss.php?d=$post->discussion&parent=$post->id", "$post->id", $cm->id);
+
                 $message = get_string("postupdated", "forum");
                 $timemessage = 1;
 
 
         } else if ($post->discussion) { // Adding a new post to an existing discussion
             if ($post->id = forum_add_new_post($post)) {
-                add_to_log($post->course, "forum", "add post", "discuss.php?d=$post->discussion&parent=$post->id", "$post->id");
+
+                add_to_log($post->course, "forum", "add post", 
+                          "discuss.php?d=$post->discussion&parent=$post->id", "$post->id", $cm->id);
+
                 $message = get_string("postadded", "forum", format_time($CFG->maxeditingtime));
                 $timemessage = 2;
 
             $discussion->name  = $post->subject;
             $discussion->intro = $post->message;
             if ($discussion->id = forum_add_discussion($discussion)) {
-                add_to_log($post->course, "forum", "add discussion", "discuss.php?d=$discussion->id", "$discussion->id");
+
+                add_to_log($post->course, "forum", "add discussion", 
+                           "discuss.php?d=$discussion->id", "$discussion->id", $cm->id);
+
                 $message = get_string("postadded", "forum", format_time($CFG->maxeditingtime));
                 $timemessage = 2;
 
                         forum_go_back_to("discuss.php?id=$post->discussion"));
 
             } else {
+                if (!$cm = get_coursemodule_from_instance("forum", $forum->id, $forum->course)) { // For the logs
+                    $cm->id = 0;
+                }
                 if (! $post->parent) {  // post is a discussion topic as well, so delete discussion
                     if ($forum->type == "single") {
                         notice("Sorry, but you are not allowed to delete that discussion!", 
                     }
                     forum_delete_discussion($discussion);
 
-                    add_to_log($discussion->course, "forum", "delete discussion", "view.php?id=$discussion->forum", "$post->id");
+                    add_to_log($discussion->course, "forum", "delete discussion", 
+                               "view.php?id=$discussion->forum", "$post->id", $cm->id);
+
                     redirect("view.php?f=$discussion->forum", 
                              get_string("deleteddiscussion", "forum"), 1);
 
                 } else if (forum_delete_post($post)) {
 
-                    add_to_log($discussion->course, "forum", "delete post", "discuss.php?d=$post->discussion", "$post->id");
+                    add_to_log($discussion->course, "forum", "delete post", 
+                               "discuss.php?d=$post->discussion", "$post->id", $cm->id);
+
                     redirect(forum_go_back_to("discuss.php?d=$post->discussion"), 
                              get_string("deletedpost", "forum"), 1);
                 } else {
index c10a3f3c4c725c8aceb3433f4889c7ecedcf2311..8a762d29c2eff8b56c5b4865e7d5140171e6a336 100644 (file)
@@ -50,6 +50,8 @@
                 error("Sorry, but you must be a group member to subscribe.");
             }
         }
+    } else {
+        $cm->id = NULL;
     }
 
     $returnto = forum_go_back_to("index.php?id=$course->id");
@@ -73,7 +75,7 @@
 
     if ( forum_is_subscribed($user->id, $forum->id) ) {
         if (forum_unsubscribe($user->id, $forum->id) ) {
-            add_to_log($course->id, "forum", "unsubscribe", "view.php?f=$forum->id", "$forum->id");
+            add_to_log($course->id, "forum", "unsubscribe", "view.php?f=$forum->id", $forum->id, $cm->id);
             redirect($returnto, get_string("nownotsubscribed", "forum", $info), 1);
         } else {
             error("Could not unsubscribe you from that forum", $_SERVER["HTTP_REFERER"]);
@@ -81,7 +83,7 @@
         
     } else { // subscribe
         if (forum_subscribe($user->id, $forum->id) ) {
-            add_to_log($course->id, "forum", "subscribe", "view.php?f=$forum->id", "$forum->id");
+            add_to_log($course->id, "forum", "subscribe", "view.php?f=$forum->id", $forum->id, $cm->id);
             redirect($returnto, get_string("nowsubscribed", "forum", $info), 1);
         } else {
             error("Could not subscribe you to that forum", $_SERVER["HTTP_REFERER"]);
index 0d8b152c64e691b6f39cd2ad27c034c0c18dc6a6..fc3c812521b4984a8099fbf5318129bb70c582f2 100644 (file)
         error("Could not find this course!");
     }
 
+    if (! $cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) {
+        $cm->id = 0;
+    }
+
     require_login($course->id);
 
     if (!isteacher($course->id)) {
 
     unset($SESSION->fromdiscussion);
 
-    add_to_log($course->id, "forum", "view subscribers", "subscribers.php?id=$forum->id", "");
+    add_to_log($course->id, "forum", "view subscribers", "subscribers.php?id=$forum->id", "", $cm->id);
 
     $strsubscribers = get_string("subscribers", "forum");
     $strforums      = get_string("forums", "forum");
 
     if ($course->category) {
-        $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->
-                       <A HREF=\"index.php?id=$course->id\">$strforums</A> -> 
-                       <A HREF=\"view.php?f=$forum->id\">$forum->name</A> -> $strsubscribers";
+        $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
+                       <a href=\"index.php?id=$course->id\">$strforums</a> -> 
+                       <a href=\"view.php?f=$forum->id\">$forum->name</a> -> $strsubscribers";
     } else {
-        $navigation = "<A HREF=\"index.php?id=$course->id\">$strforums</A> -> 
-                       <A HREF=\"view.php?f=$forum->id\">$forum->name</A> -> $strsubscribers";
+        $navigation = "<a href=\"index.php?id=$course->id\">$strforums</a> -> 
+                       <a href=\"view.php?f=$forum->id\">$forum->name</a> -> $strsubscribers";
     }
 
     print_header("$course->shortname: $strsubscribers", "$course->fullname", "$navigation");
 
     } else {
         print_heading(get_string("subscribersto","forum", "'$forum->name'"));
-        echo "<TABLE ALIGN=CENTER cellpadding=5 cellspacing=5>";
+        echo '<table align="center" cellpadding="5" cellspacing="5">';
         foreach ($users as $user) {
-            echo "<TR><TD>";
+            echo "<tr><td>";
             print_user_picture($user->id, $course->id, $user->picture);
-            echo "</TD><TD BGCOLOR=\"$THEME->cellcontent\">";
+            echo "</td><td bgcolor=\"$THEME->cellcontent\">";
             echo "$user->firstname $user->lastname";
-            echo "</TD><TD BGCOLOR=\"$THEME->cellcontent\">";
+            echo "</td><td bgcolor=\"$THEME->cellcontent\">";
             echo "$user->email";
-            echo "</TD><TD>";
-            echo "<FONT SIZE=1><A HREF=\"subscribe.php?id=$forum->id&user=$user->id\">unsubscribe</A></FONT>";
-            echo "</TD></TR>";
+            echo "</td><td>";
+            echo "<font size=1><a href=\"subscribe.php?id=$forum->id&user=$user->id\">unsubscribe</a></font>";
+            echo "</td></tr>";
         }
-        echo "</TABLE>";
+        echo "</table>";
     }
 
     print_footer($course);
index dc239621027d88bd8a9c7a201b9c1f84e7d05f9a..a24751c747eb674a616a231a0a7f5c216d785910 100644 (file)
@@ -5,8 +5,8 @@
 //  This fragment is called by /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2004013000;
-$module->requires = 2004013000;  // Requires this Moodle version
+$module->version  = 2004013100;
+$module->requires = 2004013101;  // Requires this Moodle version
 $module->cron     = 60;
 
 ?>
index 64a9864954dbef8f512d383acab1d9ea20849ec6..0165651381f0bc092d6ac3fcc7fc2a6558601e63 100644 (file)
@@ -35,6 +35,7 @@
         if ($cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) {
             $buttontext = update_module_button($cm->id, $course->id, $strforum);
         } else {
+            $cm->id = NULL;
             $buttontext = "";
         }
 
@@ -61,7 +62,7 @@
     }
 
     if ($cm) {
-        add_to_log($course->id, "forum", "view forum", "view.php?id=$cm->id", "$forum->id");
+        add_to_log($course->id, "forum", "view forum", "view.php?id=$cm->id", "$forum->id", $cm->id);
     } else {
         add_to_log($course->id, "forum", "view forum", "view.php?f=$forum->id", "$forum->id");
     }
index 9559555cc3e49a07eabba1e24aafc1dd8391ab04..5727c4713c8804a8de505bab483aebf4eaac3d31 100644 (file)
@@ -5,7 +5,7 @@
 // database to determine whether upgrades should
 // be performed (see lib/db/*.php)
 
-$version = 2004013100;   // The current version is a date (YYYYMMDDXX)
+$version = 2004013101;   // The current version is a date (YYYYMMDDXX)
 
 $release = "1.2 development";   // User-friendly version number