Permalink
Browse files

Allow Course creators to see all hidden categories and courses

  • Loading branch information...
1 parent 5b6a1dd commit 3af6e1dbb8fc67ae2210b7d074f5e8afd4095efc moodler committed Sep 3, 2003
Showing with 5 additions and 5 deletions.
  1. +1 −1 course/lib.php
  2. +4 −4 lib/datalib.php
View
@@ -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
View
@@ -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]);
}
}

0 comments on commit 3af6e1d

Please sign in to comment.