/** * 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; }
public function is_enabled() { global $CFG; if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict') { return false; } else { return parent::is_enabled(); } }
public function get_uninstall_url() { if ($this->name !== get_config('moodlecourse', 'format') && $this->name !== 'site') { return new moodle_url('/admin/courseformats.php', array('sesskey' => sesskey(), 'action' => 'uninstall', 'format' => $this->name)); } return parent::get_uninstall_url(); }
/** * Formats the information that needs to go in the 'Requires' column. * @param plugininfo_base $plugin the plugin we are rendering the row for. * @param plugin_manager $pluginman provides data on all the plugins. * @param string $version * @return string HTML code */ protected function required_column(plugininfo_base $plugin, plugin_manager $pluginman, $version) { $requires = array(); if (!empty($plugin->versionrequires)) { if ($plugin->versionrequires <= $version) { $class = 'requires-ok'; } else { $class = 'requires-failed'; } $requires[] = html_writer::tag('li', get_string('moodleversion', 'core_plugin', $plugin->versionrequires), array('class' => $class)); } foreach ($plugin->get_other_required_plugins() as $component => $requiredversion) { $ok = true; $otherplugin = $pluginman->get_plugin_info($component); if (is_null($otherplugin)) { $ok = false; } else { if ($requiredversion != ANY_VERSION and $otherplugin->versiondisk < $requiredversion) { $ok = false; } } if ($ok) { $class = 'requires-ok'; } else { $class = 'requires-failed'; } if ($requiredversion != ANY_VERSION) { $str = 'otherpluginversion'; } else { $str = 'otherplugin'; } $requires[] = html_writer::tag('li', get_string($str, 'core_plugin', array('component' => $component, 'version' => $requiredversion)), array('class' => $class)); } if (!$requires) { return ''; } return html_writer::tag('ul', implode("\n", $requires)); }
/** * Formats the information that needs to go in the 'Requires' column. * @param plugininfo_base $plugin the plugin we are rendering the row for. * @param plugin_manager $pluginman provides data on all the plugins. * @param string $version * @return string HTML code */ protected function required_column(plugininfo_base $plugin, plugin_manager $pluginman, $version) { $requires = array(); if (!empty($plugin->versionrequires)) { $required = get_string('moodleversion', 'core_plugin', $plugin->versionrequires); if ($plugin->versionrequires > $version) { $required = label::important($required); } $requires[] = html::li($required); } foreach ($plugin->get_other_required_plugins() as $component => $requiredversion) { $ok = true; $otherplugin = $pluginman->get_plugin_info($component); if (is_null($otherplugin)) { $ok = false; } else { if ($requiredversion != ANY_VERSION and $otherplugin->versiondisk < $requiredversion) { $ok = false; } } if ($requiredversion != ANY_VERSION) { $required = get_string('otherpluginversion', 'core_plugin', array('component' => $component, 'version' => $requiredversion)); } else { $required = get_string('otherplugin', 'core_plugin', array('component' => $component, 'version' => $requiredversion)); } if (!$ok) { $required = label::important($required); } $requires[] = html::li($required); } if (!$requires) { return ''; } return html::ul('unstyled', $requires); }