Differences Between: [Versions 400 and 401] [Versions 400 and 402] [Versions 400 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 user_preference_allow_ajax_update('drawer-open-nav', PARAM_ALPHA); 34 user_preference_allow_ajax_update('drawer-open-index', PARAM_BOOL); 35 user_preference_allow_ajax_update('drawer-open-block', PARAM_BOOL); 36 37 if (isloggedin()) { 38 $courseindexopen = (get_user_preferences('drawer-open-index', true) == true); 39 $blockdraweropen = (get_user_preferences('drawer-open-block') == true); 40 } else { 41 $courseindexopen = false; 42 $blockdraweropen = false; 43 } 44 45 if (defined('BEHAT_SITE_RUNNING')) { 46 $blockdraweropen = true; 47 } 48 49 $extraclasses = ['uses-drawers']; 50 if ($courseindexopen) { 51 $extraclasses[] = 'drawer-open-index'; 52 } 53 54 $blockshtml = $OUTPUT->blocks('side-pre'); 55 $hasblocks = (strpos($blockshtml, 'data-block=') !== false || !empty($addblockbutton)); 56 if (!$hasblocks) { 57 $blockdraweropen = false; 58 } 59 $courseindex = core_course_drawer(); 60 if (!$courseindex) { 61 $courseindexopen = false; 62 } 63 64 $bodyattributes = $OUTPUT->body_attributes($extraclasses); 65 $forceblockdraweropen = $OUTPUT->firstview_fakeblocks(); 66 67 $secondarynavigation = false; 68 $overflow = ''; 69 if ($PAGE->has_secondary_navigation()) { 70 $tablistnav = $PAGE->has_tablist_secondary_navigation(); 71 $moremenu = new \core\navigation\output\more_menu($PAGE->secondarynav, 'nav-tabs', true, $tablistnav); 72 $secondarynavigation = $moremenu->export_for_template($OUTPUT); 73 $overflowdata = $PAGE->secondarynav->get_overflow_menu_data(); 74 if (!is_null($overflowdata)) { 75 $overflow = $overflowdata->export_for_template($OUTPUT); 76 } 77 } 78 79 $primary = new core\navigation\output\primary($PAGE); 80 $renderer = $PAGE->get_renderer('core'); 81 $primarymenu = $primary->export_for_template($renderer); 82 $buildregionmainsettings = !$PAGE->include_region_main_settings_in_header_actions() && !$PAGE->has_secondary_navigation(); 83 // If the settings menu will be included in the header then don't add it here. 84 $regionmainsettingsmenu = $buildregionmainsettings ? $OUTPUT->region_main_settings_menu() : false; 85 86 $header = $PAGE->activityheader; 87 $headercontent = $header->export_for_template($renderer); 88 89 $templatecontext = [ 90 'sitename' => format_string($SITE->shortname, true, ['context' => context_course::instance(SITEID), "escape" => false]), 91 'output' => $OUTPUT, 92 'sidepreblocks' => $blockshtml, 93 'hasblocks' => $hasblocks, 94 'bodyattributes' => $bodyattributes, 95 'courseindexopen' => $courseindexopen, 96 'blockdraweropen' => $blockdraweropen, 97 'courseindex' => $courseindex, 98 'primarymoremenu' => $primarymenu['moremenu'], 99 'secondarymoremenu' => $secondarynavigation ?: false, 100 'mobileprimarynav' => $primarymenu['mobileprimarynav'], 101 'usermenu' => $primarymenu['user'], 102 'langmenu' => $primarymenu['lang'], 103 'forceblockdraweropen' => $forceblockdraweropen, 104 'regionmainsettingsmenu' => $regionmainsettingsmenu, 105 'hasregionmainsettingsmenu' => !empty($regionmainsettingsmenu), 106 'overflow' => $overflow, 107 'headercontent' => $headercontent, 108 'addblockbutton' => $addblockbutton 109 ]; 110 111 echo $OUTPUT->render_from_template('theme_boost/drawers', $templatecontext);
title
Description
Body
title
Description
Body
title
Description
Body
title
Body