Allow Course creators to see all hidden categories and courses

This commit is contained in:
moodler 2003-09-03 08:29:05 +00:00
parent 5b6a1dd3ad
commit 3af6e1dbb8
2 changed files with 5 additions and 5 deletions

View File

@ -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 File

@ -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]);
}
}