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.
/ -> help.php (source)
   1  <?php
   2  
   3  // This file is part of Moodle - http://moodle.org/
   4  //
   5  // Moodle is free software: you can redistribute it and/or modify
   6  // it under the terms of the GNU General Public License as published by
   7  // the Free Software Foundation, either version 3 of the License, or
   8  // (at your option) any later version.
   9  //
  10  // Moodle is distributed in the hope that it will be useful,
  11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13  // GNU General Public License for more details.
  14  //
  15  // You should have received a copy of the GNU General Public License
  16  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  17  
  18  /**
  19   * Displays help via AJAX call or in a new page
  20   *
  21   * Use {@link core_renderer::help_icon()} or {@link addHelpButton()} to display
  22   * the help icon.
  23   *
  24   * @copyright 2002 onwards Martin Dougiamas
  25   * @package   core
  26   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  27   */
  28  
  29  define('NO_MOODLE_COOKIES', true);
  30  
  31  require_once(__DIR__ . '/config.php');
  32  
  33  $identifier = required_param('identifier', PARAM_STRINGID);
  34  $component  = required_param('component', PARAM_COMPONENT);
  35  $lang       = optional_param('lang', 'en', PARAM_LANG);
  36  
  37  // We don't actually modify the session here as we have NO_MOODLE_COOKIES set.
  38  $SESSION->lang = $lang;
  39  
  40  $PAGE->set_url('/help.php');
  41  $PAGE->set_pagelayout('popup');
  42  $PAGE->set_context(context_system::instance());
  43  
  44  $data = get_formatted_help_string($identifier, $component, false);
  45  if (!empty($data->heading)) {
  46      $PAGE->set_title($data->heading);
  47  } else {
  48      $PAGE->set_title(get_string('help'));
  49  }
  50  echo $OUTPUT->header();
  51  if (!empty($data->heading)) {
  52      echo $OUTPUT->heading($data->heading, 1, 'helpheading');
  53  }
  54  echo $data->text;
  55  if (isset($data->completedoclink)) {
  56      echo $data->completedoclink;
  57  }
  58  echo $OUTPUT->footer();