diff --git a/course/lib.php b/course/lib.php index 97175cfd5a1..d774e69baa2 100644 --- a/course/lib.php +++ b/course/lib.php @@ -2038,24 +2038,4 @@ function move_courses ($courseids, $categoryid) { return true; } -function course_parent_visible($course = null) { - return category_parent_visible($course->category); -} - -function category_parent_visible($parent = 0) { - if (!$parent) { - return true; - } - $category = get_record('course_categories', 'id', $parent); - $list = explode('/', preg_replace('/^\/(.*)$/', '$1', $category->path)); - $list[] = $parent; - $parents = get_records_list('course_categories', 'id', implode(',', $list), 'depth DESC'); - foreach ($parents as $parent) { - if (!$parent->visible) { - return false; - } - } - return true; -} - ?> diff --git a/lib/datalib.php b/lib/datalib.php index 2e30c47ea34..13b3f9ec50c 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -3060,5 +3060,25 @@ function check_db_compat() { return true; } +function course_parent_visible($course = null) { + return category_parent_visible($course->category); +} + +function category_parent_visible($parent = 0) { + if (!$parent) { + return true; + } + $category = get_record('course_categories', 'id', $parent); + $list = explode('/', preg_replace('/^\/(.*)$/', '$1', $category->path)); + $list[] = $parent; + $parents = get_records_list('course_categories', 'id', implode(',', $list), 'depth DESC'); + foreach ($parents as $parent) { + if (!$parent->visible) { + return false; + } + } + return true; +} + // vim:autoindent:expandtab:shiftwidth=4:tabstop=4:tw=140: ?>