mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
Allow Course creators to see all hidden categories and courses
This commit is contained in:
parent
5b6a1dd3ad
commit
3af6e1dbb8
@ -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
|
||||
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user