當前位置: 首頁>>代碼示例>>PHP>>正文


PHP core_plugin_manager::missing_dependencies方法代碼示例

本文整理匯總了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 . ' &gt; ' . $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;
 }
開發者ID:jeffthestampede,項目名稱:excelsior,代碼行數:69,代碼來源:renderer.php


注:本文中的core_plugin_manager::missing_dependencies方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。