Mini Shell
<?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 LearnR - Static pages layout include.
*
* @package theme_learnr
* @copyright 2022 Alexander Bias, lern.link GmbH <[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/learnr/locallib.php');
$config = get_config('theme_learnr');
// The static pages to be supported.
$staticpages = array('imprint', 'contact', 'help', 'maintenance');
// Iterate over the static pages.
foreach ($staticpages as $staticpage) {
// If the page is enabled.
if ($config->{'enable'.$staticpage} == THEME_LEARNR_SETTING_SELECT_YES) {
// If the admin wants to show a link in the footnote or in both locations.
if ($config->{$staticpage.'linkposition'} == THEME_LEARNR_SETTING_STATICPAGELINKPOSITION_FOOTNOTE ||
$config->{$staticpage.'linkposition'} == THEME_LEARNR_SETTING_STATICPAGELINKPOSITION_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 page link in the footnote to templatecontext.
$templatecontext[$staticpage.'linkpositionfootnote'] = true;
}
// If the admin wants to show a link in the footer or in both locations.
if ($config->{$staticpage.'linkposition'} == THEME_LEARNR_SETTING_STATICPAGELINKPOSITION_FOOTER ||
$config->{$staticpage.'linkposition'} == THEME_LEARNR_SETTING_STATICPAGELINKPOSITION_BOTH) {
// Add marker to show the page link in the footer to templatecontext.
$templatecontext[$staticpage.'linkpositionfooter'] = true;
}
// Add the page link and page title to the templatecontext.
$templatecontext[$staticpage.'link'] = theme_learnr_get_staticpage_link($staticpage);
$templatecontext[$staticpage.'pagetitle'] = theme_learnr_get_staticpage_pagetitle($staticpage);
}
}
Zerion Mini Shell 1.0