Fixed firstname lastname to call to fullname function
[moodle.git] / help.php
CommitLineData
822a1063 1<?php
2
3 /**
4 * help.php - Displays help page.
5 *
6 * Prints a very simple page and includes
7 * page content or a string from elsewhere.
8 * Usually this will appear in a popup
9 * See {@link helpbutton()} in {@link lib/moodlelib.php}
10 *
11 * @author Martin Dougiamas
12 * @version $Id$
13 * @package moodlecore
14 */
15
16
17 require_once('config.php');
18
19 optional_variable($file, '');
20 optional_variable($text, 'No text to display');
21 optional_variable($module, 'moodle');
65cf9fc3 22
aa635c47 23 print_header();
5c0ee23c 24
822a1063 25 if (detect_munged_arguments($module .'/'. $file)) {
26 error('Filenames contain illegal characters!');
aa635c47 27 }
70442fe3 28
822a1063 29 print_simple_box_start('center', '96%');
d6f73f53 30
aa635c47 31 $helpfound = false;
822a1063 32 $langs = array(current_language(), get_string('parentlanguage'), 'en'); // Fallback
1517c0aa 33
aa635c47 34 if (!empty($file)) {
aa635c47 35 foreach ($langs as $lang) {
36 if (empty($lang)) {
37 continue;
38 }
822a1063 39 if ($module == 'moodle') {
40 $filepath = $CFG->dirroot .'/lang/'. $lang .'/help/'. $file;
70442fe3 41 } else {
822a1063 42 $filepath = $CFG->dirroot .'/lang/'. $lang .'/help/'. $module .'/'. $file;
70442fe3 43 }
aa635c47 44
822a1063 45 if (file_exists($filepath)) {
aa635c47 46 $helpfound = true;
822a1063 47 include($filepath); // The actual helpfile
1517c0aa 48
822a1063 49 if ($module == 'moodle' and ($file == 'index.html' or $file == 'mods.html')) {
1517c0aa 50 // include file for each module
51
822a1063 52 if (!$modules = get_records('modules', 'visible', 1)) {
53 error('No modules found!!'); // Should never happen
1517c0aa 54 }
55
56 foreach ($modules as $mod) {
822a1063 57 $strmodulename = get_string('modulename', $mod->name);
1517c0aa 58 $modulebyname[$strmodulename] = $mod;
59 }
60 ksort($modulebyname);
61
62 foreach ($modulebyname as $mod) {
63 foreach ($langs as $lang) {
64 if (empty($lang)) {
65 continue;
66 }
822a1063 67 $filepath = $CFG->dirroot .'/lang/'. $lang .'/help/'. $mod->name .'/'. $file;
1517c0aa 68
822a1063 69 if (file_exists($filepath)) {
6da4b261 70 echo '<hr size="1" />';
822a1063 71 include($filepath); // The actual helpfile
6da4b261 72 break;
73 }
74 }
75 }
76 }
77
822a1063 78 if ($module == 'moodle' and ($file == 'resource/types.html')) { // RESOURCES
79 require_once($CFG->dirroot .'/mod/resource/lib.php');
6da4b261 80 $typelist = resource_get_resource_types();
81 $typelist['label'] = get_string('resourcetypelabel', 'resource');
82
83 foreach ($typelist as $type => $name) {
84 foreach ($langs as $lang) {
85 if (empty($lang)) {
86 continue;
87 }
822a1063 88 $filepath = $CFG->dirroot .'/lang/'. $lang .'/help/resource/type/'. $type .'.html';
89 if (file_exists($filepath)) {
6da4b261 90 echo '<hr size="1" />';
822a1063 91 include($filepath); // The actual helpfile
1517c0aa 92 break;
93 }
94 }
95 }
96 }
aa635c47 97 break;
70442fe3 98 }
65cf9fc3 99 }
100 } else {
822a1063 101 echo '<p>';
4bd22e0f 102 echo clean_text($text);
822a1063 103 echo '</p>';
aa635c47 104 $helpfound = true;
105 }
106
d6f73f53 107 print_simple_box_end();
108
aa635c47 109 if (!$helpfound) {
32a4f1f1 110 $file = clean_text($file); // Keep it clean!
822a1063 111 notify('Help file "'. $file .'" could not be found!');
65cf9fc3 112 }
e5dfd0f3 113
114 close_window_button();
95b50076 115
822a1063 116 echo '<center><p><a href="help.php?file=index.html">'. get_string('helpindex') .'</a><p></center>';
ed5ab9f7 117?>
6c8e8b5e 118</body>
822a1063 119</html>