diff --git a/Changes.md b/Changes.md index e2f46842..e2e0e665 100644 --- a/Changes.md +++ b/Changes.md @@ -4,6 +4,7 @@ History Version 404.0.2 - TBR ---------------------------- 1. Fix updating of course when adding or removing sections. Note: Known issue of the section not looking as it should. +2. Section navigation visibility improvements. Version 404.0.1 - 22/04/2024 ---------------------------- diff --git a/classes/output/courseformat/content/sectionnavigation.php b/classes/output/courseformat/content/sectionnavigation.php index 298c24c9..ed54b6ed 100644 --- a/classes/output/courseformat/content/sectionnavigation.php +++ b/classes/output/courseformat/content/sectionnavigation.php @@ -66,7 +66,7 @@ public function export_for_template(\renderer_base $output): \stdClass { $back = $this->sectionno - 1; while ($back >= 0 && empty($data->previousurl)) { - if ($canviewhidden || $sections[$back]->uservisible) { + if ($canviewhidden || $format->is_section_visible($sections[$back])) { if (!$sections[$back]->visible) { $data->previoushidden = true; } @@ -80,7 +80,7 @@ public function export_for_template(\renderer_base $output): \stdClass { $forward = $this->sectionno + 1; $numsections = course_get_format($course)->get_last_section_number(); while ($forward <= $numsections && empty($data->nexturl)) { - if ($canviewhidden || $sections[$forward]->uservisible) { + if ($canviewhidden || $format->is_section_visible($sections[$forward])) { if (!$sections[$forward]->visible) { $data->nexthidden = true; } diff --git a/classes/output/courseformat/content/sectionselector.php b/classes/output/courseformat/content/sectionselector.php index 7a93a351..cf99ba96 100644 --- a/classes/output/courseformat/content/sectionselector.php +++ b/classes/output/courseformat/content/sectionselector.php @@ -61,10 +61,14 @@ public function export_for_template(\renderer_base $output): \stdClass { $section = 0; $numsections = $format->get_last_section_number(); while ($section <= $numsections) { - $thissection = $modinfo->get_section_info($section); - $url = course_get_url($course, $section, ['navigation' => true]); - if ($thissection->uservisible && $url && $section != $data->currentsection) { - $sectionmenu[$url->out(false)] = get_section_name($course, $section); + if ($section != $data->currentsection) { + $thissection = $modinfo->get_section_info($section); + if ($format->is_section_visible($thissection)) { + $url = course_get_url($course, $section, ['navigation' => true]); + if ($url) { + $sectionmenu[$url->out(false)] = get_section_name($course, $section); + } + } } $section++; }