當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。