From 86433b1a8cf728643656eee4581232d09c620ab9 Mon Sep 17 00:00:00 2001 From: Joel Dapiawen Date: Thu, 23 Nov 2023 16:22:21 -0600 Subject: [PATCH] Activity header URL fix for mymedia and user profile --- classes/output/core_renderer.php | 45 +++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/classes/output/core_renderer.php b/classes/output/core_renderer.php index 6d80288b..bc0f9bf8 100644 --- a/classes/output/core_renderer.php +++ b/classes/output/core_renderer.php @@ -199,7 +199,7 @@ public function full_header() { // try to avoid problems with special characters in titles ( & ) $headertext = html_entity_decode($headertext); - + //Little hack to add back missing header for dashboard //The context header the comes through is not formated properly if($this->page->pagelayout=="mydashboard"&&strpos($PAGE->url,'my/indexsys.php')===false){ @@ -212,8 +212,7 @@ public function full_header() { $header->contextheader = '

'.$COURSE->fullname.'

'; } */ - //error_log('pg url:'.$PAGE->url); - + $activityheader = false; //error_log('$PAGE->url:'.$PAGE->url); @@ -234,12 +233,38 @@ public function full_header() { } else if (strpos($PAGE->url,'grade/')===false&&strpos($PAGE->url,'backup/')===false&&strpos($PAGE->url,'reset.php')===false&&strpos($PAGE->url,'coursecompetencies.php')===false&&strpos($PAGE->url,'unenrolself.php')===false&&strpos($PAGE->url,'newbadge.php')===false&&strpos($PAGE->url,'report/')===false&&$PAGE->url->get_param('bui_editid')===null&&strpos($PAGE->url,'my/courses.php')===false&&strpos($PAGE->url,'admin/')===false&&strpos($PAGE->url,'my/indexsys.php')===false) { $activityheader = true; } - - - + + if ($activityheader === true) { - $header->contextheader = ''.$headertext.''; - + + /** + * UOFR Hack + * Joel Dapiawen + * November 22, 2023 + * Override activity-header URL to macth the current Page URL.. + */ + $current_url = $PAGE->url; + + if (strpos($current_url, 'mymedia/mymedia.php') !== false || strpos($current_url, 'user/profile.php') !== false) { + + if (isset($header) && isset($headertext)) { + // Construct the header links based on URL conditions + if (strpos($current_url, 'mymedia/mymedia.php') !== false) { + $header->contextheader = '' . $headertext . ''; + // $header->contextheader = '' . $headertext . ''; + + } + + if (strpos($current_url, 'user/profile.php') !== false) { + $header->contextheader = '' . $headertext . ''; + // $header->contextheader = '' . $headertext . ''; + } + } + } else { + // default URL's for activity header.. + $header->contextheader = ''.$headertext.''; + } + } else { $headertext = $COURSE->fullname; @@ -258,8 +283,8 @@ public function full_header() { $header->contextheader = '';//'

'.$COURSE->fullname.'

'; $header->iscoursepage = true; } - - //error_log('Header actions:'.print_r($PAGE->get_header_actions(),1)); + + //error_log('Header actions:'.print_r($PAGE->get_header_actions(),1)); $header->headeractions = $PAGE->get_header_actions();