Skip to content

Commit

Permalink
Section navigation visibility improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed May 23, 2024
1 parent b2e5709 commit dd85acb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------------------------
Expand Down
4 changes: 2 additions & 2 deletions classes/output/courseformat/content/sectionnavigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
12 changes: 8 additions & 4 deletions classes/output/courseformat/content/sectionselector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand Down

0 comments on commit dd85acb

Please sign in to comment.