forked from moodle-an-hochschulen/moodle-theme_boost_union
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improvement: Add navigation to policy overview page, resolves moodle-…
- Loading branch information
1 parent
b01cd47
commit d60c39b
Showing
7 changed files
with
108 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
// 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/>. | ||
|
||
namespace theme_boost_union\output; | ||
|
||
/** | ||
* Theme Boost Union - tool_policy renderer | ||
* | ||
* @package theme_boost_union | ||
* @copyright 2024 Christian Wolters <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class tool_policy_renderer extends \tool_policy\output\renderer { | ||
|
||
/** | ||
* Overrides the header() function. | ||
* | ||
* The goal here is to override page layout for /admin/tool/policy/viewall.php. | ||
* | ||
* @return string HTML of the page header. | ||
*/ | ||
public function header() { | ||
// Check that only the /admin/tool/policy/viewall.php page is affected. | ||
$pageurl = new \moodle_url('/admin/tool/policy/viewall.php'); | ||
if ($pageurl->compare($this->page->url, URL_MATCH_BASE) == true) { | ||
|
||
// If the admin wants to show navigation on the policy page. | ||
$config = get_config('theme_boost_union', 'policyoverviewnavigation'); | ||
if (isset($config) && $config == THEME_BOOST_UNION_SETTING_SELECT_YES) { | ||
// Set the page layout to standard. | ||
$this->page->set_pagelayout('standard'); | ||
} | ||
} | ||
|
||
// Call and return the header function. | ||
return parent::header(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
tests/behat/theme_boost_union_feelsettings_pagelayouts.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
@theme @theme_boost_union @theme_boost_union_feelsettings @theme_boost_union_feelsettings_pagelayouts | ||
Feature: Configuring the theme_boost_union plugin for the "Page layouts" tab on the "Feel" page | ||
In order to use the features | ||
As admin | ||
I need to be able to configure the theme Boost Union plugin | ||
|
||
@javascript | ||
Scenario Outline: Setting: Show navigation on policy overview page | ||
Given the following config values are set as admin: | ||
| config | value | plugin | | ||
| policyoverviewnavigation | <setting> | theme_boost_union | | ||
And I visit '/admin/tool/policy/viewall.php' | ||
Then ".navbar" "css_element" <shouldornot> exist | ||
And "#page-footer" "css_element" <shouldornot> exist | ||
|
||
Examples: | ||
| setting | shouldornot | | ||
| yes | should | | ||
| no | should not | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters