Skip to content
Snippets Groups Projects
Commit f1452f00 authored by Kathrin Osswald's avatar Kathrin Osswald
Browse files

Adjusted core renderer method full_header due to changes in Boost and added...

Adjusted core renderer method full_header due to changes in Boost and added own version of header mustache.
parent 4f46df8f
Branches
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ Changes
### Unreleased
* 2018-05-15 - Adjusted core renderer method full_header due to changes in Boost and added own version of header mustache.
* 2018-05-14 - Adjusted improved mustache templates due to changes in the original templates.
* 2018-05-14 - Removed setting to show icons in the navdrawer due to integration of MDL-61298 into the core.
* 2018-05-14 - Made changes to nav drawer HTML structure undone due to integration of MDL-61343 into the core.
......
......@@ -131,7 +131,7 @@ class core_renderer extends \theme_boost\output\core_renderer {
/**
* Override to dispaly switched role information beneath the course header instead of the user menu.
* Override to display switched role information beneath the course header instead of the user menu.
* We change this because the switch role function is course related and therefore it should be placed in the course context.
*
* Wrapper for header elements.
......@@ -142,48 +142,27 @@ class core_renderer extends \theme_boost\output\core_renderer {
// MODIFICATION START.
global $PAGE, $USER, $COURSE, $CFG;
// MODIFICATION END.
/* ORIGINAL START.
global $PAGE;
ORIGINAL END. */
$html = html_writer::start_tag('header', array('id' => 'page-header', 'class' => 'row'));
$html .= html_writer::start_div('col-xs-12 p-a-1');
$html .= html_writer::start_div('card');
$html .= html_writer::start_div('card-block');
// MODIFICATION START:
// Only display the core context header menu if the setting "showsettingsincourse" is disabled
// or we are viewing the frontpage.
if (get_config('theme_boost_campus', 'showsettingsincourse') == 'no' || $PAGE->pagelayout == 'frontpage') {
$html .= html_writer::div($this->context_header_settings_menu(), 'pull-xs-right context-header-settings-menu');
$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 ($PAGE->pagelayout != 'mypublic') {
$header->settingsmenu = $this->context_header_settings_menu();
}
// MODIFICATION END.
/* ORIGINAL START.
$html .= html_writer::div($this->context_header_settings_menu(), 'pull-xs-right context-header-settings-menu');
/* ORIGINAL START
$header->settingsmenu = $this->context_header_settings_menu();
ORIGINAL END. */
// MODIFICATION START:
// To get the same structure as on the Dashboard, we need to add the page heading buttons here for the profile page.
if ($PAGE->pagelayout == 'mypublic') {
$html .= html_writer::div($this->page_heading_button(), 'breadcrumb-button pull-xs-right');
}
// MODIFICATION END.
$html .= html_writer::start_div('pull-xs-left');
$html .= $this->context_header();
$html .= html_writer::end_div();
$pageheadingbutton = $this->page_heading_button();
if (empty($PAGE->layout_options['nonavbar'])) {
$html .= html_writer::start_div('clearfix w-100 pull-xs-left', array('id' => 'page-navbar'));
$html .= html_writer::tag('div', $this->navbar(), array('class' => 'breadcrumb-nav'));
// MODIFICATION START: Add the course context menu to the course page, but not on the profile page.
if (get_config('theme_boost_campus', 'showsettingsincourse') == 'yes'
&& $PAGE->pagelayout != 'mypublic') {
$html .= html_writer::div($this->context_header_settings_menu(),
'pull-xs-right context-header-settings-menu m-l-1');
}
// MODIFICATION END.
// MODIFICATION START: Instead of the settings icon, add a button to edit the profile.
if ($PAGE->pagelayout == 'mypublic') {
$html .= html_writer::start_div('breadcrumb-button breadcrumb-button pull-xs-right');
$url = '';
$header->contextheader = $this->context_header();
$header->hasnavbar = empty($PAGE->layout_options['nonavbar']);
$header->navbar = $this->navbar();
// MODIFICATION START.
// Show the page heading button on all pages except for the profile page.
// There we replace it with an edit profile button.
if ($PAGE->pagelayout != 'mypublic') {
$header->pageheadingbutton = $this->page_heading_button();
} else {
// Get the id of the user for whom the profile page is shown.
$userid = optional_param('id', $USER->id, PARAM_INT);
// Check if the shown and the operating user are identical.
......@@ -192,31 +171,28 @@ class core_renderer extends \theme_boost\output\core_renderer {
has_capability('moodle/user:update', \context_system::instance())) {
$url = new moodle_url('/user/editadvanced.php', array('id' => $userid, 'course' => $COURSE->id,
'returnto' => 'profile'));
$html .= $this->single_button($url, get_string('editmyprofile', 'core'));
$header->pageheadingbutton .= $this->single_button($url, get_string('editmyprofile', 'core'));
} else if ((has_capability('moodle/user:editprofile', \context_user::instance($userid)) &&
!is_siteadmin($USER)) || ($currentuser &&
has_capability('moodle/user:editownprofile', \context_system::instance()))) {
$url = new moodle_url('/user/edit.php', array('id' => $userid, 'course' => $COURSE->id,
'returnto' => 'profile'));
$html .= $this->single_button($url, get_string('editmyprofile', 'core'));
$header->pageheadingbutton = $this->single_button($url, get_string('editmyprofile', 'core'));
}
$html .= html_writer::end_div();
}
// Do not show the page heading buttons on the profile page at this place.
// Display them only on other pages.
if ($PAGE->pagelayout != 'mypublic') {
$html .= html_writer::div($pageheadingbutton, 'breadcrumb-button pull-xs-right');
}
// MODIFICATION END.
$html .= html_writer::end_div();
} else if ($pageheadingbutton) {
$html .= html_writer::div($pageheadingbutton, 'breadcrumb-button nonavbar pull-xs-right');
}
$html .= html_writer::tag('div', $this->course_header(), array('id' => 'course-header'));
$html .= html_writer::end_div();
$html .= html_writer::end_div();
$html .= html_writer::end_div();
$html .= html_writer::end_tag('header');
/* ORIGINAL START
$header->pageheadingbutton = $this->page_heading_button();
ORIGINAL END. */
$header->courseheader = $this->course_header();
// 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/header', $header);
// MODIFICATION END.
/* ORIGINAL START
return $this->render_from_template('theme_boost/header', $header);
ORIGINAL END. */
// MODIFICATION START:
// If the setting showhintcoursehidden is set, the visibility of the course is hidden and
......@@ -283,7 +259,6 @@ class core_renderer extends \theme_boost\output\core_renderer {
}
}
// MODIFICATION END.
return $html;
}
......
......@@ -215,6 +215,14 @@ body.loginbackgroundimage {
Course header
-------------------------------------*/
/* Remove margin from the pageheadingbuttons in the course header. */
#page-header {
.breadcrumb,
.singlebutton form {
margin: 0;
}
}
/*
* If set in showswitchedroleincourse, the switched role information will be displayed
* in the course header instead of next to the user name.
......@@ -228,10 +236,7 @@ body.loginbackgroundimage {
/* If showsettingsincourse is enabled, we have to style the cog icon a bit different. */
@if variable-exists(showsettingsincourse) {
@if $showsettingsincourse == 'yes' {
#page-navbar {
.breadcrumb-button {
margin-top: 0;
}
#page-header {
/* If the setting is enabled we do not need the triangle icon, because there is no menu
* popping up next to the cog icon. */
.context-header-settings-menu .dropdown-toggle::after {
......@@ -827,7 +832,7 @@ a[href^="mailto"]::before {
.course-hidden-infobox,
.switched-role-infobox,
.course-guestaccess-infobox {
min-height: 5rem;
min-height: 4rem;
}
......
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
Page header.
}}
{{! MODIFICATION:
* Changed the order of the settingsmenu item.
}}
<header id="page-header" class="row">
<div class="col-12 pt-3 pb-3">
<div class="card">
<div class="card-body">
<div class="d-flex">
<div class="mr-auto">
{{{contextheader}}}
</div>
</div>
<div class="d-flex flex-wrap">
{{#hasnavbar}}
<div id="page-navbar">
{{{navbar}}}
</div>
{{/hasnavbar}}
<div class="ml-auto d-flex">
{{{pageheadingbutton}}}
</div>
{{#settingsmenu}}
<div class="context-header-settings-menu ml-4">
{{{settingsmenu}}}
</div>
{{/settingsmenu}}
<div id="course-header">
{{{courseheader}}}
</div>
</div>
</div>
</div>
</div>
</header>
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
Page header.
}}
<header id="page-header" class="row">
<div class="col-12 pt-3 pb-3">
<div class="card">
<div class="card-body">
<div class="d-flex">
<div class="mr-auto">
{{{contextheader}}}
</div>
{{#settingsmenu}}
<div class="context-header-settings-menu">
{{{settingsmenu}}}
</div>
{{/settingsmenu}}
</div>
<div class="d-flex flex-wrap">
{{#hasnavbar}}
<div id="page-navbar">
{{{navbar}}}
</div>
{{/hasnavbar}}
<div class="ml-auto d-flex">
{{{pageheadingbutton}}}
</div>
<div id="course-header">
{{{courseheader}}}
</div>
</div>
</div>
</div>
</div>
</header>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment