Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]

   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 two column layout for the boost theme.
  19   *
  20   * @package   theme_boost
  21   * @copyright 2016 Damyon Wiese
  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  
  29  // Add block button in editing mode.
  30  $addblockbutton = $OUTPUT->addblockbutton();
  31  
  32  $extraclasses = [];
  33  $bodyattributes = $OUTPUT->body_attributes($extraclasses);
  34  $blockshtml = $OUTPUT->blocks('side-pre');
  35  $hasblocks = (strpos($blockshtml, 'data-block=') !== false || !empty($addblockbutton));
  36  
  37  $secondarynavigation = false;
  38  $overflow = '';
  39  if ($PAGE->has_secondary_navigation()) {
  40      $tablistnav = $PAGE->has_tablist_secondary_navigation();
  41      $moremenu = new \core\navigation\output\more_menu($PAGE->secondarynav, 'nav-tabs', true, $tablistnav);
  42      $secondarynavigation = $moremenu->export_for_template($OUTPUT);
  43      $overflowdata = $PAGE->secondarynav->get_overflow_menu_data();
  44      if (!is_null($overflowdata)) {
  45          $overflow = $overflowdata->export_for_template($OUTPUT);
  46      }
  47  }
  48  
  49  $primary = new core\navigation\output\primary($PAGE);
  50  $renderer = $PAGE->get_renderer('core');
  51  $primarymenu = $primary->export_for_template($renderer);
  52  $buildregionmainsettings = !$PAGE->include_region_main_settings_in_header_actions()  && !$PAGE->has_secondary_navigation();
  53  // If the settings menu will be included in the header then don't add it here.
  54  $regionmainsettingsmenu = $buildregionmainsettings ? $OUTPUT->region_main_settings_menu() : false;
  55  
  56  $header = $PAGE->activityheader;
  57  $headercontent = $header->export_for_template($renderer);
  58  
  59  $templatecontext = [
  60      'sitename' => format_string($SITE->shortname, true, ['context' => context_course::instance(SITEID), "escape" => false]),
  61      'output' => $OUTPUT,
  62      'sidepreblocks' => $blockshtml,
  63      'hasblocks' => $hasblocks,
  64      'bodyattributes' => $bodyattributes,
  65      'primarymoremenu' => $primarymenu['moremenu'],
  66      'secondarymoremenu' => $secondarynavigation ?: false,
  67      'mobileprimarynav' => $primarymenu['mobileprimarynav'],
  68      'usermenu' => $primarymenu['user'],
  69      'langmenu' => $primarymenu['lang'],
  70      'regionmainsettingsmenu' => $regionmainsettingsmenu,
  71      'hasregionmainsettingsmenu' => !empty($regionmainsettingsmenu),
  72      'headercontent' => $headercontent,
  73      'overflow' => $overflow,
  74      'addblockbutton' => $addblockbutton,
  75  ];
  76  
  77  echo $OUTPUT->render_from_template('theme_boost/columns2', $templatecontext);