本文整理汇总了PHP中core_plugin_manager::resolve_plugininfo_class方法的典型用法代码示例。如果您正苦于以下问题:PHP core_plugin_manager::resolve_plugininfo_class方法的具体用法?PHP core_plugin_manager::resolve_plugininfo_class怎么用?PHP core_plugin_manager::resolve_plugininfo_class使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core_plugin_manager
的用法示例。
在下文中一共展示了core_plugin_manager::resolve_plugininfo_class方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plugins_control_panel
/**
* Displays all known plugins and links to manage them
*
* This default implementation renders all plugins into one big table.
*
* @param core_plugin_manager $pluginman provides information about the plugins.
* @param array $options filtering options
* @return string HTML code
*/
public function plugins_control_panel(core_plugin_manager $pluginman, array $options = array())
{
$plugininfo = $pluginman->get_plugins();
// Filter the list of plugins according the options.
if (!empty($options['updatesonly'])) {
$updateable = array();
foreach ($plugininfo as $plugintype => $pluginnames) {
foreach ($pluginnames as $pluginname => $pluginfo) {
$pluginavailableupdates = $pluginfo->available_updates();
if (!empty($pluginavailableupdates)) {
foreach ($pluginavailableupdates as $pluginavailableupdate) {
$updateable[$plugintype][$pluginname] = $pluginfo;
}
}
}
}
$plugininfo = $updateable;
}
if (!empty($options['contribonly'])) {
$contribs = array();
foreach ($plugininfo as $plugintype => $pluginnames) {
foreach ($pluginnames as $pluginname => $pluginfo) {
if (!$pluginfo->is_standard()) {
$contribs[$plugintype][$pluginname] = $pluginfo;
}
}
}
$plugininfo = $contribs;
}
if (empty($plugininfo)) {
return '';
}
$table = new html_table();
$table->id = 'plugins-control-panel';
$table->head = array(get_string('displayname', 'core_plugin'), get_string('version', 'core_plugin'), get_string('availability', 'core_plugin'), get_string('actions', 'core_plugin'), get_string('notes', 'core_plugin'));
$table->headspan = array(1, 1, 1, 2, 1);
$table->colclasses = array('pluginname', 'version', 'availability', 'settings', 'uninstall', 'notes');
foreach ($plugininfo as $type => $plugins) {
$heading = $pluginman->plugintype_name_plural($type);
$pluginclass = core_plugin_manager::resolve_plugininfo_class($type);
if ($manageurl = $pluginclass::get_manage_url()) {
$heading .= $this->output->action_icon($manageurl, new pix_icon('i/settings', get_string('settings', 'core_plugin')));
}
$header = new html_table_cell(html_writer::tag('span', $heading, array('id' => 'plugin_type_cell_' . $type)));
$header->header = true;
$header->colspan = array_sum($table->headspan);
$header = new html_table_row(array($header));
$header->attributes['class'] = 'plugintypeheader type-' . $type;
$table->data[] = $header;
if (empty($plugins)) {
$msg = new html_table_cell(get_string('noneinstalled', 'core_plugin'));
$msg->colspan = array_sum($table->headspan);
$row = new html_table_row(array($msg));
$row->attributes['class'] .= 'msg msg-noneinstalled';
$table->data[] = $row;
continue;
}
foreach ($plugins as $name => $plugin) {
$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' => 'icon pluginicon'));
} else {
$icon = $this->output->pix_icon('spacer', '', 'moodle', array('class' => 'icon pluginicon noicon'));
}
$status = $plugin->get_status();
$row->attributes['class'] .= ' status-' . $status;
$pluginname = html_writer::tag('div', $icon . $plugin->displayname, array('class' => 'displayname')) . html_writer::tag('div', $plugin->component, array('class' => 'componentname'));
$pluginname = new html_table_cell($pluginname);
$version = html_writer::div($plugin->versiondb, 'versionnumber');
if ((string) $plugin->release !== '') {
$version = html_writer::div($plugin->release, 'release') . $version;
}
$version = new html_table_cell($version);
$isenabled = $plugin->is_enabled();
if (is_null($isenabled)) {
$availability = new html_table_cell('');
} else {
if ($isenabled) {
$row->attributes['class'] .= ' enabled';
$availability = new html_table_cell(get_string('pluginenabled', 'core_plugin'));
} else {
$row->attributes['class'] .= ' disabled';
$availability = new html_table_cell(get_string('plugindisabled', 'core_plugin'));
}
}
$settingsurl = $plugin->get_settings_url();
if (!is_null($settingsurl)) {
$settings = html_writer::link($settingsurl, get_string('settings', 'core_plugin'), array('class' => 'settings'));
} else {
$settings = '';
//.........这里部分代码省略.........