Permalink
Browse files

MDL-34274 book: Adding ability to log chapter view and chapter print

  • Loading branch information...
1 parent ccd90e7 commit 131688cf9456f1f30a2ff28f1296a75eb302e912 @ankitagarwal ankitagarwal committed Oct 5, 2012
View
@@ -25,7 +25,8 @@
defined('MOODLE_INTERNAL') || die();
$logs = array(
- array('module'=>'book', 'action'=>'add', 'mtable'=>'book', 'field'=>'name'),
- array('module'=>'book', 'action'=>'update', 'mtable'=>'book', 'field'=>'name'),
- array('module'=>'book', 'action'=>'view', 'mtable'=>'book', 'field'=>'name')
+ array('module' => 'book', 'action' => 'add', 'mtable' => 'book', 'field' => 'name'),
+ array('module' => 'book', 'action' => 'update', 'mtable' => 'book', 'field' => 'name'),
+ array('module' => 'book', 'action' => 'view', 'mtable' => 'book', 'field' => 'name'),
+ array('module' => 'book', 'action' => 'view chapter', 'mtable' => 'book_chapters', 'field' => 'title')
);
@@ -25,5 +25,6 @@
defined('MOODLE_INTERNAL') || die();
$logs = array(
- array('module'=>'book', 'action'=>'print', 'mtable'=>'book', 'field'=>'name')
+ array('module' => 'book', 'action' => 'print', 'mtable' => 'book', 'field' => 'name'),
+ array('module' => 'book', 'action' => 'print chapter', 'mtable' => 'book_chapters', 'field' => 'title')
);
@@ -77,7 +77,7 @@
require_capability('mod/book:viewhiddenchapters', $context);
}
- add_to_log($course->id, 'book', 'print', 'tool/print/index.php?id='.$cm->id.'&chapterid='.$chapter->id, $book->id, $cm->id);
+ add_to_log($course->id, 'book', 'print chapter', 'tool/print/index.php?id='.$cm->id.'&chapterid='.$chapter->id, $chapter->id, $cm->id);
// page header
?>
@@ -25,5 +25,5 @@
defined('MOODLE_INTERNAL') || die;
$plugin->component = 'booktool_print'; // Full name of the plugin (used for diagnostics)
-$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->version = 2012100500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2012061700; // Requires this Moodle version
View
@@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die;
$module->component = 'mod_book'; // Full name of the plugin (used for diagnostics)
-$module->version = 2012090400; // The current module version (Date: YYYYMMDDXX)
+$module->version = 2012100500; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2012061700; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)
View
@@ -75,6 +75,7 @@
}
// Check chapterid and read chapter data
if ($chapterid == '0') { // Go to first chapter if no given.
+ add_to_log($course->id, 'book', 'view', 'view.php?id='.$cm->id, $book->id, $cm->id);
foreach ($chapters as $ch) {
if ($edit) {
$chapterid = $ch->id;
@@ -106,7 +107,7 @@
// Security checks END.
-add_to_log($course->id, 'book', 'view', 'view.php?id='.$cm->id.'&chapterid='.$chapter->id, $book->id, $cm->id);
+add_to_log($course->id, 'book', 'view chapter', 'view.php?id='.$cm->id.'&chapterid='.$chapter->id, $chapter->id, $cm->id);
// Read standard strings.
$strbooks = get_string('modulenameplural', 'mod_book');

0 comments on commit 131688c

Please sign in to comment.