weekly release 4.0dev
[moodle.git] / help.php
... / ...
CommitLineData
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
29define('NO_MOODLE_COOKIES', true);
30
31require_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);
45if (!empty($data->heading)) {
46 $PAGE->set_title($data->heading);
47} else {
48 $PAGE->set_title(get_string('help'));
49}
50echo $OUTPUT->header();
51if (!empty($data->heading)) {
52 echo $OUTPUT->heading($data->heading, 1, 'helpheading');
53}
54echo $data->text;
55if (isset($data->completedoclink)) {
56 echo $data->completedoclink;
57}
58echo $OUTPUT->footer();