function course_book_init in Course 6
Implements hook_nodeapi().
File
- modules/
course_book/ course_book.module, line 43
Code
function course_book_init() {
if (arg(0) == 'node') {
global $user;
$node = node_load(arg(1));
if ($node && $node->type == 'book') {
$search = !empty($node->book['bid']) ? $node->book['bid'] : $node->nid;
if ($courseObject = course_get_course_object('course_book', 'book', $search, $user)) {
$options = array();
// Mark this node as fulfillment in course_book's fulfillment tracking.
if (!empty($node->book['mlid'])) {
$options['book_fulfillment'][$node->book['mlid']] = TRUE;
$courseObject
->getFulfillment()
->addOptions($options)
->save();
}
$courseObject
->grade();
}
}
}
}