Moved the new functions added for Bug #4074 to datalib.php

This commit is contained in:
patrickslee
2005-12-13 19:31:48 +00:00
parent 7c1222573d
commit 0986271ba2
2 changed files with 20 additions and 20 deletions
-20
View File
@@ -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;
}
?>
+20
View File
@@ -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:
?>