From: moodler Date: Thu, 24 Jul 2003 12:56:17 +0000 (+0000) Subject: New version of help.php that automatically constructs the index.html X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=1517c0aa4d1e9cf2646b1cb394a896b8d1ba2899;p=moodle.git New version of help.php that automatically constructs the index.html and mods.html files. Direct from Mad Alex --- diff --git a/help.php b/help.php index 49e626b356..67643602af 100644 --- a/help.php +++ b/help.php @@ -17,9 +17,9 @@ } $helpfound = false; - + $langs = array(current_language(), get_string("parentlanguage"), "en"); // Fallback + if (!empty($file)) { - $langs = array(current_language(), get_string("parentlanguage"), "en"); // Fallback foreach ($langs as $lang) { if (empty($lang)) { continue; @@ -33,6 +33,34 @@ if (file_exists("$filepath")) { $helpfound = true; 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; } }