Differences Between: [Versions 400 and 403] [Versions 401 and 403] [Versions 402 and 403]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * A drawer based layout for the boost theme. 19 * 20 * @package theme_boost 21 * @copyright 2021 Bas Brands 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 defined('MOODLE_INTERNAL') || die(); 26 27 require_once($CFG->libdir . '/behat/lib.php'); 28 require_once($CFG->dirroot . '/course/lib.php'); 29 30 // Add block button in editing mode. 31 $addblockbutton = $OUTPUT->addblockbutton(); 32 33 if (isloggedin()) { 34 $courseindexopen = (get_user_preferences('drawer-open-index', true) == true); 35 $blockdraweropen = (get_user_preferences('drawer-open-block') == true); 36 } else { 37 $courseindexopen = false; 38 $blockdraweropen = false; 39 } 40 41 if (defined('BEHAT_SITE_RUNNING') && get_user_preferences('behat_keep_drawer_closed') != 1) { 42 $blockdraweropen = true; 43 } 44 45 $extraclasses = ['uses-drawers']; 46 if ($courseindexopen) { 47 $extraclasses[] = 'drawer-open-index'; 48 } 49 50 $blockshtml = $OUTPUT->blocks('side-pre'); 51 $hasblocks = (strpos($blockshtml, 'data-block=') !== false || !empty($addblockbutton)); 52 if (!$hasblocks) { 53 $blockdraweropen = false; 54 } 55 $courseindex = core_course_drawer(); 56 if (!$courseindex) { 57 $courseindexopen = false; 58 } 59 60 $bodyattributes = $OUTPUT->body_attributes($extraclasses); 61 $forceblockdraweropen = $OUTPUT->firstview_fakeblocks(); 62 63 $secondarynavigation = false; 64 $overflow = ''; 65 if ($PAGE->has_secondary_navigation()) { 66 $tablistnav = $PAGE->has_tablist_secondary_navigation(); 67 $moremenu = new \core\navigation\output\more_menu($PAGE->secondarynav, 'nav-tabs', true, $tablistnav); 68 $secondarynavigation = $moremenu->export_for_template($OUTPUT); 69 $overflowdata = $PAGE->secondarynav->get_overflow_menu_data(); 70 if (!is_null($overflowdata)) { 71 $overflow = $overflowdata->export_for_template($OUTPUT); 72 } 73 } 74 75 $primary = new core\navigation\output\primary($PAGE); 76 $renderer = $PAGE->get_renderer('core'); 77 $primarymenu = $primary->export_for_template($renderer); 78 $buildregionmainsettings = !$PAGE->include_region_main_settings_in_header_actions() && !$PAGE->has_secondary_navigation(); 79 // If the settings menu will be included in the header then don't add it here. 80 $regionmainsettingsmenu = $buildregionmainsettings ? $OUTPUT->region_main_settings_menu() : false; 81 82 $header = $PAGE->activityheader; 83 $headercontent = $header->export_for_template($renderer); 84 85 $templatecontext = [ 86 'sitename' => format_string($SITE->shortname, true, ['context' => context_course::instance(SITEID), "escape" => false]), 87 'output' => $OUTPUT, 88 'sidepreblocks' => $blockshtml, 89 'hasblocks' => $hasblocks, 90 'bodyattributes' => $bodyattributes, 91 'courseindexopen' => $courseindexopen, 92 'blockdraweropen' => $blockdraweropen, 93 'courseindex' => $courseindex, 94 'primarymoremenu' => $primarymenu['moremenu'], 95 'secondarymoremenu' => $secondarynavigation ?: false, 96 'mobileprimarynav' => $primarymenu['mobileprimarynav'], 97 'usermenu' => $primarymenu['user'], 98 'langmenu' => $primarymenu['lang'], 99 'forceblockdraweropen' => $forceblockdraweropen, 100 'regionmainsettingsmenu' => $regionmainsettingsmenu, 101 'hasregionmainsettingsmenu' => !empty($regionmainsettingsmenu), 102 'overflow' => $overflow, 103 'headercontent' => $headercontent, 104 'addblockbutton' => $addblockbutton 105 ]; 106 107 echo $OUTPUT->render_from_template('theme_boost/drawers', $templatecontext);
title
Description
Body
title
Description
Body
title
Description
Body
title
Body