/** * Recursive function to help flatten the course category tree. * * @deprecated since 2.5 * * Was intended to be called from {@link get_category_courses_array()} * * @param array &$flattened An array passed by reference in which to store courses for each category. * @param stdClass $category The category to get courses for. */ function get_category_courses_array_recursively(array &$flattened, $category) { debugging('Function get_category_courses_array_recursively() is deprecated, please use methods of coursecat class', DEBUG_DEVELOPER); $flattened[$category->id] = $category->courses; foreach ($category->categories as $childcategory) { get_category_courses_array_recursively($flattened, $childcategory); } }
/** * Recursive function to help flatten the course category tree. * * Do not call this function directly, instead calll its parent function {@link get_category_courses_array} * * @param array &$flattened An array passed by reference in which to store courses for each category. * @param stdClass $category The category to get courses for. */ function get_category_courses_array_recursively(array &$flattened, $category) { $flattened[$category->id] = $category->courses; foreach ($category->categories as $childcategory) { get_category_courses_array_recursively($flattened, $childcategory); } }