Rev 546 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
<?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/>./*** A two column layout for the universe theme.** @package theme_universe* @copyright 2023 Marcin Czaja (https://rosea.io)* @license Commercial https://themeforest.net/licenses*/defined('MOODLE_INTERNAL') || die();require_once($CFG->libdir . '/behat/lib.php');$draweropenright = false;$extraclasses = [];// Moodle 4. - Add block button in editing mode.$addblockbutton = $OUTPUT->addblockbutton();if (isloggedin()) {$blockdraweropen = (get_user_preferences('drawer-open-block') == true);} else {$blockdraweropen = false;}if (defined('BEHAT_SITE_RUNNING')) {$blockdraweropen = true;}$extraclasses = ['uses-drawers'];// End.// Dark mode.if (isloggedin()) {$navdraweropen = (get_user_preferences('drawer-open-nav', 'true') == 'true');$draweropenright = (get_user_preferences('sidepre-open', 'true') == 'true');if (theme_universe_get_setting('darkmodetheme') == '1') {$darkmodeon = get_user_preferences('darkmode-on');if ($darkmodeon) {$extraclasses[] = 'theme-dark';}$darkmodetheme = true;} else {$darkmodeon = false;}} else {$navdraweropen = false;}if (theme_universe_get_setting('darkmodefirst') == '1') {$extraclasses[] = 'theme-dark';$darkmodetheme = false;$darkmodeon = true;}$siteurl = $CFG->wwwroot;$blockshtml = $OUTPUT->blocks('side-pre');$hasblocks = (strpos($blockshtml, 'data-block=') !== false || !empty($addblockbutton));if (!$hasblocks) {$blockdraweropen = false;}$sidecourseblocks = $OUTPUT->blocks('sidecourseblocks');$hassidecourseblocks = strpos($sidecourseblocks, 'data-block=') !== false;if ($draweropenright && $hasblocks) {$extraclasses[] = 'drawer-open-right';}// Dashboard Blocks.$blockshtml2 = $OUTPUT->blocks('dtopblocks');$blockshtml3 = $OUTPUT->blocks('dbottomblocks');$blockshtml4 = $OUTPUT->blocks('dmiddleblocks');// End.// Moodle 4.$forceblockdraweropen = $OUTPUT->firstview_fakeblocks();$secondarynavigation = false;$overflow = '';if ($PAGE->has_secondary_navigation()) {$tablistnav = $PAGE->has_tablist_secondary_navigation();$moremenu = new \core\navigation\output\more_menu($PAGE->secondarynav, 'nav-tabs', true, $tablistnav);$secondarynavigation = $moremenu->export_for_template($OUTPUT);$overflowdata = $PAGE->secondarynav->get_overflow_menu_data();if (!is_null($overflowdata)) {$overflow = $overflowdata->export_for_template($OUTPUT);}}$primary = new core\navigation\output\primary($PAGE);$renderer = $PAGE->get_renderer('core');$primarymenu = $primary->export_for_template($renderer);$buildregionmainsettings = !$PAGE->include_region_main_settings_in_header_actions()&& !$PAGE->has_secondary_navigation();// If the settings menu will be included in the header then don't add it here.$regionmainsettingsmenu = $buildregionmainsettings ? $OUTPUT->region_main_settings_menu() : false;$header = $PAGE->activityheader;$headercontent = $header->export_for_template($renderer);if ($hassidecourseblocks) {$extraclasses[] = 'page-has-blocks';}if (!isloggedin() || isguestuser()) {$isnotloggedin = true;} else {$isnotloggedin = false;}// Check if guest user.if (isguestuser()) {$extraclasses[] = 'moodle-guest-user';}if (theme_universe_get_setting('backtotop') == '1') {$extraclasses[] = 'back-to-top-on';}$bodyattributes = $OUTPUT->body_attributes($extraclasses);$templatecontext = ['sitename' => format_string($SITE->shortname,true,['context' => context_course::instance(SITEID), "escape" => false]),'output' => $OUTPUT,'bodyattributes' => $bodyattributes,'darkmodeon' => !empty($darkmodeon),'darkmodetheme' => !empty($darkmodetheme),'siteurl' => $siteurl,'sidepreblocks' => $blockshtml,'dtopblocks' => $blockshtml2,'dbottomblocks' => $blockshtml3,'dmiddleblocks' => $blockshtml4,'hasblocks' => $hasblocks,'hasdtopblocks' => !empty($blockshtml2),'hasdbottomblocks' => !empty($blockshtml3),'regionmainsettingsmenu' => $regionmainsettingsmenu,'hasregionmainsettingsmenu' => !empty($regionmainsettingsmenu),'navdraweropen' => $navdraweropen,'draweropenright' => $draweropenright,'isnotloggedin' => $isnotloggedin,// Moodle 4.'blockdraweropen' => $blockdraweropen,'primarymoremenu' => $primarymenu['moremenu'],'secondarymoremenu' => $secondarynavigation ?: false,'forceblockdraweropen' => $forceblockdraweropen,'regionmainsettingsmenu' => $regionmainsettingsmenu,'hasregionmainsettingsmenu' => !empty($regionmainsettingsmenu),'overflow' => $overflow,'headercontent' => $headercontent,'addblockbutton' => $addblockbutton];// Get and use the course page information banners HTML code, if any course page hints are configured.$coursepageinformationbannershtml = theme_universe_get_course_information_banners();if ($coursepageinformationbannershtml) {$templatecontext['coursepageinformationbanners'] = $coursepageinformationbannershtml;}// End.// Load theme settings.$themesettings = new \theme_universe\util\theme_settings();$templatecontext = array_merge($templatecontext, $themesettings->global_settings());$PAGE->requires->js_call_amd('theme_universe/rui', 'init');if (theme_universe_get_setting('backtotop') == '1') {$PAGE->requires->js_call_amd('theme_universe/backtotop', 'init');}echo $OUTPUT->render_from_template('theme_universe/tmpl-dashboard', $templatecontext);