MDL-21695 adding help strings
[moodle.git] / help.php
blobeb88b48491d83a087ba9456ad1ba92d09ba042e9
1 <?php
2 /**
3 * help.php - Displays help page.
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}
10 * @author Martin Dougiamas
11 * @package moodlecore
14 define('NO_MOODLE_COOKIES', true);
16 require_once('config.php');
18 $identifier = required_param('identifier', PARAM_SAFEDIR);
19 $component = required_param('component', PARAM_SAFEDIR);
20 $lang = required_param('component', PARAM_LANG); // TODO: maybe split into separate scripts
21 $ajax = optional_param('ajax', 0, PARAM_BOOL);
23 if (!$lang) {
24 $lang = 'en';
27 $SESSION->lang = $lang; // does not actually modify session because we do not use cookies here
29 $sm = get_string_manager();
31 //TODO: this is a minimalistic help page, needs a lot more love
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
36 if ($ajax) {
37 @header('Content-Type: text/plain; charset=utf-8');
38 } else {
39 echo $OUTPUT->header();
42 if ($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>";
48 if (!$ajax) {
49 echo $OUTPUT->footer();