Example #1
0
    /**
     * This function adds plugin pages to the navigation menu
     *
     * @static
     * @param string $subtype - The type of plugin (submission or feedback)
     * @param part_of_admin_tree $admin - The handle to the admin menu
     * @param admin_settingpage $settings - The handle to current node in the navigation tree
     * @param stdClass|plugininfo_mod $module - The handle to the current module
     * @return None
     */
    static function add_admin_assign_plugin_settings($subtype, part_of_admin_tree $admin, admin_settingpage $settings, $module) {
        global $CFG;

        $plugins = get_plugin_list_with_file($subtype, 'settings.php', false);
        $pluginsbyname = array();
        foreach ($plugins as $plugin => $plugindir) {
            $pluginname = get_string('pluginname', $subtype . '_'.$plugin);
            $pluginsbyname[$pluginname] = $plugin;
        }
        ksort($pluginsbyname);

        foreach ($pluginsbyname as $pluginname => $plugin) {
            $settings = new admin_settingpage($subtype . '_'.$plugin,
                    $pluginname, 'moodle/site:config', $module->is_enabled() === false);
            if ($admin->fulltree) {
                $shortsubtype = substr($subtype, strlen('assign'));
                include($CFG->dirroot . "/mod/assign/$shortsubtype/$plugin/settings.php");
            }

            $admin->add($subtype . 'plugins', $settings);
        }

    }