You are here

function course_book_count in Course 6

Same name and namespace in other branches
  1. 8.3 modules/course_book/course_book.module \course_book_count()
  2. 8.2 modules/course_book/course_book.module \course_book_count()
  3. 7.2 modules/course_book/course_book.module \course_book_count()
  4. 7 modules/course_book/course_book.module \course_book_count()
  5. 3.x modules/course_book/course_book.module \course_book_count()

Counts the number of book pages that are accessible to the current user.

Parameters

int $bid: A book ID.

array $exclude: (Optional) An array of menu link IDs. Any link whose mlid is in this array will be excluded (along with its children).

Return value

int The number of accessible pages in a book.

2 calls to course_book_count()
CourseObjectBook::grade in modules/course_book/course_book.classes.inc
Grade (track) the book based on the fulfillment data.
course_book_override_outline_list_item in modules/course_book/course_book.module
Overrides a course outline list item.

File

modules/course_book/course_book.module, line 152

Code

function course_book_count($bid, $exclude = array()) {
  $tree = menu_tree_all_data(book_menu_name($bid));
  $count = course_book_count_recurse($tree, $exclude);
  return $count;
}