mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
New version of help.php that automatically constructs the index.html
and mods.html files. Direct from Mad Alex
This commit is contained in:
parent
4e29914577
commit
1517c0aa4d
1 changed files with 30 additions and 2 deletions
32
help.php
32
help.php
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue