Commit d3bf90ae authored by Ankit Agarwal's avatar Ankit Agarwal
Browse files

MDL-34274 book: Adding ability to log chapter updates

parent 131688cf
......@@ -28,5 +28,7 @@ $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 chapter', 'mtable' => 'book_chapters', 'field' => 'title'),
array('module' => 'book', 'action' => 'update chapter', 'mtable'=> 'book_chapters', 'field' => 'title'),
array('module' => 'book', 'action' => 'view chapter', 'mtable' => 'book_chapters', 'field' => 'title')
);
......@@ -74,7 +74,7 @@ if ($mform->is_cancelled()) {
$DB->update_record('book_chapters', $data);
add_to_log($course->id, 'course', 'update mod', '../mod/book/view.php?id='.$cm->id, 'book '.$book->id);
add_to_log($course->id, 'book', 'update', 'view.php?id='.$cm->id.'&chapterid='.$data->id, $book->id, $cm->id);
add_to_log($course->id, 'book', 'update chapter', 'view.php?id='.$cm->id.'&chapterid='.$data->id, $data->id, $cm->id);
} else {
// adding new chapter
......@@ -100,7 +100,7 @@ if ($mform->is_cancelled()) {
$DB->set_field('book', 'revision', $book->revision+1, array('id'=>$book->id));
add_to_log($course->id, 'course', 'update mod', '../mod/book/view.php?id='.$cm->id, 'book '.$book->id);
add_to_log($course->id, 'book', 'update', 'view.php?id='.$cm->id.'&chapterid='.$data->id, $book->id, $cm->id);
add_to_log($course->id, 'book', 'add chapter', 'view.php?id='.$cm->id.'&chapterid='.$data->id, $data->id, $cm->id);
}
book_preload_chapters($book); // fix structure
......
......@@ -84,7 +84,7 @@ function toolbook_importhtml_import_chapters($package, $type, $book, $context, $
$chapter->id = $DB->insert_record('book_chapters', $chapter);
$chapters[$chapter->id] = $chapter;
add_to_log($book->course, 'book', 'update', 'view.php?id='.$context->instanceid.'&chapterid='.$chapter->id, $book->id, $context->instanceid);
add_to_log($book->course, 'book', 'add chapter', 'view.php?id='.$context->instanceid.'&chapterid='.$chapter->id, $chapter->id, $context->instanceid);
}
}
}
......
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