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


PHP core_component::get_subplugins方法代碼示例

本文整理匯總了PHP中core_component::get_subplugins方法的典型用法代碼示例。如果您正苦於以下問題:PHP core_component::get_subplugins方法的具體用法?PHP core_component::get_subplugins怎麽用?PHP core_component::get_subplugins使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在core_component的用法示例。


在下文中一共展示了core_component::get_subplugins方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: reorder_plugin_types

 /**
  * Reorders plugin types into a sequence to be displayed
  *
  * For technical reasons, plugin types returned by {@link core_component::get_plugin_types()} are
  * in a certain order that does not need to fit the expected order for the display.
  * Particularly, activity modules should be displayed first as they represent the
  * real heart of Moodle. They should be followed by other plugin types that are
  * used to build the courses (as that is what one expects from LMS). After that,
  * other supportive plugin types follow.
  *
  * @param array $types associative array
  * @return array same array with altered order of items
  */
 protected function reorder_plugin_types(array $types)
 {
     $fix = array('mod' => $types['mod']);
     foreach (core_component::get_plugin_list('mod') as $plugin => $fulldir) {
         if (!($subtypes = core_component::get_subplugins('mod_' . $plugin))) {
             continue;
         }
         foreach ($subtypes as $subtype => $ignored) {
             $fix[$subtype] = $types[$subtype];
         }
     }
     $fix['mod'] = $types['mod'];
     $fix['block'] = $types['block'];
     $fix['qtype'] = $types['qtype'];
     $fix['qbehaviour'] = $types['qbehaviour'];
     $fix['qformat'] = $types['qformat'];
     $fix['filter'] = $types['filter'];
     $fix['editor'] = $types['editor'];
     foreach (core_component::get_plugin_list('editor') as $plugin => $fulldir) {
         if (!($subtypes = core_component::get_subplugins('editor_' . $plugin))) {
             continue;
         }
         foreach ($subtypes as $subtype => $ignored) {
             $fix[$subtype] = $types[$subtype];
         }
     }
     $fix['enrol'] = $types['enrol'];
     $fix['auth'] = $types['auth'];
     $fix['tool'] = $types['tool'];
     foreach (core_component::get_plugin_list('tool') as $plugin => $fulldir) {
         if (!($subtypes = core_component::get_subplugins('tool_' . $plugin))) {
             continue;
         }
         foreach ($subtypes as $subtype => $ignored) {
             $fix[$subtype] = $types[$subtype];
         }
     }
     foreach ($types as $type => $path) {
         if (!isset($fix[$type])) {
             $fix[$type] = $path;
         }
     }
     return $fix;
 }
開發者ID:bewanyk,項目名稱:moodle,代碼行數:57,代碼來源:plugin_manager.php

示例2: test_get_subplugins

 public function test_get_subplugins()
 {
     global $CFG;
     // Any plugin with more subtypes is ok here.
     $this->assertFileExists("{$CFG->dirroot}/mod/assign/db/subplugins.php");
     $subplugins = core_component::get_subplugins('mod_assign');
     $this->assertSame(array('assignsubmission', 'assignfeedback'), array_keys($subplugins));
     $subs = core_component::get_plugin_list('assignsubmission');
     $feeds = core_component::get_plugin_list('assignfeedback');
     $this->assertSame(array_keys($subs), $subplugins['assignsubmission']);
     $this->assertSame(array_keys($feeds), $subplugins['assignfeedback']);
     // Any plugin without subtypes is ok here.
     $this->assertFileExists("{$CFG->dirroot}/mod/choice");
     $this->assertFileNotExists("{$CFG->dirroot}/mod/choice/db/subplugins.php");
     $this->assertNull(core_component::get_subplugins('mod_choice'));
     $this->assertNull(core_component::get_subplugins('xxxx_yyyy'));
 }
開發者ID:alexandru-elisei,項目名稱:moodle,代碼行數:17,代碼來源:component_test.php


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