本文整理汇总了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;
}
示例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);
}
示例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;
}