SCORM AICC MDL-2144 total_time accumulation calculated incorrectly. - thanks to Matte...
[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 31$PAGE->set_url('/help.php');
5435c9dc
MD
32$PAGE->set_pagelayout('popup');
33$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
259c165d
PS
34
35if ($ajax) {
36 @header('Content-Type: text/plain; charset=utf-8');
37} else {
38 echo $OUTPUT->header();
53a78cef 39}
868ca14f 40
5435c9dc
MD
41if ($sm->string_exists($identifier.'_help', $component)) {
42 $options = new object;
43 $options->trusted = false;
44 $options->noclean = false;
45 $options->smiley = false;
46 $options->filter = false;
47 $options->para = true;
48 $options->newlines = false;
49
50 // Should be simple wiki only MDL-21695
51 echo format_text(get_string($identifier.'_help', $component), FORMAT_MOODLE, $options);
52
53 if ($sm->string_exists($identifier.'_link', $component)) { // Link to further info in Moodle docs
54 $link = get_string($identifier.'_link', $component);
55 $linktext = get_string('morehelp');
56 echo '<div class="helpdoclink">'.$OUTPUT->doc_link($link, $linktext).'</div>';
57 }
58
259c165d 59} else {
5435c9dc 60 echo "<p><strong>TODO</strong>: fix help for [{$identifier}_help, $component]</p>";
259c165d
PS
61}
62
63if (!$ajax) {
64 echo $OUTPUT->footer();
65}