Skip to content

Commit

Permalink
Fix the case of displaying the section 0
Browse files Browse the repository at this point in the history
While standard course format do not support it, it is possible to see
the course with a parameter like ?section=0. Previously, this led to
both the course page and section 0 highlighted.

Credit goes to  @5882wolverine for spotting this.

Fix bug #24
  • Loading branch information
mudrd8mz committed Feb 1, 2018
1 parent d10bd37 commit 5d7431c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions block_course_contents.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function get_content() {
if (($i == 0) && ($displaycourselink)) {
$sectionclass = 'section-item';

if (empty($selected)) {
if ($selected === null) {
$sectionclass .= ' selected';
}
$text .= html_writer::start_tag('li', array('class' => $sectionclass));
Expand All @@ -204,7 +204,7 @@ public function get_content() {
$anchortext = $course->shortname;
}

if (empty($selected)) {
if ($selected === null) {
$text .= ' '.$anchortext;
} else {
$text .= ' '.html_writer::link(course_get_url($course), $anchortext);
Expand Down

0 comments on commit 5d7431c

Please sign in to comment.