Skip to content

Commit

Permalink
Cope with course index.
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Aug 20, 2024
1 parent 292310c commit 20de2b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 0 additions & 5 deletions classes/output/courseformat/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,6 @@ protected function get_grid_sections(\renderer_base $output, $settings): array {
continue;
}

$sectionformatoptions = $format->get_format_options($thissection);
if ($sectionformatoptions['sectionhideingrid'] == 2) { // Yes.
continue;
}

$section = new stdClass();
$section->id = $thissection->id;
$section->num = $thissection->section;
Expand Down
8 changes: 7 additions & 1 deletion lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ public function get_default_section_name($section) {
* @return bool;
*/
public function is_section_visible(section_info $section): bool {
global $PAGE;
if ($section->section > $this->get_last_section_number()) {
// Stealth section.
global $PAGE;
$context = context_course::instance($this->course->id);
if ($PAGE->user_is_editing() && has_capability('moodle/course:update', $context)) {
$modinfo = get_fast_modinfo($this->course);
Expand All @@ -218,6 +218,12 @@ public function is_section_visible(section_info $section): bool {
}
// Don't show.
return false;
} else if (!$PAGE->user_is_editing()) {
$sectionformatoptions = $this->get_format_options($section);
if ($sectionformatoptions['sectionhideingrid'] == 2) { // Yes.
// Don't show.
return false;
}
}
return parent::is_section_visible($section);
}
Expand Down

0 comments on commit 20de2b6

Please sign in to comment.