From 5006e4226ee82a9423b185ce5f126aed31307300 Mon Sep 17 00:00:00 2001 From: David Herney Date: Thu, 26 Jan 2023 00:35:29 -0500 Subject: [PATCH 1/2] Fixed an exception when course has only the topic 0 and it is over the tabs. --- classes/tabs.php | 1 + 1 file changed, 1 insertion(+) diff --git a/classes/tabs.php b/classes/tabs.php index 87f10a2..2945f95 100644 --- a/classes/tabs.php +++ b/classes/tabs.php @@ -127,6 +127,7 @@ public function count_tabs() { public function get_secondlist() : object { $tabstree = new \stdClass(); + $tabstree->tabs = []; foreach ($this->tabslist as $tab) { if ($tab->selected) { From eee6d126c53752fc9e9b0ef98ce2179eca9e7167 Mon Sep 17 00:00:00 2001 From: David Herney Date: Thu, 26 Jan 2023 01:05:08 -0500 Subject: [PATCH 2/2] Added hiddenfromstudents title on hidden tabs, for screenreaders --- classes/output/courseformat/content.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/classes/output/courseformat/content.php b/classes/output/courseformat/content.php index 3bfae26..e17b5e3 100644 --- a/classes/output/courseformat/content.php +++ b/classes/output/courseformat/content.php @@ -253,6 +253,11 @@ private function get_tabs(course_modinfo $modinfo, \renderer_base $output): \for $formatoptions = course_get_format($course)->get_format_options($thissection); $sectionname = get_section_name($course, $thissection); + $title = $sectionname; + + if (!$thissection->visible || !$thissection->available) { + $title .= ': '. get_string('hiddenfromstudents'); + } $customstyles = ''; $level = 0; @@ -309,7 +314,7 @@ private function get_tabs(course_modinfo $modinfo, \renderer_base $output): \for } } - $newtab = new \format_onetopic\singletab($section, $sectionname, $url, $sectionname, + $newtab = new \format_onetopic\singletab($section, $sectionname, $url, $title, $availablemessage, $customstyles, $specialclass); $newtab->active = !$inactivetab;