From: moodler Date: Mon, 16 Feb 2004 12:20:40 +0000 (+0000) Subject: SOme improvements to logging X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=9232405d8ad0ae775912d9a27914281d2c539e58;p=moodle.git SOme improvements to logging --- diff --git a/mod/lesson/db/mysql.php b/mod/lesson/db/mysql.php index b3bfa4dd34..f30670b3a9 100644 --- a/mod/lesson/db/mysql.php +++ b/mod/lesson/db/mysql.php @@ -6,9 +6,13 @@ function lesson_upgrade($oldversion) { global $CFG; - if ($oldversion < 2004012400) { + if ($oldversion < 2004021600) { - # Do something ... + delete_records("log_display", "module", "lesson"); + + modify_database ("", "INSERT INTO prefix_log_display VALUES ('lesson', 'start', 'lesson', 'name');"); + modify_database ("", "INSERT INTO prefix_log_display VALUES ('lesson', 'end', 'lesson', 'name');"); + modify_database ("", "INSERT INTO prefix_log_display VALUES ('lesson', 'view', 'lesson_pages', 'title');"); } diff --git a/mod/lesson/db/mysql.sql b/mod/lesson/db/mysql.sql index 9707544d15..b18f7e2879 100644 --- a/mod/lesson/db/mysql.sql +++ b/mod/lesson/db/mysql.sql @@ -69,4 +69,6 @@ CREATE TABLE `prefix_lesson_grades` ( # -------------------------------------------------------- -INSERT INTO prefix_log_display VALUES ('lesson', 'view', 'lesson', 'name'); +INSERT INTO prefix_log_display VALUES ('lesson', 'start', 'lesson', 'name'); +INSERT INTO prefix_log_display VALUES ('lesson', 'end', 'lesson', 'name'); +INSERT INTO prefix_log_display VALUES ('lesson', 'view', 'lesson_pages', 'title'); diff --git a/mod/lesson/version.php b/mod/lesson/version.php index 0e30fdd94f..f6b7892fea 100644 --- a/mod/lesson/version.php +++ b/mod/lesson/version.php @@ -5,7 +5,7 @@ /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2004021400; // The current module version (Date: YYYYMMDDXX) +$module->version = 2004021600; // The current module version (Date: YYYYMMDDXX) $module->requires = 2004013101; // Requires this Moodle version $module->cron = 0; // Period for cron to check this module (secs) diff --git a/mod/lesson/view.php b/mod/lesson/view.php index 73c5550787..59c90f94b8 100644 --- a/mod/lesson/view.php +++ b/mod/lesson/view.php @@ -22,12 +22,11 @@ require_login($course->id); - add_to_log($course->id, "lesson", "view", "view.php?id=$cm->id", "$lesson->id", $cm->id); /// Print the page header if ($course->category) { - $navigation = "id\">$course->shortname ->"; + $navigation = "id\">$course->shortname ->"; } $strlessons = get_string("modulenameplural", "lesson"); @@ -61,6 +60,7 @@ // if pageid is EOL then the end of the lesson has been reached print_heading($lesson->name); if (empty($_GET['pageid'])) { + add_to_log($course->id, "lesson", "start", "view.php?id=$cm->id", "$lesson->id", $cm->id); // if no pageid given see if the lesson has been started if ($grades = get_records_select("lesson_grades", "lessonid = $lesson->id AND userid = $USER->id", "grade DESC")) { @@ -125,6 +125,7 @@ $pageid = $_GET['pageid']; } if ($pageid != EOL) { + add_to_log($course->id, "lesson", "view", "view.php?id=$cm->id&action=navigation&pageid=$pageid", "$pageid", $cm->id); if (!$page = get_record("lesson_pages", "id", $pageid)) { error("Navigation: the page record not found"); } @@ -163,6 +164,7 @@ echo "\n"; } else { // end of lesson reached work out grade + add_to_log($course->id, "lesson", "end", "view.php?id=$cm->id", "$lesson->id", $cm->id); print_heading(get_string("congratulations", "lesson")); print_simple_box_start("center"); $ntries = count_records("lesson_grades", "lessonid", $lesson->id, "userid", $USER->id);