mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 13:02:07 +02:00
MDL-66336 courses: Show an error when no course categories are visible
This commit is contained in:
parent
7e16c70b52
commit
3b75d14315
@ -69,8 +69,11 @@ if ($courseid) {
|
||||
$course = null;
|
||||
$courseid = null;
|
||||
$topchildren = core_course_category::top()->get_children();
|
||||
if (empty($topchildren)) {
|
||||
throw new moodle_exception('cannotviewcategory', 'error');
|
||||
}
|
||||
$category = reset($topchildren);
|
||||
$categoryid = $category ? $category->id : 0;
|
||||
$categoryid = $category->id;
|
||||
$context = context_coursecat::instance($category->id);
|
||||
$url->param('categoryid', $category->id);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user