本文整理汇总了PHP中CRM_Utils_Hook::navigationMenu方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_Hook::navigationMenu方法的具体用法?PHP CRM_Utils_Hook::navigationMenu怎么用?PHP CRM_Utils_Hook::navigationMenu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_Hook
的用法示例。
在下文中一共展示了CRM_Utils_Hook::navigationMenu方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildNavigation
/**
* Function to build menu
*
* @param boolean $json by default output is html
* @param boolean $navigationMenu true when called for building top navigation menu
*
* @return returns html or json object
* @static
*/
static function buildNavigation($json = FALSE, $navigationMenu = TRUE)
{
$navigations = array();
self::buildNavigationTree($navigations, $parent = NULL, $navigationMenu);
$navigationString = NULL;
// run the Navigation through a hook so users can modify it
CRM_Utils_Hook::navigationMenu($navigations);
$i18n = CRM_Core_I18n::singleton();
//skip children menu item if user don't have access to parent menu item
$skipMenuItems = array();
foreach ($navigations as $key => $value) {
if ($json) {
if ($navigationString) {
$navigationString .= '},';
}
$data = $value['attributes']['label'];
$class = '';
if (!$value['attributes']['active']) {
$class = ', "attr": { "class" : "disabled"} ';
}
$l10nName = $i18n->crm_translate($data, array('context' => 'menu'));
$navigationString .= ' { "attr": { "id" : "node_' . $key . '"}, "data": { "title":"' . $l10nName . '"' . $class . '}';
} else {
// Home is a special case
if ($value['attributes']['name'] != 'Home') {
$name = self::getMenuName($value, $skipMenuItems);
if ($name) {
//separator before
if (isset($value['attributes']['separator']) && $value['attributes']['separator'] == 2) {
$navigationString .= '<li class="menu-separator"></li>';
}
$removeCharacters = array('/', '!', '&', '*', ' ', '(', ')', '.');
$navigationString .= '<li class="menumain crm-' . str_replace($removeCharacters, '_', $value['attributes']['label']) . '">' . $name;
}
}
}
self::recurseNavigation($value, $navigationString, $json, $skipMenuItems);
}
if ($json) {
$navigationString = '[' . $navigationString . '}]';
} else {
// clean up - Need to remove empty <ul>'s, this happens when user don't have
// permission to access parent
$navigationString = str_replace('<ul></ul></li>', '', $navigationString);
}
return $navigationString;
}
示例2: buildNavigation
/**
* Function to build menu
*
* @param boolean $json by default output is html
*
* @return returns html or json object
* @static
*/
static function buildNavigation($json = false)
{
$navigations = array();
self::buildNavigationTree($navigations, $parent = NULL);
$navigationString = null;
// run the Navigation through a hook so users can modify it
require_once 'CRM/Utils/Hook.php';
CRM_Utils_Hook::navigationMenu($navigations);
//skip children menu item if user don't have access to parent menu item
$skipMenuItems = array();
foreach ($navigations as $key => $value) {
if ($json) {
if ($navigationString) {
$navigationString .= '},';
}
$data = $value['attributes']['label'];
$class = '';
if (!$value['attributes']['active']) {
$class = ', attributes: { "class" : "disabled"} ';
}
$navigationString .= ' { "attr": { "id" : "node_' . $key . '"}, "data": { "title":"' . $data . '"' . $class . '}';
} else {
// Home is a special case
if ($value['attributes']['name'] != 'Home') {
$name = self::getMenuName($value, $skipMenuItems);
if ($name) {
$removeCharacters = array('/', '!', '&', '*', ' ', '(', ')', '.');
$navigationString .= '<li class="menumain crm-' . str_replace($removeCharacters, '_', $value['attributes']['label']) . '">' . $name;
}
}
}
self::recurseNavigation($value, $navigationString, $json, $skipMenuItems);
}
if ($json) {
$navigationString = '[' . $navigationString . '}]';
} else {
// clean up - Need to remove empty <ul>'s, this happens when user don't have
// permission to access parent
$navigationString = str_replace('<ul></ul></li>', '', $navigationString);
}
return $navigationString;
}