Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

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