当前位置: 首页>>代码示例>>PHP>>正文


PHP core_plugin_manager::resolve_requirements方法代码示例

本文整理汇总了PHP中core_plugin_manager::resolve_requirements方法的典型用法代码示例。如果您正苦于以下问题:PHP core_plugin_manager::resolve_requirements方法的具体用法?PHP core_plugin_manager::resolve_requirements怎么用?PHP core_plugin_manager::resolve_requirements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core_plugin_manager的用法示例。


在下文中一共展示了core_plugin_manager::resolve_requirements方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: required_column

 /**
  * Formats the information that needs to go in the 'Requires' column.
  * @param \core\plugininfo\base $plugin the plugin we are rendering the row for.
  * @param core_plugin_manager $pluginman provides data on all the plugins.
  * @param string $version
  * @return string HTML code
  */
 protected function required_column(\core\plugininfo\base $plugin, core_plugin_manager $pluginman, $version)
 {
     $requires = array();
     $displayuploadlink = false;
     $displayupdateslink = false;
     foreach ($pluginman->resolve_requirements($plugin, $version) as $reqname => $reqinfo) {
         if ($reqname === 'core') {
             if ($reqinfo->status == $pluginman::REQUIREMENT_STATUS_OK) {
                 $class = 'requires-ok';
                 $label = '';
             } else {
                 $class = 'requires-failed';
                 $label = html_writer::span(get_string('dependencyfails', 'core_plugin'), 'label label-important');
             }
             $requires[] = html_writer::tag('li', html_writer::span(get_string('moodleversion', 'core_plugin', $plugin->versionrequires), 'dep dep-core') . ' ' . $label, array('class' => $class));
         } else {
             $actions = array();
             if ($reqinfo->status == $pluginman::REQUIREMENT_STATUS_OK) {
                 $label = '';
                 $class = 'requires-ok';
             } else {
                 if ($reqinfo->status == $pluginman::REQUIREMENT_STATUS_MISSING) {
                     if ($reqinfo->availability == $pluginman::REQUIREMENT_AVAILABLE) {
                         $label = html_writer::span(get_string('dependencymissing', 'core_plugin'), 'label label-warning');
                         $label .= ' ' . html_writer::span(get_string('dependencyavailable', 'core_plugin'), 'label label-warning');
                         $class = 'requires-failed requires-missing requires-available';
                         $actions[] = html_writer::link(new moodle_url('https://moodle.org/plugins/view.php', array('plugin' => $reqname)), get_string('misdepinfoplugin', 'core_plugin'));
                     } else {
                         $label = html_writer::span(get_string('dependencymissing', 'core_plugin'), 'label label-important');
                         $label .= ' ' . html_writer::span(get_string('dependencyunavailable', 'core_plugin'), 'label label-important');
                         $class = 'requires-failed requires-missing requires-unavailable';
                     }
                     $displayuploadlink = true;
                 } else {
                     if ($reqinfo->status == $pluginman::REQUIREMENT_STATUS_OUTDATED) {
                         if ($reqinfo->availability == $pluginman::REQUIREMENT_AVAILABLE) {
                             $label = html_writer::span(get_string('dependencyfails', 'core_plugin'), 'label label-warning');
                             $label .= ' ' . html_writer::span(get_string('dependencyavailable', 'core_plugin'), 'label label-warning');
                             $class = 'requires-failed requires-outdated requires-available';
                             $displayupdateslink = true;
                         } else {
                             $label = html_writer::span(get_string('dependencyfails', 'core_plugin'), 'label label-important');
                             $label .= ' ' . html_writer::span(get_string('dependencyunavailable', 'core_plugin'), 'label label-important');
                             $class = 'requires-failed requires-outdated requires-unavailable';
                         }
                         $displayuploadlink = true;
                     }
                 }
             }
             if ($reqinfo->reqver != ANY_VERSION) {
                 $str = 'otherpluginversion';
             } else {
                 $str = 'otherplugin';
             }
             $requires[] = html_writer::tag('li', html_writer::span(get_string($str, 'core_plugin', array('component' => $reqname, 'version' => $reqinfo->reqver)), 'dep dep-plugin') . ' ' . $label . ' ' . html_writer::span(implode(' | ', $actions), 'actions'), array('class' => $class));
         }
     }
     if (!$requires) {
         return '';
     }
     $out = html_writer::tag('ul', implode("\n", $requires));
     if ($displayuploadlink) {
         $out .= html_writer::div(html_writer::link(new moodle_url('/admin/tool/installaddon/'), get_string('dependencyuploadmissing', 'core_plugin')), 'dependencyuploadmissing');
     }
     if ($displayupdateslink) {
         $out .= html_writer::div(html_writer::link(new moodle_url($this->page->url, array('sesskey' => sesskey(), 'fetchupdates' => 1)), get_string('checkforupdates', 'core_plugin')), 'checkforupdates');
     }
     return $out;
 }
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:76,代码来源:renderer.php


注:本文中的core_plugin_manager::resolve_requirements方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。