MDL-87671 core: Add restricted sections to navigation
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
issueNumber: MDL-87671
|
||||
notes:
|
||||
core:
|
||||
- message: >-
|
||||
Nodes from sections with visible restrictions have been added to the
|
||||
navigation tree
|
||||
type: improved
|
||||
@@ -1027,6 +1027,7 @@ class global_navigation extends navigation_node {
|
||||
unset($sections[$key]->summary);
|
||||
$sections[$key]->hasactivites = false;
|
||||
if (!array_key_exists($section->sectionnum, $modinfo->sections)) {
|
||||
// It may be because the section is not available for the user.
|
||||
continue;
|
||||
}
|
||||
foreach ($section->get_sequence_cm_infos() as $cm) {
|
||||
@@ -1083,6 +1084,7 @@ class global_navigation extends navigation_node {
|
||||
global $CFG, $DB, $USER, $SITE;
|
||||
require_once($CFG->dirroot . '/course/lib.php');
|
||||
|
||||
$format = course_get_format($course->id);
|
||||
[$sections, $activities] = $this->generate_sections_and_activities($course);
|
||||
|
||||
$navigationsections = [];
|
||||
@@ -1093,7 +1095,7 @@ class global_navigation extends navigation_node {
|
||||
}
|
||||
|
||||
if (
|
||||
!$section->uservisible
|
||||
!$format->is_section_visible($section)
|
||||
|| (
|
||||
!$this->showemptysections
|
||||
&& !$section->hasactivites
|
||||
|
||||
Reference in New Issue
Block a user