course MDL-20628 Added the ability to name a course section, thanks Michael for the...
[moodle.git] / help.php
CommitLineData
822a1063 1<?php
6be7abc7 2/**
3 * help.php - Displays help page.
4 *
5 * Prints a very simple page and includes
6 * page content or a string from elsewhere.
7 * Usually this will appear in a popup
8 * See {@link helpbutton()} in {@link lib/moodlelib.php}
9 *
10 * @author Martin Dougiamas
6be7abc7 11 * @package moodlecore
12 */
53a78cef
PS
13
14define('NO_MOODLE_COOKIES', true);
15
6be7abc7 16require_once('config.php');
17
53a78cef
PS
18$identifier = required_param('identifier', PARAM_SAFEDIR);
19$component = required_param('component', PARAM_SAFEDIR);
259c165d
PS
20$lang = required_param('component', PARAM_LANG); // TODO: maybe split into separate scripts
21$ajax = optional_param('ajax', 0, PARAM_BOOL);
53a78cef
PS
22
23if (!$lang) {
24 $lang = 'en';
25}
26
27$SESSION->lang = $lang; // does not actually modify session because we do not use cookies here
3a915b06 28
259c165d 29$sm = get_string_manager();
6be7abc7 30
259c165d
PS
31//TODO: this is a minimalistic help page, needs a lot more love
32
33$PAGE->set_url('/help.php');
34$PAGE->set_pagelayout('popup'); // not really a popup because this page gets dispalyed directly only when JS disabled
35
36if ($ajax) {
37 @header('Content-Type: text/plain; charset=utf-8');
38} else {
39 echo $OUTPUT->header();
53a78cef 40}
868ca14f 41
259c165d
PS
42if ($sm->string_exists($identifier.'_hlp', $component)) {
43 echo get_string($identifier.'_hlp', $component);
44} else {
45 echo "<p><strong>TODO</strong>: fix help for [{$identifier}_hlp, $component]</p>";
46}
47
48if (!$ajax) {
49 echo $OUTPUT->footer();
50}