示例#1
0
            }
        }
    }
    // Work through the possible languages, starting with the most specific.
    while (!$helpfound && (list(, $lang) = each($langs)) && !empty($lang)) {
        while (!$helpfound && (list($locationprefix, $locationsuffix) = each($locations))) {
            $filepath = $locationprefix . $lang . '/help/' . $locationsuffix;
            // Now, try to include the help text from this file, if we can.
            if (file_exists_and_readable($filepath)) {
                $helpfound = true;
                @(include $filepath);
                // The actual helpfile
                // Now, we process some special cases.
                $helpdir = $locationprefix . $lang . '/help';
                if ($module == 'moodle' and ($file == 'index.html' or $file == 'mods.html')) {
                    include_help_for_each_module($file, $langs, $helpdir);
                }
                // The remaining horrible hardcoded special cases should be delegated to modules somehow.
                if ($module == 'moodle' and $file == 'resource/types.html') {
                    // RESOURCES
                    include_help_for_each_resource($file, $langs, $helpdir);
                }
                if ($module == 'moodle' and $file == 'assignment/types.html') {
                    // ASSIGNMENTS
                    include_help_for_each_assignment_type();
                }
            }
        }
        reset($locations);
    }
} else {
示例#2
0
// We look for the help to display in lots of different places, and
// only display an error at the end if we can't find the help file
// anywhere. This variable tracks that.
$helpfound = false;
// Buffer output so that we can examine it later to extract metadata (page title)
ob_start();
if (!empty($file)) {
    // The help to display is from a help file.
    list($filepath, $foundlang) = string_manager::instance()->find_help_file($file, $module, $forcelang, $skiplocal);
    if ($filepath) {
        $helpfound = true;
        @(include $filepath);
        // The actual helpfile
        // Now, we process some special cases.
        if ($module == 'moodle' and ($file == 'index.html' or $file == 'mods.html')) {
            include_help_for_each_module($file, $forcelang, $skiplocal);
        }
        if ($module == 'question' && $file == 'types.html') {
            include_help_for_each_qtype();
        }
        // The remaining horrible hardcoded special cases should be delegated to modules somehow.
        if ($module == 'moodle' && $file == 'resource/types.html') {
            // RESOURCES
            include_help_for_each_resource($forcelang, $skiplocal);
        }
        if ($module == 'moodle' && $file == 'assignment/types.html') {
            // ASSIGNMENTS
            include_help_for_each_assignment_type($forcelang, $skiplocal);
        }
    }
} else {