本文整理汇总了PHP中core_plugin_manager::available_updates方法的典型用法代码示例。如果您正苦于以下问题:PHP core_plugin_manager::available_updates方法的具体用法?PHP core_plugin_manager::available_updates怎么用?PHP core_plugin_manager::available_updates使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core_plugin_manager
的用法示例。
在下文中一共展示了core_plugin_manager::available_updates方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plugins_overview_panel
/**
* Prints an overview about the plugins - number of installed, number of extensions etc.
*
* @param core_plugin_manager $pluginman provides information about the plugins
* @param array $options filtering options
* @return string as usually
*/
public function plugins_overview_panel(core_plugin_manager $pluginman, array $options = array())
{
$plugininfo = $pluginman->get_plugins();
$numtotal = $numextension = $numupdatable = 0;
foreach ($plugininfo as $type => $plugins) {
foreach ($plugins as $name => $plugin) {
if ($plugin->available_updates()) {
$numupdatable++;
}
if ($plugin->get_status() === core_plugin_manager::PLUGIN_STATUS_MISSING) {
continue;
}
$numtotal++;
if (!$plugin->is_standard()) {
$numextension++;
}
}
}
$infoall = html_writer::link(new moodle_url($this->page->url, array('contribonly' => 0, 'updatesonly' => 0)), get_string('overviewall', 'core_plugin'), array('title' => get_string('filterall', 'core_plugin'))) . ' ' . html_writer::span($numtotal, 'badge number number-all');
$infoext = html_writer::link(new moodle_url($this->page->url, array('contribonly' => 1, 'updatesonly' => 0)), get_string('overviewext', 'core_plugin'), array('title' => get_string('filtercontribonly', 'core_plugin'))) . ' ' . html_writer::span($numextension, 'badge number number-additional');
if ($numupdatable) {
$infoupdatable = html_writer::link(new moodle_url($this->page->url, array('contribonly' => 0, 'updatesonly' => 1)), get_string('overviewupdatable', 'core_plugin'), array('title' => get_string('filterupdatesonly', 'core_plugin'))) . ' ' . html_writer::span($numupdatable, 'badge badge-info number number-updatable');
} else {
// No updates, or the notifications disabled.
$infoupdatable = '';
}
$out = html_writer::start_div('', array('id' => 'plugins-overview-panel'));
if (!empty($options['updatesonly'])) {
$out .= $this->output->heading(get_string('overviewupdatable', 'core_plugin'), 3);
} else {
if (!empty($options['contribonly'])) {
$out .= $this->output->heading(get_string('overviewext', 'core_plugin'), 3);
}
}
if ($numupdatable) {
$installableupdates = $pluginman->filter_installable($pluginman->available_updates());
if ($installableupdates) {
$out .= $this->output->single_button(new moodle_url($this->page->url, array('installupdatex' => 1)), get_string('updateavailableinstallall', 'core_admin', count($installableupdates)), 'post', array('class' => 'singlebutton updateavailableinstallall'));
}
}
$out .= html_writer::div($infoall, 'info info-all') . html_writer::div($infoext, 'info info-ext') . html_writer::div($infoupdatable, 'info info-updatable');
$out .= html_writer::end_div();
// End of #plugins-overview-panel block.
return $out;
}