本文整理汇总了PHP中plugin_manager::get_plugin_info方法的典型用法代码示例。如果您正苦于以下问题:PHP plugin_manager::get_plugin_info方法的具体用法?PHP plugin_manager::get_plugin_info怎么用?PHP plugin_manager::get_plugin_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plugin_manager
的用法示例。
在下文中一共展示了plugin_manager::get_plugin_info方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: required_column
/**
* 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);
}
示例2: required_column
/**
* 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));
}
示例3: display_indicator_list
/**
* Renders indicator manager
*
* @return string HTML
*/
public function display_indicator_list(plugin_manager $pluginman, $instances)
{
if (empty($instances)) {
return '';
}
$table = new html_table();
$table->id = 'plugins-control-panel';
$table->attributes['class'] = 'generaltable generalbox boxaligncenter boxwidthwide';
$table->head = array(get_string('displayname', 'core_plugin'), get_string('source', 'core_plugin'), get_string('version', 'core_plugin'), get_string('availability', 'core_plugin'), get_string('settings', 'core_plugin'));
$table->colclasses = array('displayname', 'source', 'version', 'availability', 'settings');
foreach ($instances as $name => $path) {
$plugin = $pluginman->get_plugin_info('engagementindicator_' . $name);
$row = new html_table_row();
$row->attributes['class'] = 'type-' . $plugin->type . ' name-' . $plugin->type . '_' . $plugin->name;
if ($this->page->theme->resolve_image_location('icon', $plugin->type . '_' . $plugin->name)) {
$icon = $this->output->pix_icon('icon', '', $plugin->type . '_' . $plugin->name, array('class' => 'smallicon pluginicon'));
} else {
$icon = $this->output->pix_icon('spacer', '', 'moodle', array('class' => 'smallicon pluginicon noicon'));
}
if ($plugin->get_status() === plugin_manager::PLUGIN_STATUS_MISSING) {
$msg = html_writer::tag('span', get_string('status_missing', 'core_plugin'), array('class' => 'notifyproblem'));
$row->attributes['class'] .= ' missingfromdisk';
} else {
$msg = '';
}
$displayname = $icon . ' ' . $plugin->displayname . ' ' . $msg;
$displayname = new html_table_cell($displayname);
if (coursereport_engagement_is_core_indicator($name)) {
$row->attributes['class'] .= ' standard';
$source = new html_table_cell(get_string('sourcestd', 'core_plugin'));
} else {
$row->attributes['class'] .= ' extension';
$source = new html_table_cell(get_string('sourceext', 'core_plugin'));
}
$version = new html_table_cell($plugin->versiondb);
$isenabled = $plugin->is_enabled();
if (is_null($isenabled)) {
$availability = new html_table_cell('');
} else {
if ($isenabled) {
$row->attributes['class'] .= ' enabled';
$icon = $this->output->pix_icon('i/hide', get_string('pluginenabled', 'core_plugin'));
$availability = new html_table_cell($icon . ' ' . get_string('pluginenabled', 'core_plugin'));
} else {
$row->attributes['class'] .= ' disabled';
$icon = $this->output->pix_icon('i/show', get_string('plugindisabled', 'core_plugin'));
$availability = new html_table_cell($icon . ' ' . get_string('plugindisabled', 'core_plugin'));
}
}
$settingsurl = $plugin->get_settings_url();
if (is_null($settingsurl)) {
$settings = new html_table_cell('');
} else {
$settings = html_writer::link($settingsurl, get_string('settings', 'core_plugin'));
$settings = new html_table_cell($settings);
}
$row->cells = array($displayname, $source, $version, $availability, $settings);
$table->data[] = $row;
}
return html_writer::table($table);
}