Skip to content

Commit

Permalink
Work in progress.
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Jun 9, 2024
1 parent b18fb5b commit 594ea3f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions classes/output/courseformat/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,12 @@ public function export_for_template(\renderer_base $output) {
$initialsection = '';
$course = $format->get_course();
$currentsectionid = 0;
$sectionzeroingrid = true;

if (!empty($sections)) {
// Is first entry section 0?
if ($sections[0]->num === 0) {
if (!$singlesectionid) {
if ((!$singlesectionid) && (!$sectionzeroingrid)) {
// Most formats uses section 0 as a separate section so we remove from the list.
$initialsection = array_shift($sections);
$data->initialsection = $initialsection;
Expand Down Expand Up @@ -324,9 +325,13 @@ protected function get_grid_sections(\renderer_base $output, $settings): array {
$sections = [];
$numsections = $format->get_last_section_number();
$sectioninfos = $modinfo->get_section_info_all();
// Get rid of section 0.
if (!empty($sectioninfos)) {
array_shift($sectioninfos);

$sectionzeroingrid = true;
if (!$sectionzeroingrid) {
// Get rid of section 0.
if (!empty($sectioninfos)) {
array_shift($sectioninfos);
}
}
foreach ($sectioninfos as $thissection) {
// The course/view.php check the section existence but the output can be called from other parts so we need to check it.
Expand Down

0 comments on commit 594ea3f

Please sign in to comment.