*
* @var array
*/
- static $_items = NULL;
+ public static $_items = NULL;
/**
* The list of permissioned menu items.
*
* @var array
*/
- static $_permissionedItems = NULL;
+ public static $_permissionedItems = NULL;
- static $_serializedElements = array(
+ public static $_serializedElements = array(
'access_arguments',
'access_callback',
'page_arguments',
'breadcrumb',
);
- static $_menuCache = NULL;
+ public static $_menuCache = NULL;
const MENU_ITEM = 1;
/**
'title' => $item['title'],
'desc' => CRM_Utils_Array::value('desc', $item),
'id' => strtr($item['title'], array(
- '(' => '_',
- ')' => '',
- ' ' => '',
- ',' => '_',
- '/' => '_',
- )
- ),
+ '(' => '_',
+ ')' => '',
+ ' ' => '',
+ ',' => '_',
+ '/' => '_',
+ )),
'url' => CRM_Utils_System::url($path, $query,
FALSE,
NULL,
$menu['admin'] = array('breadcrumb' => $values);
}
- /**
- * Get navigation.
- *
- * @param bool $all
- *
- * @return mixed
- * @throws Exception
- */
- public static function &getNavigation($all = FALSE) {
- CRM_Core_Error::fatal();
-
- if (!self::$_menuCache) {
- self::get('navigation');
- }
-
- if (CRM_Core_Config::isUpgradeMode()) {
- return array();
- }
-
- if (!array_key_exists('navigation', self::$_menuCache)) {
- // problem could be due to menu table empty. Just do a
- // menu store and try again
- self::store();
-
- // here we goo
- self::get('navigation');
- if (!array_key_exists('navigation', self::$_menuCache)) {
- CRM_Core_Error::fatal();
- }
- }
- $nav = &self::$_menuCache['navigation'];
-
- if (!$nav ||
- !isset($nav['breadcrumb'])
- ) {
- return NULL;
- }
-
- $values = &$nav['breadcrumb'];
- $config = CRM_Core_Config::singleton();
- foreach ($values as $index => $item) {
- if (strpos(CRM_Utils_Array::value($config->userFrameworkURLVar, $_REQUEST),
- $item['path']
- ) === 0
- ) {
- $values[$index]['active'] = 'class="active"';
- }
- else {
- $values[$index]['active'] = '';
- }
-
- if ($values[$index]['parent']) {
- $parent = $values[$index]['parent'];
-
- // only reset if still a leaf
- if ($values[$parent]['class'] == 'leaf') {
- $values[$parent]['class'] = 'collapsed';
- }
-
- // if a child or the parent is active, expand the menu
- if ($values[$index]['active'] ||
- $values[$parent]['active']
- ) {
- $values[$parent]['class'] = 'expanded';
- }
-
- // make the parent inactive if the child is active
- if ($values[$index]['active'] &&
- $values[$parent]['active']
- ) {
- $values[$parent]['active'] = '';
- }
- }
- }
-
- if (!$all) {
- // remove all collapsed menu items from the array
- foreach ($values as $weight => $v) {
- if ($v['parent'] &&
- $values[$v['parent']]['class'] == 'collapsed'
- ) {
- unset($values[$weight]);
- }
- }
- }
-
- // check permissions for the rest
- $activeChildren = array();
-
- foreach ($values as $weight => $v) {
- if (CRM_Core_Permission::checkMenuItem($v)) {
- if ($v['parent']) {
- $activeChildren[] = $weight;
- }
- }
- else {
- unset($values[$weight]);
- }
- }
-
- // add the start / end tags
- $len = count($activeChildren) - 1;
- if ($len >= 0) {
- $values[$activeChildren[0]]['start'] = TRUE;
- $values[$activeChildren[$len]]['end'] = TRUE;
- }
-
- ksort($values, SORT_NUMERIC);
- $i18n = CRM_Core_I18n::singleton();
- $i18n->localizeTitles($values);
-
- return $values;
- }
-
/**
* Get admin links.
*
'title' => $menu[$currentPath]['title'],
'url' => CRM_Utils_System::url($currentPath,
'reset=1' . $urlVar,
- FALSE, // absolute
- NULL, // fragment
- TRUE, // htmlize
- FALSE, // frontend
- TRUE // forceBackend; CRM-14439 work-around; acceptable for now because we don't display breadcrumbs on frontend
+ // absolute
+ FALSE,
+ // fragment
+ NULL,
+ // htmlize
+ TRUE,
+ // frontend
+ FALSE,
+ // forceBackend; CRM-14439 work-around; acceptable for now because we don't display breadcrumbs on frontend
+ TRUE
),
);
}