From 70cefa1a65146e7d5c34dc33e17e8a3dccc8bd10 Mon Sep 17 00:00:00 2001
From: Kathrin Osswald <kathrin.osswald@uni-ulm.de>
Date: Fri, 25 Sep 2020 10:01:52 +0200
Subject: [PATCH] Fixed Bug that content bank view page cog icon showed course
 context menu entries.

---
 CHANGES.md                       |  2 ++
 classes/output/core_renderer.php | 13 +++++++++----
 layout/columns2.php              |  4 ++--
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 3906ca9..75da3d7 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -6,6 +6,8 @@ Changes
 
 ### Unreleased
 
+* 2020-09-25 - Fixed Bug that content bank view page cog icon showed course context menu entries.
+               NOTE: This is just a kind of hacky interim solution until MDL-69793 is done. 
 * 2020-09-23 - Updated referenced Bootstrap version to latest in upstream used version 4.5.
 * 2020-09-18 - Removed fix that bullet points are cut off because it is fixed in upstream Boost now.
                NOTE: requires minimum Moodle version Moodle 3.9.2 (2020061502)
diff --git a/classes/output/core_renderer.php b/classes/output/core_renderer.php
index 7eb3f69..b378ea2 100644
--- a/classes/output/core_renderer.php
+++ b/classes/output/core_renderer.php
@@ -144,8 +144,9 @@ class core_renderer extends \core_renderer {
         $header = new stdClass();
         // MODIFICATION START.
         // Show the context header settings menu on all pages except for the profile page as we replace
-        // it with an edit button there.
-        if ($this->page->pagelayout != 'mypublic') {
+        // it with an edit button there and if we are not on the content bank view page (contentbank/view.php)
+        // as this page only adds header actions.
+        if ($this->page->pagelayout != 'mypublic' && $this->page->bodyid != 'page-contentbank') {
             $header->settingsmenu = $this->context_header_settings_menu();
         }
         // MODIFICATION END.
@@ -186,8 +187,12 @@ class core_renderer extends \core_renderer {
         $header->headeractions = $this->page->get_header_actions();
         // MODIFICATION START:
         // Change this to add the result in the html variable to be able to add further features below the header.
-        // Render from the own header template.
-        $html = $this->render_from_template('theme_boost_campus/full_header', $header);
+        // Render from the own header template if we are not on the content bank view page (contentbank/view.php).
+        if ($this->page->bodyid == 'page-contentbank') {
+            $html = $this->render_from_template('core/full_header', $header);
+        } else {
+            $html = $this->render_from_template('theme_boost_campus/full_header', $header);
+        }
         // MODIFICATION END.
         /* ORIGINAL START
         return $this->render_from_template('core/full_header', $header);
diff --git a/layout/columns2.php b/layout/columns2.php
index 16aa21c..bbfa238 100644
--- a/layout/columns2.php
+++ b/layout/columns2.php
@@ -153,8 +153,8 @@ $nav = $PAGE->flatnav;
 // MODIDFICATION START.
 // Use the returned value from theme_boost_campus_get_modified_flatnav_defaulthomepageontop as the template context.
 $templatecontext['flatnavigation'] = theme_boost_campus_process_flatnav($nav);
-// If setting showsettingsincourse is enabled.
-if (get_config('theme_boost_campus', 'showsettingsincourse') == 'yes') {
+// If setting showsettingsincourse is enabled and we are not on the content bank view page (contentbank/view.php).
+if (get_config('theme_boost_campus', 'showsettingsincourse') == 'yes' && $PAGE->bodyid != 'page-contentbank') {
     // Context value for requiring incoursesettings.js.
     $templatecontext['incoursesettings'] = true;
     // Add the returned value from theme_boost_campus_get_incourse_settings to the template context.
-- 
GitLab