From 3af6e1dbb8fc67ae2210b7d074f5e8afd4095efc Mon Sep 17 00:00:00 2001 From: moodler Date: Wed, 3 Sep 2003 08:29:05 +0000 Subject: [PATCH] Allow Course creators to see all hidden categories and courses --- course/lib.php | 2 +- lib/datalib.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/course/lib.php b/course/lib.php index cdbbc16739..b22fc98bb0 100644 --- a/course/lib.php +++ b/course/lib.php @@ -899,7 +899,7 @@ function print_whole_category_list($category=NULL, $displaylist=NULL, $parentsli } if ($category) { - if ($category->visible or isadmin()) { + if ($category->visible or iscreator()) { print_category_info($category, $depth); } else { return; // Don't bother printing children of invisible categories diff --git a/lib/datalib.php b/lib/datalib.php index e40fbf598d..8397fb7b97 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -1127,7 +1127,7 @@ function get_courses($categoryid="all", $sort="c.sortorder ASC", $fields="c.*") $teachergroup = ""; $visiblecourses = ""; if (!empty($USER)) { // May need to check they are a teacher - if (!isadmin()) { + if (!iscreator()) { $visiblecourses = "AND ((c.visible > 0) OR (t.userid = '$USER->id' AND t.course = c.id))"; $teachertable = ", {$CFG->prefix}user_teachers t"; $teachergroup = "GROUP BY c.id"; @@ -1158,7 +1158,7 @@ function get_courses_page($categoryid="all", $sort="c.sortorder ASC", $fields="c $teachergroup = ""; $visiblecourses = ""; if (!empty($USER)) { // May need to check they are a teacher - if (!isadmin()) { + if (!iscreator()) { $visiblecourses = "AND ((c.visible > 0) OR (t.userid = '$USER->id' AND t.course = c.id))"; $teachertable = ", {$CFG->prefix}user_teachers t"; $teachergroup = "GROUP BY c.id"; @@ -1312,10 +1312,10 @@ function get_categories($parent="none", $sort="sortorder ASC") { $categories = get_records("course_categories", "parent", $parent, $sort); } if ($categories) { /// Remove unavailable categories from the list - $admin = isadmin(); + $creator = iscreator(); foreach ($categories as $key => $category) { if (!$category->visible) { - if (!$admin) { + if (!$creator) { unset($categories[$key]); } } -- 2.39.5