Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement: Add more static pages, solves #351. #353

Merged
merged 1 commit into from
Aug 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ moodle-theme_boost_union
Changes
-------

### Unreleased

* 2023-08-02 - Improvement: Add 'aboutus', 'offers', 'page1', 'page2' and 'page3' static pages, solves #351.
* 2023-08-19 - Bugfix: Fix unparsable example JSON in Mustache template, solves #348.
* 2023-08-18 - Improvement: Add CSS and Scripts for local_och5p local_och5pcore to the theme renderer.
* 2023-08-13 - Improvement: Make the fonts in the dark navbar variants always fully white (not only when hovered) to improve the contrast.
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,14 @@ Whatever you add to this textarea will be displayed at the end of a page, in the

In this tab there are the following settings:

##### About us

With these settings, you can add rich text content which will be shown on an about us page.

##### Offers

With these settings, you can add rich text content which will be shown on an offers page.

##### Imprint

With these settings, you can add rich text content which will be shown on the imprint page.
Expand All @@ -395,6 +403,18 @@ With these settings, you can add rich text content which will be shown on a help

With these settings, you can add rich text content which will be shown on a maintenance information page (which is not the same as the built-in Moodle maintenance page).

##### Generic page 1

With these settings, you can add rich text content which will be shown on a generic page 1.

##### Generic page 2

With these settings, you can add rich text content which will be shown on a generic page 2.

##### Generic page 3

With these settings, you can add rich text content which will be shown on a generic page 3.

#### Tab "Information banners"

In this tab, you can enable and configure multiple information banners to be shown on selected pages.
Expand Down
95 changes: 95 additions & 0 deletions lang/en/theme_boost_union.php
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,44 @@

// Settings: Static pages tab.
$string['staticpagestab'] = 'Static pages';
// ... Section: About us.
$string['aboutusheading'] = 'About us';
// ... ... Setting: Enable about us page.
$string['enableaboutussetting'] = 'Enable about us page';
$string['aboutusdisabled'] = 'The about us page is disabled for this site. There is nothing to see here.';
// ... ... Setting: About us content.
$string['aboutuscontentsetting'] = 'About us content';
$string['aboutuscontentsetting_desc'] = 'In this setting, you can add rich text content which will be shown on the about us page.';
// ... ... Setting: About us page title.
$string['aboutuspagetitledefault'] = 'About us';
$string['aboutuspagetitlesetting'] = 'About us page title';
$string['aboutuspagetitlesetting_desc'] = 'In this setting, you can define the title of the about us page. This text will be used as link text to the about us page as well if you configure \'About us link position\' accordingly.';
// ... ... Setting: About us link position.
$string['aboutuslinkpositionnone'] = 'Do not automatically show a link to the about us page';
$string['aboutuslinkpositionfootnote'] = 'Add a link to the about us page to the footnote';
$string['aboutuslinkpositionfooter'] = 'Add a link to the about us page to the footer (questionmark) icon';
$string['aboutuslinkpositionboth'] = 'Add a link to the about us page to the footnote and to the footer (questionmark) icon';
$string['aboutuslinkpositionsetting'] = 'About us link position';
$string['aboutuslinkpositionsetting_desc'] = 'In this setting, you can configure if a link to the about us page should be added automatically to the Moodle page. If you do not want to show a link automatically, you can add a link to {$a->url} from anywhere in Moodle manually.';
// ... Section: Offers.
$string['offersheading'] = 'Offers';
// ... ... Setting: Enable offers page.
$string['enableofferssetting'] = 'Enable offers page';
$string['offersdisabled'] = 'The offers page is disabled for this site. There is nothing to see here.';
// ... ... Setting: Offers content.
$string['offerscontentsetting'] = 'Offers content';
$string['offerscontentsetting_desc'] = 'In this setting, you can add rich text content which will be shown on the offers page.';
// ... ... Setting: Offers page title.
$string['offerspagetitledefault'] = 'Offers';
$string['offerspagetitlesetting'] = 'Offers page title';
$string['offerspagetitlesetting_desc'] = 'In this setting, you can define the title of the offers page. This text will be used as link text to the offers page as well if you configure \'Offers link position\' accordingly.';
// ... ... Setting: Offers link position.
$string['offerslinkpositionnone'] = 'Do not automatically show a link to the offers page';
$string['offerslinkpositionfootnote'] = 'Add a link to the offers page to the footnote';
$string['offerslinkpositionfooter'] = 'Add a link to the offers page to the footer (questionmark) icon';
$string['offerslinkpositionboth'] = 'Add a link to the offers page to the footnote and to the footer (questionmark) icon';
$string['offerslinkpositionsetting'] = 'Offers link position';
$string['offerslinkpositionsetting_desc'] = 'In this setting, you can configure if a link to the offers page should be added automatically to the Moodle page. If you do not want to show a link automatically, you can add a link to {$a->url} from anywhere in Moodle manually.';
// ... Section: Imprint.
$string['imprintheading'] = 'Imprint';
// ... ... Setting: Enable imprint.
Expand Down Expand Up @@ -556,6 +594,63 @@
$string['maintenancelinkpositionboth'] = 'Add a link to the maintenance information page to the footnote and to the footer (questionmark) icon';
$string['maintenancelinkpositionsetting'] = 'Maintenance information page link position';
$string['maintenancelinkpositionsetting_desc'] = 'In this setting, you can configure if a link to the maintenance information page should be added automatically to the Moodle page. If you do not want to show a link automatically, you can add a link to {$a->url} from anywhere in Moodle manually.';
// ... Section: Generic page 1.
$string['page1heading'] = 'Generic page 1';
// ... ... Setting: Enable generic page 1.
$string['enablepage1setting'] = 'Enable generic page 1';
$string['page1disabled'] = 'The generic page 1 is disabled for this site. There is nothing to see here.';
// ... ... Setting: Generic page 1 content.
$string['page1contentsetting'] = 'Generic page 1 content';
$string['page1contentsetting_desc'] = 'In this setting, you can add rich text content which will be shown on the generic page 1.';
// ... ... Setting: Generic page 1 title.
$string['page1pagetitledefault'] = 'Generic page 1';
$string['page1pagetitlesetting'] = 'Generic page 1 title';
$string['page1pagetitlesetting_desc'] = 'In this setting, you can define the title of the generic page 1. This text will be used as link text to the generic page 1 as well if you configure \'Generic page 1 link position\' accordingly.';
// ... ... Setting: Generic page 1 link position.
$string['page1linkpositionnone'] = 'Do not automatically show a link to the generic page 1';
$string['page1linkpositionfootnote'] = 'Add a link to the generic page 1 to the footnote';
$string['page1linkpositionfooter'] = 'Add a link to the generic page 1 to the footer (questionmark) icon';
$string['page1linkpositionboth'] = 'Add a link to the generic page 1 to the footnote and to the footer (questionmark) icon';
$string['page1linkpositionsetting'] = 'Generic page 1 link position';
$string['page1linkpositionsetting_desc'] = 'In this setting, you can configure if a link to the generic page 1 should be added automatically to the Moodle page. If you do not want to show a link automatically, you can add a link to {$a->url} from anywhere in Moodle manually.';
// ... Section: Generic page 2.
$string['page2heading'] = 'Generic page 2';
// ... ... Setting: Enable generic page 2.
$string['enablepage2setting'] = 'Enable generic page 2';
$string['page2disabled'] = 'The generic page 2 is disabled for this site. There is nothing to see here.';
// ... ... Setting: Generic page 2 content.
$string['page2contentsetting'] = 'Generic page 2 content';
$string['page2contentsetting_desc'] = 'In this setting, you can add rich text content which will be shown on the generic page 2.';
// ... ... Setting: Generic page 2 title.
$string['page2pagetitledefault'] = 'Generic page 2';
$string['page2pagetitlesetting'] = 'Generic page 2 title';
$string['page2pagetitlesetting_desc'] = 'In this setting, you can define the title of the generic page 2. This text will be used as link text to the generic page 2 as well if you configure \'Generic page 2 link position\' accordingly.';
// ... ... Setting: Generic page 2 link position.
$string['page2linkpositionnone'] = 'Do not automatically show a link to the generic page 2';
$string['page2linkpositionfootnote'] = 'Add a link to the generic page 2 to the footnote';
$string['page2linkpositionfooter'] = 'Add a link to the generic page 2 to the footer (questionmark) icon';
$string['page2linkpositionboth'] = 'Add a link to the generic page 2 to the footnote and to the footer (questionmark) icon';
$string['page2linkpositionsetting'] = 'Generic page 2 link position';
$string['page2linkpositionsetting_desc'] = 'In this setting, you can configure if a link to the generic page 2 should be added automatically to the Moodle page. If you do not want to show a link automatically, you can add a link to {$a->url} from anywhere in Moodle manually.';
// ... Section: Generic page 3.
$string['page3heading'] = 'Generic page 3';
// ... ... Setting: Enable generic page 3.
$string['enablepage3setting'] = 'Enable generic page 3';
$string['page3disabled'] = 'The generic page 3 is disabled for this site. There is nothing to see here.';
// ... ... Setting: Generic page 3 content.
$string['page3contentsetting'] = 'Generic page 3 content';
$string['page3contentsetting_desc'] = 'In this setting, you can add rich text content which will be shown on the generic page 3.';
// ... ... Setting: Generic page 3 title.
$string['page3pagetitledefault'] = 'Generic page 3';
$string['page3pagetitlesetting'] = 'Generic page 3 title';
$string['page3pagetitlesetting_desc'] = 'In this setting, you can define the title of the generic page 3. This text will be used as link text to the generic page 3 as well if you configure \'Generic page 3 link position\' accordingly.';
// ... ... Setting: Generic page 3 link position.
$string['page3linkpositionnone'] = 'Do not automatically show a link to the generic page 3';
$string['page3linkpositionfootnote'] = 'Add a link to the generic page 3 to the footnote';
$string['page3linkpositionfooter'] = 'Add a link to the generic page 3 to the footer (questionmark) icon';
$string['page3linkpositionboth'] = 'Add a link to the generic page 3 to the footnote and to the footer (questionmark) icon';
$string['page3linkpositionsetting'] = 'Generic page 3 link position';
$string['page3linkpositionsetting_desc'] = 'In this setting, you can configure if a link to the generic page 3 should be added automatically to the Moodle page. If you do not want to show a link automatically, you can add a link to {$a->url} from anywhere in Moodle manually.';
// Settings: Info banners tab.
$string['infobannertab'] = 'Info banner';
// ... Section: Info banners.
Expand Down
2 changes: 1 addition & 1 deletion layout/includes/staticpages.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
$config = get_config('theme_boost_union');

// The static pages to be supported.
$staticpages = array('imprint', 'contact', 'help', 'maintenance');
$staticpages = array('aboutus', 'offers', 'imprint', 'contact', 'help', 'maintenance', 'page1', 'page2', 'page3');

// Iterate over the static pages.
foreach ($staticpages as $staticpage) {
Expand Down
75 changes: 75 additions & 0 deletions pages/aboutus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?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/>.

/**
* Theme Boost Union - About us page.
*
* @package theme_boost_union
* @copyright 2022 Alexander Bias, lern.link GmbH <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

// Include config.php.
// @codingStandardsIgnoreStart
// Let codechecker ignore the next line because otherwise it would complain about a missing login check
// after requiring config.php which is really not needed.
require(__DIR__ . '/../../../config.php');
// @codingStandardsIgnoreEnd

// Require the necessary libraries.
require_once($CFG->dirroot.'/theme/boost_union/lib.php');
require_once($CFG->dirroot.'/theme/boost_union/locallib.php');

// Set page URL.
$PAGE->set_url('/theme/boost_union/pages/aboutus.php');

// Set page layout.
$PAGE->set_pagelayout('standard');

// Set page context.
$PAGE->set_context(context_system::instance());

// Add page name as body class.
$PAGE->add_body_class('theme_boost_union-aboutus');

// Get theme config.
$config = get_config('theme_boost_union');

// If the aboutus is disabled, we just show a short friendly warning page and are done.
if ($config->enableaboutus != THEME_BOOST_UNION_SETTING_SELECT_YES) {
echo $OUTPUT->header();
$notification = new \core\output\notification(get_string('aboutusdisabled', 'theme_boost_union'),
\core\output\notification::NOTIFY_INFO);
$notification->set_show_closebutton(false);
echo $OUTPUT->render($notification);
echo $OUTPUT->footer();
die;
}

// Set page title.
$PAGE->set_title(theme_boost_union_get_staticpage_pagetitle('aboutus'));

// Start page output.
echo $OUTPUT->header();

// Show page heading.
echo $OUTPUT->heading(theme_boost_union_get_staticpage_pagetitle('aboutus'));

// Output aboutus content.
echo format_text($config->aboutuscontent);

// Finish page.
echo $OUTPUT->footer();
75 changes: 75 additions & 0 deletions pages/offers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?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/>.

/**
* Theme Boost Union - Offers page.
*
* @package theme_boost_union
* @copyright 2022 Alexander Bias, lern.link GmbH <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

// Include config.php.
// @codingStandardsIgnoreStart
// Let codechecker ignore the next line because otherwise it would complain about a missing login check
// after requiring config.php which is really not needed.
require(__DIR__ . '/../../../config.php');
// @codingStandardsIgnoreEnd

// Require the necessary libraries.
require_once($CFG->dirroot.'/theme/boost_union/lib.php');
require_once($CFG->dirroot.'/theme/boost_union/locallib.php');

// Set page URL.
$PAGE->set_url('/theme/boost_union/pages/offers.php');

// Set page layout.
$PAGE->set_pagelayout('standard');

// Set page context.
$PAGE->set_context(context_system::instance());

// Add page name as body class.
$PAGE->add_body_class('theme_boost_union-offers');

// Get theme config.
$config = get_config('theme_boost_union');

// If the offers is disabled, we just show a short friendly warning page and are done.
if ($config->enableoffers != THEME_BOOST_UNION_SETTING_SELECT_YES) {
echo $OUTPUT->header();
$notification = new \core\output\notification(get_string('offersdisabled', 'theme_boost_union'),
\core\output\notification::NOTIFY_INFO);
$notification->set_show_closebutton(false);
echo $OUTPUT->render($notification);
echo $OUTPUT->footer();
die;
}

// Set page title.
$PAGE->set_title(theme_boost_union_get_staticpage_pagetitle('offers'));

// Start page output.
echo $OUTPUT->header();

// Show page heading.
echo $OUTPUT->heading(theme_boost_union_get_staticpage_pagetitle('offers'));

// Output offers content.
echo format_text($config->offerscontent);

// Finish page.
echo $OUTPUT->footer();
75 changes: 75 additions & 0 deletions pages/page1.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?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/>.

/**
* Theme Boost Union - Generic page 1.
*
* @package theme_boost_union
* @copyright 2022 Alexander Bias, lern.link GmbH <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

// Include config.php.
// @codingStandardsIgnoreStart
// Let codechecker ignore the next line because otherwise it would complain about a missing login check
// after requiring config.php which is really not needed.
require(__DIR__ . '/../../../config.php');
// @codingStandardsIgnoreEnd

// Require the necessary libraries.
require_once($CFG->dirroot.'/theme/boost_union/lib.php');
require_once($CFG->dirroot.'/theme/boost_union/locallib.php');

// Set page URL.
$PAGE->set_url('/theme/boost_union/pages/page1.php');

// Set page layout.
$PAGE->set_pagelayout('standard');

// Set page context.
$PAGE->set_context(context_system::instance());

// Add page name as body class.
$PAGE->add_body_class('theme_boost_union-page1');

// Get theme config.
$config = get_config('theme_boost_union');

// If the page1 is disabled, we just show a short friendly warning page and are done.
if ($config->enablepage1 != THEME_BOOST_UNION_SETTING_SELECT_YES) {
echo $OUTPUT->header();
$notification = new \core\output\notification(get_string('page1disabled', 'theme_boost_union'),
\core\output\notification::NOTIFY_INFO);
$notification->set_show_closebutton(false);
echo $OUTPUT->render($notification);
echo $OUTPUT->footer();
die;
}

// Set page title.
$PAGE->set_title(theme_boost_union_get_staticpage_pagetitle('page1'));

// Start page output.
echo $OUTPUT->header();

// Show page heading.
echo $OUTPUT->heading(theme_boost_union_get_staticpage_pagetitle('page1'));

// Output page1 content.
echo format_text($config->page1content);

// Finish page.
echo $OUTPUT->footer();
Loading