Merge branch 'MDL-48342_27' of git://github.com/jmvedrine/moodle into MOODLE_27_STABLE
[moodle.git] / help.php
blob5b5a65fcf1e0c5e2a46673f0bfd0ec4775523147
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(dirname(__FILE__) . '/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 echo $OUTPUT->header();
46 if (!empty($data->heading)) {
47 echo $OUTPUT->heading($data->heading, 1, 'helpheading');
49 echo $data->text;
50 if (isset($data->completedoclink)) {
51 echo $data->completedoclink;
53 echo $OUTPUT->footer();