function course_book_count_recurse in Course 7
Same name and namespace in other branches
- 6 modules/course_book/course_book.module \course_book_count_recurse()
- 7.2 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 173
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;
}