New version of help.php that automatically constructs the index.html

and mods.html files.

Direct from Mad Alex
This commit is contained in:
moodler 2003-07-24 12:56:17 +00:00
parent 4e29914577
commit 1517c0aa4d

View file

@ -17,9 +17,9 @@
} }
$helpfound = false; $helpfound = false;
$langs = array(current_language(), get_string("parentlanguage"), "en"); // Fallback
if (!empty($file)) { if (!empty($file)) {
$langs = array(current_language(), get_string("parentlanguage"), "en"); // Fallback
foreach ($langs as $lang) { foreach ($langs as $lang) {
if (empty($lang)) { if (empty($lang)) {
continue; continue;
@ -33,6 +33,34 @@
if (file_exists("$filepath")) { if (file_exists("$filepath")) {
$helpfound = true; $helpfound = true;
include("$filepath"); // The actual helpfile include("$filepath"); // The actual helpfile
if ($module == "moodle" && ($file == "index.html" || $file == "mods.html")) {
// include file for each module
if (!$modules = get_records("modules")) {
error("No modules found!!"); // Should never happen
}
foreach ($modules as $mod) {
$strmodulename = get_string("modulename", "$mod->name");
$modulebyname[$strmodulename] = $mod;
}
ksort($modulebyname);
foreach ($modulebyname as $mod) {
foreach ($langs as $lang) {
if (empty($lang)) {
continue;
}
$filepath = "$CFG->dirroot/lang/$lang/help/$mod->name/$file";
if (file_exists("$filepath")) {
include("$filepath"); // The actual helpfile
break;
}
}
}
}
break; break;
} }
} }