]> git.mjollnir.org Git - moodle.git/commitdiff
New version of help.php that automatically constructs the index.html
authormoodler <moodler>
Thu, 24 Jul 2003 12:56:17 +0000 (12:56 +0000)
committermoodler <moodler>
Thu, 24 Jul 2003 12:56:17 +0000 (12:56 +0000)
and mods.html files.

Direct from Mad Alex

help.php

index 49e626b3564922960f55f57b7115e5bb8ae70444..67643602afcdf2113111924387ca3fb79d85a299 100644 (file)
--- 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;
             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;
             }
         }