Commit 131688cf authored by Ankit Agarwal's avatar Ankit Agarwal
Browse files

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

parent ccd90e76
......@@ -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 @@ if ($chapter) {
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
......@@ -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)
......@@ -75,6 +75,7 @@ if ($allowedit and !$chapters) {
}
// 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 @@ unset($chapterid);
// 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');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment