MDL-65788 tool_policy: Prevent two modals rendering for guests.
[moodle.git] / help.php
CommitLineData
822a1063 1<?php
ff95caa8
DM
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
6be7abc7 18/**
ff95caa8 19 * Displays help via AJAX call or in a new page
6be7abc7 20 *
ff95caa8
DM
21 * Use {@link core_renderer::help_icon()} or {@link addHelpButton()} to display
22 * the help icon.
6be7abc7 23 *
ff95caa8
DM
24 * @copyright 2002 onwards Martin Dougiamas
25 * @package core
26 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
6be7abc7 27 */
53a78cef
PS
28
29define('NO_MOODLE_COOKIES', true);
30
1fcf0ca8 31require_once(__DIR__ . '/config.php');
6be7abc7 32
ff95caa8 33$identifier = required_param('identifier', PARAM_STRINGID);
aff24313 34$component = required_param('component', PARAM_COMPONENT);
56d465b2 35$lang = optional_param('lang', 'en', PARAM_LANG);
53a78cef 36
56d465b2
ARN
37// We don't actually modify the session here as we have NO_MOODLE_COOKIES set.
38$SESSION->lang = $lang;
6be7abc7 39
259c165d 40$PAGE->set_url('/help.php');
5435c9dc 41$PAGE->set_pagelayout('popup');
bf0f06b1 42$PAGE->set_context(context_system::instance());
259c165d 43
56d465b2 44$data = get_formatted_help_string($identifier, $component, false);
9eb24f08
BB
45if (!empty($data->heading)) {
46 $PAGE->set_title($data->heading);
47} else {
48 $PAGE->set_title(get_string('help'));
49}
56d465b2
ARN
50echo $OUTPUT->header();
51if (!empty($data->heading)) {
52 echo $OUTPUT->heading($data->heading, 1, 'helpheading');
259c165d 53}
56d465b2
ARN
54echo $data->text;
55if (isset($data->completedoclink)) {
56 echo $data->completedoclink;
259c165d 57}
56d465b2 58echo $OUTPUT->footer();