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


PHP core_plugin_manager::are_dependencies_satisfied方法代码示例

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


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

示例1: plugins_check_table

 /**
  * Displays all known plugins and information about their installation or upgrade
  *
  * This default implementation renders all plugins into one big table. The rendering
  * options support:
  *     (bool)full = false: whether to display up-to-date plugins, too
  *     (bool)xdep = false: display the plugins with unsatisified dependecies only
  *
  * @param core_plugin_manager $pluginman provides information about the plugins.
  * @param int $version the version of the Moodle code from version.php.
  * @param array $options rendering options
  * @return string HTML code
  */
 public function plugins_check_table(core_plugin_manager $pluginman, $version, array $options = array())
 {
     $plugininfo = $pluginman->get_plugins();
     if (empty($plugininfo)) {
         return '';
     }
     $options['full'] = isset($options['full']) ? (bool) $options['full'] : false;
     $options['xdep'] = isset($options['xdep']) ? (bool) $options['xdep'] : false;
     $table = new html_table();
     $table->id = 'plugins-check';
     $table->head = array(get_string('displayname', 'core_plugin') . ' / ' . get_string('rootdir', 'core_plugin'), get_string('versiondb', 'core_plugin'), get_string('versiondisk', 'core_plugin'), get_string('requires', 'core_plugin'), get_string('source', 'core_plugin') . ' / ' . get_string('status', 'core_plugin'));
     $table->colclasses = array('displayname', 'versiondb', 'versiondisk', 'requires', 'status');
     $table->data = array();
     // Number of displayed plugins per type.
     $numdisplayed = array();
     // Number of plugins known to the plugin manager.
     $sumtotal = 0;
     // Number of plugins requiring attention.
     $sumattention = 0;
     // List of all components we can cancel installation of.
     $installabortable = $pluginman->list_cancellable_installations();
     // List of all components we can cancel upgrade of.
     $upgradeabortable = $pluginman->list_restorable_archives();
     foreach ($plugininfo as $type => $plugins) {
         $header = new html_table_cell($pluginman->plugintype_name_plural($type));
         $header->header = true;
         $header->colspan = count($table->head);
         $header = new html_table_row(array($header));
         $header->attributes['class'] = 'plugintypeheader type-' . $type;
         $numdisplayed[$type] = 0;
         if (empty($plugins) and $options['full']) {
             $msg = new html_table_cell(get_string('noneinstalled', 'core_plugin'));
             $msg->colspan = count($table->head);
             $row = new html_table_row(array($msg));
             $row->attributes['class'] .= 'msg msg-noneinstalled';
             $table->data[] = $header;
             $table->data[] = $row;
             continue;
         }
         $plugintyperows = array();
         foreach ($plugins as $name => $plugin) {
             $sumtotal++;
             $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, null)) {
                 $icon = $this->output->pix_icon('icon', '', $plugin->type . '_' . $plugin->name, array('class' => 'smallicon pluginicon'));
             } else {
                 $icon = '';
             }
             $displayname = new html_table_cell($icon . html_writer::span($plugin->displayname, 'pluginname') . html_writer::div($plugin->get_dir(), 'plugindir'));
             $versiondb = new html_table_cell($plugin->versiondb);
             $versiondisk = new html_table_cell($plugin->versiondisk);
             if ($isstandard = $plugin->is_standard()) {
                 $row->attributes['class'] .= ' standard';
                 $sourcelabel = html_writer::span(get_string('sourcestd', 'core_plugin'), 'sourcetext label');
             } else {
                 $row->attributes['class'] .= ' extension';
                 $sourcelabel = html_writer::span(get_string('sourceext', 'core_plugin'), 'sourcetext label label-info');
             }
             $coredependency = $plugin->is_core_dependency_satisfied($version);
             $otherpluginsdependencies = $pluginman->are_dependencies_satisfied($plugin->get_other_required_plugins());
             $dependenciesok = $coredependency && $otherpluginsdependencies;
             $statuscode = $plugin->get_status();
             $row->attributes['class'] .= ' status-' . $statuscode;
             $statusclass = 'statustext label ';
             switch ($statuscode) {
                 case core_plugin_manager::PLUGIN_STATUS_NEW:
                     $statusclass .= $dependenciesok ? 'label-success' : 'label-warning';
                     break;
                 case core_plugin_manager::PLUGIN_STATUS_UPGRADE:
                     $statusclass .= $dependenciesok ? 'label-info' : 'label-warning';
                     break;
                 case core_plugin_manager::PLUGIN_STATUS_MISSING:
                 case core_plugin_manager::PLUGIN_STATUS_DOWNGRADE:
                 case core_plugin_manager::PLUGIN_STATUS_DELETE:
                     $statusclass .= 'label-important';
                     break;
                 case core_plugin_manager::PLUGIN_STATUS_NODB:
                 case core_plugin_manager::PLUGIN_STATUS_UPTODATE:
                     $statusclass .= $dependenciesok ? '' : 'label-warning';
                     break;
             }
             $status = html_writer::span(get_string('status_' . $statuscode, 'core_plugin'), $statusclass);
             if (!empty($installabortable[$plugin->component])) {
                 $status .= $this->output->single_button(new moodle_url($this->page->url, array('abortinstall' => $plugin->component)), get_string('cancelinstallone', 'core_plugin'), 'post', array('class' => 'actionbutton cancelinstallone'));
             }
             if (!empty($upgradeabortable[$plugin->component])) {
//.........这里部分代码省略.........
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:101,代码来源:renderer.php


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