Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-34274 book: Adding ability to log chapter updates

  • Loading branch information...
commit d3bf90ae046f1411d10533ad57ff316014f894ff 1 parent 131688c
@ankitagarwal ankitagarwal authored
View
2  mod/book/db/log.php
@@ -28,5 +28,7 @@
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')
);
View
4 mod/book/edit.php
@@ -74,7 +74,7 @@
$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 @@
$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
View
2  mod/book/tool/importhtml/locallib.php
@@ -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);
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.