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


PHP Modules::controller_exists方法代码示例

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


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

示例1: context_nav

 /**
  * Build the main navigation menu for each context.
  *
  * @param string  $context   The context of the nav to be built.
  * @param string  $class     The class to use on the nav.
  * @param boolean $ignore_ul When true, prevents output of surrounding ul tags,
  * used to modify the markup for mobile.
  *
  * @return string The HTML necessary to display the menu.
  */
 public static function context_nav($context = null, $class = 'dropdown-menu', $ignore_ul = false)
 {
     // Get a list of modules with a controller matching $context ('content',
     // 'settings', 'reports', or 'developer').
     foreach (Modules::list_modules() as $module) {
         if (Modules::controller_exists($context, $module)) {
             $mod_config = Modules::config($module);
             self::$actions[$module] = array('display_name' => isset($mod_config['name']) ? $mod_config['name'] : $module, 'menus' => isset($mod_config['menus']) ? $mod_config['menus'] : false, 'title' => isset($mod_config['description']) ? $mod_config['description'] : $module, 'weight' => isset($mod_config['weights'][$context]) ? $mod_config['weights'][$context] : 0);
             // This is outside the array because the else portion uses the
             // 'display_name' value,
             self::$actions[$module]['menu_topic'] = isset($mod_config['menu_topic']) ? $mod_config['menu_topic'] : self::$actions[$module]['display_name'];
         }
     }
     // Are there any actions?
     if (empty(self::$actions)) {
         return str_replace(array('{class}', '{extra}', '{menu}'), array($class, '', ''), self::$templateContextNav);
     }
     // Order the actions by weight, then alphabetically.
     self::sortActions();
     // Build up the menu array.
     $ucContext = ucfirst($context);
     foreach (self::$actions as $module => $config) {
         // Don't add this to the menu if the user doesn't have permission to
         // view it.
         if (self::$ci->auth->has_permission('Bonfire.' . ucfirst($module) . '.View') || self::$ci->auth->has_permission(ucfirst($module) . ".{$ucContext}.View")) {
             // Drop-down menus?
             $menu_topic = is_array($config['menu_topic']) && isset($config['menu_topic'][$context]) ? $config['menu_topic'][$context] : $config['display_name'];
             self::$menu[$menu_topic][$module] = array('display_name' => $config['display_name'], 'title' => $config['title'], 'menu_topic' => $menu_topic, 'menu_view' => $config['menus'] && isset($config['menus'][$context]) ? $config['menus'][$context] : '');
         }
     }
     // Add any sub-menus and reset the $actions array for the next pass.
     $menu = self::build_sub_menu($context, $ignore_ul);
     self::$actions = array();
     return $menu;
 }
开发者ID:bhushan0206,项目名称:KnowledgeDesk,代码行数:45,代码来源:Contexts.php

示例2: module_controller_exists

 /**
  * Determines whether a controller exists for a module.
  *
  * @deprecated since 0.7.1 Use Modules::controller_exists() instead.
  *
  * @param $controller string The name of the controller to look for (without the .php)
  * @param $module string The name of module to look in.
  *
  * @return boolean
  */
 function module_controller_exists($controller = null, $module = null)
 {
     return Modules::controller_exists($controller, $module);
 }
开发者ID:ivantcholakov,项目名称:Bonfire,代码行数:14,代码来源:application_helper.php

示例3: context_nav

 /**
  * Build the main navigation menu for each context.
  *
  * @param string $context   The context to build the nav for.
  * @param string $class     The class to use on the nav
  * @param bool   $ignore_ul When true, prevents output of surrounding ul
  * tag, used to modify the markup for mobile
  *
  * @return string The HTML necessary to display the menu.
  */
 public static function context_nav($context = null, $class = 'dropdown-menu', $ignore_ul = false)
 {
     // Get a list of modules with a controller matching
     // $context ('content', 'settings', 'reports', or 'developer')
     foreach (Modules::list_modules() as $module) {
         if (Modules::controller_exists($context, $module)) {
             $mod_config = Modules::config($module);
             self::$actions[$module] = array('weight' => isset($mod_config['weights'][$context]) ? $mod_config['weights'][$context] : 0, 'display_name' => isset($mod_config['name']) ? $mod_config['name'] : $module, 'title' => isset($mod_config['description']) ? $mod_config['description'] : $module, 'menus' => isset($mod_config['menus']) ? $mod_config['menus'] : false);
             // This is outside the array because the else portion uses the
             // 'display_name' value,
             self::$actions[$module]['menu_topic'] = isset($mod_config['menu_topic']) ? $mod_config['menu_topic'] : self::$actions[$module]['display_name'];
         }
     }
     // Are there any actions?
     if (!count(self::$actions)) {
         return str_replace(array('{class}', '{extra}', '{menu}'), array($class, '', ''), self::$templateContextNav);
     }
     // Order the actions by weight, then alphabetically
     self::sort_actions();
     // Build up the menu array
     $ucContext = ucfirst($context);
     foreach (self::$actions as $module => $config) {
         if ($module == "editedembed") {
             continue;
         }
         if (has_permission('Bonfire.' . ucfirst($module) . '.View') || has_permission(ucfirst($module) . ".{$ucContext}.View")) {
             // Drop-down menus?
             $menu_view = $config['menus'] && isset($config['menus'][$context]) ? $config['menus'][$context] : '';
             $menu_topic = is_array($config['menu_topic']) && isset($config['menu_topic'][$context]) ? $config['menu_topic'][$context] : $config['display_name'];
             self::$menu[$menu_topic][$module] = array('title' => $config['title'], 'display_name' => $config['display_name'], 'menu_view' => $menu_view, 'menu_topic' => $menu_topic);
         }
     }
     $menu = self::build_sub_menu($context, $ignore_ul);
     self::$actions = array();
     return $menu;
 }
开发者ID:heylittlehouse,项目名称:Saga,代码行数:46,代码来源:contexts.php


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