Skip to content

Commit

Permalink
Fix 'Course name appears in navbar when set to appear only in page co…
Browse files Browse the repository at this point in the history
…ntent' - #8.
  • Loading branch information
gjb2048 committed May 5, 2017
1 parent 9ba2472 commit 7625eb5
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 12 deletions.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Version Information
3. Fix 'block_adminblock' margin.
4. Fix change in font file length.
5. Fix assignment view layout.
6. Fix 'Course name appears in navbar when set to appear only in page content' - #8.

13th April 2017 - Version 3.1.1.13
1. Add Roberto as a body font.
Expand Down
31 changes: 27 additions & 4 deletions classes/core_renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ public function body_attributes($additionalclasses = array()) {

/**
* States if the frontpage header is being used on another page than the frontpage itself.
* If logic in optional_jquery() changes, then change this too.
* If logic in optional_jquery() / course_category_header() changes, then change this too.
*/
public function using_frontpage_header_on_another_page() {
$usingfph = false;
Expand All @@ -806,7 +806,8 @@ public function using_frontpage_header_on_another_page() {

/**
* Returns the header file name in the 'tiles' folder to use for the current page.
* If logic in optional_jquery() changes, then change this and using_frontpage_header_on_another_page() too.
* If logic in optional_jquery() / course_category_header() changes, then change this
* and using_frontpage_header_on_another_page() too.
*/
public function get_header_file() {
$thefile = 'header'; // Default if not a specific header.
Expand All @@ -833,7 +834,9 @@ public function get_header_file() {

/**
* Works out and adds optional jQuery on the page if needed by criteria.
* If logic in get_header_file() changes, then change this and using_frontpage_header_on_another_page() too.
* If logic in get_header_file() / course_category_header() changes, then change this
* and using_frontpage_header_on_another_page() too.
*
* MUST be called before any page output happens.
*/
public function optional_jquery() {
Expand Down Expand Up @@ -1004,7 +1007,7 @@ public function page_heading($tag = 'h1') {
} else {
return '';
}
} else if (($this->page->pagelayout == 'course') || ($this->page->pagelayout == 'coursecategory')) {
} else if ($this->course_category_header()) {
if ((!empty($this->page->theme->settings->coursepagepageheadinglocation)) &&
($this->page->theme->settings->coursepagepageheadinglocation == 1)) {
return $this->get_page_heading();
Expand Down Expand Up @@ -1032,4 +1035,24 @@ public function get_page_heading($heading = null) {
return '<h1 class="brand">' . $heading . '</h1>';
}

/**
* States if the layout will have a course category header.
*
* If logic in get_header_file() / optional_jquery() changes, then change this
* and using_frontpage_header_on_another_page() too.
* @return boolean true or false.
*/
public function course_category_header() {
$cch = false;
$pagelayout = $this->page->pagelayout;
switch ($pagelayout) {
case 'coursecategory':
case 'course':
case 'incourse':
case 'report':
$cch = true;
break;
}
return $cch;
}
}
2 changes: 1 addition & 1 deletion layout/columns1.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<?php require_once(dirname(__FILE__).'/tiles/pagebody_slideshow.php'); ?>
<section id="region-main-campus" class="row-fluid">
<?php
if (($PAGE->pagelayout == 'course') || ($PAGE->pagelayout == 'coursecategory')) {
if ($OUTPUT->course_category_header()) {
if ((!empty($PAGE->theme->settings->coursepagepageheadinglocation)) &&
($PAGE->theme->settings->coursepagepageheadinglocation == 3)) {
echo $OUTPUT->get_page_heading();
Expand Down
4 changes: 2 additions & 2 deletions layout/columns2l.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@
?>
<section id="region-main-campus" class="row-fluid">
<?php
if (($PAGE->pagelayout == 'course') || ($PAGE->pagelayout == 'coursecategory')) {
if ($OUTPUT->course_category_header()) {
if ((!empty($PAGE->theme->settings->coursepagepageheadinglocation)) &&
($PAGE->theme->settings->coursepagepageheadinglocation == 3)) {
($PAGE->theme->settings->coursepagepageheadinglocation == 3)) {
echo $OUTPUT->get_page_heading();
}
} else if ($OUTPUT->using_frontpage_header_on_another_page()) {
Expand Down
4 changes: 2 additions & 2 deletions layout/columns2r.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@
?>
<section id="region-main-campus" class="row-fluid">
<?php
if (($PAGE->pagelayout == 'course') || ($PAGE->pagelayout == 'coursecategory')) {
if ($OUTPUT->course_category_header()) {
if ((!empty($PAGE->theme->settings->coursepagepageheadinglocation)) &&
($PAGE->theme->settings->coursepagepageheadinglocation == 3)) {
($PAGE->theme->settings->coursepagepageheadinglocation == 3)) {
echo $OUTPUT->get_page_heading();
}
} else if ($OUTPUT->using_frontpage_header_on_another_page()) {
Expand Down
6 changes: 3 additions & 3 deletions layout/columns3.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@
<?php require_once(dirname(__FILE__).'/tiles/pagebody_slideshow.php'); ?>
<section id="region-main-campus" class="row-fluid">
<?php
if (($PAGE->pagelayout == 'course') || ($PAGE->pagelayout == 'coursecategory')) {
if ((!empty($PAGE->theme->settings->coursepagepageheadinglocation)) && ($PAGE->theme->settings->coursepagepageheadinglocation
== 3)) {
if ($OUTPUT->course_category_header()) {
if ((!empty($PAGE->theme->settings->coursepagepageheadinglocation)) &&
($PAGE->theme->settings->coursepagepageheadinglocation == 3)) {
echo $OUTPUT->get_page_heading();
}
} else if ($OUTPUT->using_frontpage_header_on_another_page()) {
Expand Down

0 comments on commit 7625eb5

Please sign in to comment.