コード例 #1
0
 /**
  * Gathers and returns the information about all plugins of the given type
  *
  * @param string $type the name of the plugintype, eg. mod, auth or workshopform
  * @param string $typerootdir full path to the location of the plugin dir
  * @param string $typeclass the name of the actually called class
  * @return array of plugintype classes, indexed by the plugin name
  */
 public static function get_plugins($type, $typerootdir, $typeclass)
 {
     global $CFG;
     $formats = parent::get_plugins($type, $typerootdir, $typeclass);
     require_once $CFG->dirroot . '/course/lib.php';
     $order = get_sorted_course_formats();
     $sortedformats = array();
     foreach ($order as $formatname) {
         $sortedformats[$formatname] = $formats[$formatname];
     }
     return $sortedformats;
 }
コード例 #2
0
ファイル: pluginlib.php プロジェクト: nutanrajmalanai/moodle
    public static function get_plugins($type, $typerootdir, $typeclass) {

        // get the information about plugins at the disk
        $modules = parent::get_plugins($type, $typerootdir, $typeclass);

        // add modules missing from disk
        $modulesinfo = self::get_modules_info();
        foreach ($modulesinfo as $modulename => $moduleinfo) {
            if (isset($modules[$modulename])) {
                continue;
            }
            $plugin                 = new $typeclass();
            $plugin->type           = $type;
            $plugin->typerootdir    = $typerootdir;
            $plugin->name           = $modulename;
            $plugin->rootdir        = null;
            $plugin->displayname    = $modulename;
            $plugin->versiondb      = $moduleinfo->version;
            $plugin->init_is_standard();

            $modules[$modulename]   = $plugin;
        }

        return $modules;
    }