mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
MDL-38147 deprecated get_all_subcategories()
This commit is contained in:
parent
9bad61dbfe
commit
bc81b0065c
3 changed files with 38 additions and 24 deletions
|
@ -1003,29 +1003,6 @@ function get_categories($parent='none', $sort=NULL, $shallow=true) {
|
|||
return $categories;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array of category ids of all the subcategories for a given
|
||||
* category.
|
||||
*
|
||||
* @global object
|
||||
* @param int $catid - The id of the category whose subcategories we want to find.
|
||||
* @return array of category ids.
|
||||
*/
|
||||
function get_all_subcategories($catid) {
|
||||
global $DB;
|
||||
|
||||
$subcats = array();
|
||||
|
||||
if ($categories = $DB->get_records('course_categories', array('parent'=>$catid))) {
|
||||
foreach ($categories as $cat) {
|
||||
array_push($subcats, $cat->id);
|
||||
$subcats = array_merge($subcats, get_all_subcategories($cat->id));
|
||||
}
|
||||
}
|
||||
return $subcats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fixes course category and course sortorder, also verifies category and course parents and paths.
|
||||
* (circular references are not fixed)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue