Merge branch 'MDL-80544' of https://github.com/paulholden/moodle
[moodle.git] / help.php
blob39053dbfe3c1053a2baa68dd60c163e25a1069f7
1 <?php
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.
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/>.
18 /**
19 * Displays help via AJAX call or in a new page
21 * Use {@link core_renderer::help_icon()} or {@link addHelpButton()} to display
22 * the help icon.
24 * @copyright 2002 onwards Martin Dougiamas
25 * @package core
26 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
29 define('NO_MOODLE_COOKIES', true);
31 require_once(__DIR__ . '/config.php');
33 $identifier = required_param('identifier', PARAM_STRINGID);
34 $component = required_param('component', PARAM_COMPONENT);
35 $lang = optional_param('lang', 'en', PARAM_LANG);
37 // We don't actually modify the session here as we have NO_MOODLE_COOKIES set.
38 $SESSION->lang = $lang;
40 $PAGE->set_url('/help.php');
41 $PAGE->set_pagelayout('popup');
42 $PAGE->set_context(context_system::instance());
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'));
50 echo $OUTPUT->header();
51 if (!empty($data->heading)) {
52 echo $OUTPUT->heading($data->heading, 1, 'helpheading');
54 echo $data->text;
55 if (isset($data->completedoclink)) {
56 echo $data->completedoclink;
58 echo $OUTPUT->footer();