You are here

function course_book_count_recurse in Course 6

Same name and namespace in other branches
  1. 7.2 modules/course_book/course_book.module \course_book_count_recurse()
  2. 7 modules/course_book/course_book.module \course_book_count_recurse()

A recursive helper function for course_book_count().

1 call to course_book_count_recurse()
course_book_count in modules/course_book/course_book.module
Counts the number of book pages that are accessible to the current user.

File

modules/course_book/course_book.module, line 162

Code

function course_book_count_recurse($tree, $exclude, $count = 0) {
  foreach ($tree as $data) {
    if (!in_array($data['link']['mlid'], $exclude)) {
      $count++;
      if ($data['below']) {
        $count = course_book_count_recurse($data['below'], $exclude, $count);
      }
    }
  }
  return $count;
}