Merge branch 'MDL-34274-master' of git://github.com/ankitagarwal/moodle

This commit is contained in:
Sam Hemelryk 2012-10-30 16:00:45 +13:00
commit e118ad21c9
9 changed files with 20 additions and 11 deletions

View File

@ -111,6 +111,10 @@ class restore_book_activity_task extends restore_activity_task {
// To convert old 'generateimscp' log entries
$rules[] = new restore_log_rule('book', 'generateimscp', 'tool/generateimscp/index.php?id={course_module}', '{book}',
'book', 'exportimscp', 'tool/exportimscp/index.php?id={course_module}', '{book}');
$rules[] = new restore_log_rule('book', 'print chapter', 'tool/print/index.php?id={course_module}&chapterid={book_chapter}', '{book_chapter}');
$rules[] = new restore_log_rule('book', 'update chapter', 'view.php?id={course_module}&chapterid={book_chapter}', '{book_chapter}');
$rules[] = new restore_log_rule('book', 'add chapter', 'view.php?id={course_module}&chapterid={book_chapter}', '{book_chapter}');
$rules[] = new restore_log_rule('book', 'view chapter', 'view.php?id={course_module}&chapterid={book_chapter}', '{book_chapter}');
return $rules;
}

View File

@ -25,7 +25,10 @@
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' => '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 File

@ -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

View File

@ -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);
}
}
}

View File

@ -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')
);

View File

@ -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
?>

View File

@ -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 File

@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die;
$module->component = 'mod_book'; // Full name of the plugin (used for diagnostics)
$module->version = 2012090408; // 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 File

@ -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;
@ -109,7 +110,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');