-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from moodle-an-hochschulen/issue-32
Feature: Built-in imprint, solves #32
- Loading branch information
Showing
21 changed files
with
645 additions
and
8 deletions.
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
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
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,57 @@ | ||
<?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 - Static pages layout include. | ||
* | ||
* @package theme_boost_union | ||
* @copyright 2022 Moodle an Hochschulen e.V. <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
// Require the necessary libraries. | ||
require_once($CFG->dirroot.'/theme/boost_union/locallib.php'); | ||
|
||
$config = get_config('theme_boost_union'); | ||
|
||
// If the imprint is enabled. | ||
if ($config->enableimprint == THEME_BOOST_UNION_SETTING_SELECT_YES) { | ||
// If the admin wants to show a link in the footnote or in both locations. | ||
if ($config->imprintlinkposition == THEME_BOOST_UNION_SETTING_IMPRINTLINKPOSITION_FOOTNOTE || | ||
$config->imprintlinkposition == THEME_BOOST_UNION_SETTING_IMPRINTLINKPOSITION_BOTH) { | ||
// If the footnote is empty and not configured to be shown yet. | ||
if (isset($templatecontext['showfootnote']) == false || $templatecontext['showfootnote'] == false) { | ||
// Add marker to show the footnote to templatecontext. | ||
$templatecontext['showfootnote'] = true; | ||
} | ||
|
||
// Add marker to show the imprint link in the footnote to templatecontext. | ||
$templatecontext['imprintlinkpositionfootnote'] = true; | ||
} | ||
|
||
// If the admin wants to show a link in the footer or in both locations. | ||
if ($config->imprintlinkposition == THEME_BOOST_UNION_SETTING_IMPRINTLINKPOSITION_FOOTER || | ||
$config->imprintlinkposition == THEME_BOOST_UNION_SETTING_IMPRINTLINKPOSITION_BOTH) { | ||
// Add marker to show the imprint link in the footer to templatecontext. | ||
$templatecontext['imprintlinkpositionfooter'] = true; | ||
} | ||
|
||
// Add the imprint link and page title to the templatecontext. | ||
$templatecontext['imprintlink'] = theme_boost_union_get_imprint_link(); | ||
$templatecontext['imprintpagetitle'] = theme_boost_union_get_imprint_pagetitle(); | ||
} |
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
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,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 - Imprint page. | ||
* | ||
* @package theme_boost_union | ||
* @copyright 2022 Moodle an Hochschulen e.V. <[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/imprint.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-imprint'); | ||
|
||
// Get theme config. | ||
$config = get_config('theme_boost_union'); | ||
|
||
// If the imprint is disabled, we just show a short friendly warning page and are done. | ||
if ($config->enableimprint != THEME_BOOST_UNION_SETTING_SELECT_YES) { | ||
echo $OUTPUT->header(); | ||
$notification = new \core\output\notification(get_string('imprintdisabled', '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_imprint_pagetitle()); | ||
|
||
// Start page output. | ||
echo $OUTPUT->header(); | ||
|
||
// Show page heading. | ||
echo $OUTPUT->heading(theme_boost_union_get_imprint_pagetitle()); | ||
|
||
// Output imprint content. | ||
echo format_text($config->imprintcontent); | ||
|
||
// Finish page. | ||
echo $OUTPUT->footer(); |
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
Oops, something went wrong.