Skip to content

Commit

Permalink
M4.4 Always show section 0.
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Apr 27, 2024
1 parent bdff1cc commit 488cab6
Showing 1 changed file with 13 additions and 22 deletions.
35 changes: 13 additions & 22 deletions classes/output/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -542,20 +542,16 @@ protected function display_section($section, $onsectionpage, $sectionreturn = nu
];

$sectionstyle = '';
if ($section->section != 0) {
// Only in the non-general sections.
if (!$section->visible) {
$sectionstyle = ' hidden';
} else if ($this->courseformat->is_section_current($section)) {
$sectionstyle = ' current';
}
if (!$section->visible) {
$sectionstyle = ' hidden';
} else if ($this->courseformat->is_section_current($section)) {
$sectionstyle = ' current';
}

if (empty($this->course)) {
$this->course = $this->courseformat->get_course();
}
if (($section->section != 0) &&
(!$onsectionpage)) { // Horizontal column layout.
if (!$onsectionpage) { // Horizontal column layout.
$sectionstyle .= ' '.$this->get_column_class($this->course->layoutcolumns);
}

Expand All @@ -565,27 +561,22 @@ protected function display_section($section, $onsectionpage, $sectionreturn = nu
$displaysectioncontext['sectionreturnid'] = $sectionreturn; // MDL-69065.
}

// When not on a section page, we display the section titles except the general section if null.
$hasnamenotsecpg = (!$onsectionpage && ($section->section != 0 || !is_null($section->name)));

// When on a section page, we only display the general section title, if title is not the default one.
$hasnamesecpg = ($onsectionpage && ($section->section == 0 && !is_null($section->name)));

$headerclasses = 'section-title';
if ($hasnamenotsecpg || $hasnamesecpg) {
if ($onsectionpage) {
// Hidden section name so don't output anything bar the header name.
$headerclasses .= ' accesshide';
$displaysectioncontext['header'] = $this->section_header_helper(
$this->section_title_without_link($section, $this->course),
$headerclasses, '', false, $section, false);
} else {
// When not on a section page, we display the section titles.
$activitysummary = $this->section_activity_summary($section, $this->course, null);
// Chart '2' is 'Bar chart'.
$barchart = ((!empty($activitysummary)) && (!$this->editing) && ($this->course->chart == 2));

$displaysectioncontext['header'] = $this->section_header_helper(
$this->section_title_without_link($section, $this->course),
$headerclasses, $activitysummary, $barchart, $section);
} else {
// Hidden section name so don't output anything bar the header name.
$headerclasses .= ' accesshide';
$displaysectioncontext['header'] = $this->section_header_helper(
$this->section_title_without_link($section, $this->course),
$headerclasses, '', false, $section, false);
}

if (($checkchart) && (!$this->editing) && ($this->course->chart == 3)) { // Donut chart.
Expand Down

0 comments on commit 488cab6

Please sign in to comment.