本文整理汇总了PHP中core_plugin_manager::missing_dependencies方法的典型用法代码示例。如果您正苦于以下问题:PHP core_plugin_manager::missing_dependencies方法的具体用法?PHP core_plugin_manager::missing_dependencies怎么用?PHP core_plugin_manager::missing_dependencies使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core_plugin_manager
的用法示例。
在下文中一共展示了core_plugin_manager::missing_dependencies方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: missing_dependencies
/**
* Displays the information about missing dependencies
*
* @param core_plugin_manager $pluginman
* @return string
*/
protected function missing_dependencies(core_plugin_manager $pluginman)
{
$dependencies = $pluginman->missing_dependencies();
if (empty($dependencies)) {
return '';
}
$available = array();
$unavailable = array();
$unknown = array();
foreach ($dependencies as $component => $remoteinfo) {
if ($remoteinfo === false) {
// The required version is not available. Let us check if there
// is at least some version in the plugins directory.
$remoteinfoanyversion = $pluginman->get_remote_plugin_info($component, ANY_VERSION, false);
if ($remoteinfoanyversion === false) {
$unknown[$component] = $component;
} else {
$unavailable[$component] = $remoteinfoanyversion;
}
} else {
$available[$component] = $remoteinfo;
}
}
$out = $this->output->container_start('plugins-check-dependencies');
if ($unavailable or $unknown) {
$out .= $this->output->heading(get_string('misdepsunavail', 'core_plugin'));
if ($unknown) {
$out .= $this->output->notification(get_string('misdepsunknownlist', 'core_plugin', implode($unknown, ', ')));
}
if ($unavailable) {
$unavailablelist = array();
foreach ($unavailable as $component => $remoteinfoanyversion) {
$unavailablelistitem = html_writer::link('https://moodle.org/plugins/view.php?plugin=' . $component, '<strong>' . $remoteinfoanyversion->name . '</strong>');
if ($remoteinfoanyversion->version) {
$unavailablelistitem .= ' (' . $component . ' > ' . $remoteinfoanyversion->version->version . ')';
} else {
$unavailablelistitem .= ' (' . $component . ')';
}
$unavailablelist[] = $unavailablelistitem;
}
$out .= $this->output->notification(get_string('misdepsunavaillist', 'core_plugin', implode($unavailablelist, ', ')));
}
$out .= $this->output->container_start('plugins-check-dependencies-actions');
$out .= ' ' . html_writer::link(new moodle_url('/admin/tool/installaddon/'), get_string('dependencyuploadmissing', 'core_plugin'));
$out .= $this->output->container_end();
// End of .plugins-check-dependencies-actions container.
}
if ($available) {
$out .= $this->output->heading(get_string('misdepsavail', 'core_plugin'));
$out .= $this->output->container_start('plugins-check-dependencies-actions');
$installable = $pluginman->filter_installable($available);
if ($installable) {
$out .= $this->output->single_button(new moodle_url($this->page->url, array('installdepx' => 1)), get_string('dependencyinstallmissing', 'core_plugin', count($installable)), 'post', array('class' => 'singlebutton dependencyinstallmissing'));
}
$out .= html_writer::div(html_writer::link(new moodle_url('/admin/tool/installaddon/'), get_string('dependencyuploadmissing', 'core_plugin')), 'dependencyuploadmissing');
$out .= $this->output->container_end();
// End of .plugins-check-dependencies-actions container.
$out .= $this->available_missing_dependencies_list($pluginman, $available);
}
$out .= $this->output->container_end();
// End of .plugins-check-dependencies container.
return $out;
}