projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #5446 from atif-shaikh/CRM-14105
[civicrm-core.git]
/
CRM
/
Core
/
Menu.php
diff --git
a/CRM/Core/Menu.php
b/CRM/Core/Menu.php
index 1ca3cfa4315beadd69b71fbd7fd51f91e53cf772..02a288955259ca7f7ab574f56269051453891239 100644
(file)
--- a/
CRM/Core/Menu.php
+++ b/
CRM/Core/Menu.php
@@
-23,7
+23,7
@@
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+
*/
/**
* This file contains the various menus of the CiviCRM module
/**
* This file contains the various menus of the CiviCRM module
@@
-42,18
+42,16
@@
require_once 'CRM/Core/I18n.php';
class CRM_Core_Menu {
/**
class CRM_Core_Menu {
/**
- * The list of menu items
+ * The list of menu items
.
*
* @var array
*
* @var array
- * @static
*/
static $_items = NULL;
/**
*/
static $_items = NULL;
/**
- * The list of permissioned menu items
+ * The list of permissioned menu items
.
*
* @var array
*
* @var array
- * @static
*/
static $_permissionedItems = NULL;
*/
static $_permissionedItems = NULL;
@@
-69,7
+67,7
@@
class CRM_Core_Menu {
const MENU_ITEM = 1;
/**
const MENU_ITEM = 1;
/**
- * This function fetches the menu items from xml and xmlMenu hooks
+ * This function fetches the menu items from xml and xmlMenu hooks
.
*
* @param boolen $fetchFromXML
* Fetch the menu items from xml and not from cache.
*
* @param boolen $fetchFromXML
* Fetch the menu items from xml and not from cache.
@@
-128,9
+126,12
@@
class CRM_Core_Menu {
if (strpos($key, '_callback') &&
strpos($value, '::')
) {
if (strpos($key, '_callback') &&
strpos($value, '::')
) {
+ // FIXME Remove the rewrite at this level. Instead, change downstream call_user_func*($value)
+ // to call_user_func*(Civi\Core\Resolver::singleton()->get($value)).
$value = explode('::', $value);
}
elseif ($key == 'access_arguments') {
$value = explode('::', $value);
}
elseif ($key == 'access_arguments') {
+ // FIXME Move the permission parser to its own class (or *maybe* CRM_Core_Permission).
if (strpos($value, ',') ||
strpos($value, ';')
) {
if (strpos($value, ',') ||
strpos($value, ';')
) {
@@
-161,12
+162,12
@@
class CRM_Core_Menu {
}
/**
}
/**
- * This function defines information for various menu items
+ * This function defines information for various menu items
.
*
* @param boolen $fetchFromXML
* Fetch the menu items from xml and not from cache.
*
*
* @param boolen $fetchFromXML
* Fetch the menu items from xml and not from cache.
*
- * @
static
+ * @
return array
*/
public static function &items($fetchFromXML = FALSE) {
return self::xmlItems($fetchFromXML);
*/
public static function &items($fetchFromXML = FALSE) {
return self::xmlItems($fetchFromXML);
@@
-237,7
+238,7
@@
class CRM_Core_Menu {
}
/**
}
/**
- * We use this function to
+ * We use this function to
.
*
* 1. Compute the breadcrumb
* 2. Compute local tasks value if any
*
* 1. Compute the breadcrumb
* 2. Compute local tasks value if any
@@
-261,7
+262,7
@@
class CRM_Core_Menu {
}
/**
}
/**
- * This function recomputes menu from xml and populates civicrm_menu
+ * This function recomputes menu from xml and populates civicrm_menu
.
* @param bool $truncate
*/
public static function store($truncate = TRUE) {
* @param bool $truncate
*/
public static function store($truncate = TRUE) {
@@
-277,8
+278,8
@@
class CRM_Core_Menu {
$config = CRM_Core_Config::singleton();
foreach ($menuArray as $path => $item) {
$config = CRM_Core_Config::singleton();
foreach ($menuArray as $path => $item) {
- $menu
= new CRM_Core_DAO_Menu();
- $menu->path
= $path;
+ $menu = new CRM_Core_DAO_Menu();
+ $menu->path = $path;
$menu->domain_id = CRM_Core_Config::domainID();
$menu->find(TRUE);
$menu->domain_id = CRM_Core_Config::domainID();
$menu->find(TRUE);
@@
-317,19
+318,19
@@
class CRM_Core_Menu {
'title' => $item['title'],
'desc' => CRM_Utils_Array::value('desc', $item),
'id' => strtr($item['title'], array(
'title' => $item['title'],
'desc' => CRM_Utils_Array::value('desc', $item),
'id' => strtr($item['title'], array(
- '(' => '_',
- ')' => '',
- ' ' => '',
+
'(' => '_',
+
')' => '',
+
' ' => '',
',' => '_',
',' => '_',
- '/' => '_',
+
'/' => '_',
)
),
'url' => CRM_Utils_System::url($path, $query,
)
),
'url' => CRM_Utils_System::url($path, $query,
-
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
+ 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
),
'icon' => CRM_Utils_Array::value('icon', $item),
'extra' => CRM_Utils_Array::value('extra', $item),
),
'icon' => CRM_Utils_Array::value('icon', $item),
'extra' => CRM_Utils_Array::value('extra', $item),
@@
-392,7
+393,8
@@
class CRM_Core_Menu {
foreach ($values as $index => $item) {
if (strpos(CRM_Utils_Array::value($config->userFrameworkURLVar, $_REQUEST),
$item['path']
foreach ($values as $index => $item) {
if (strpos(CRM_Utils_Array::value($config->userFrameworkURLVar, $_REQUEST),
$item['path']
- ) === 0) {
+ ) === 0
+ ) {
$values[$index]['active'] = 'class="active"';
}
else {
$values[$index]['active'] = 'class="active"';
}
else {
@@
-489,7
+491,6
@@
class CRM_Core_Menu {
* @return array
* The breadcrumb for this path
*
* @return array
* The breadcrumb for this path
*
- * @static
*/
public static function buildBreadcrumb(&$menu, $path) {
$crumbs = array();
*/
public static function buildBreadcrumb(&$menu, $path) {
$crumbs = array();
@@
-622,14
+623,14
@@
class CRM_Core_Menu {
$elements = array();
while (!empty($args)) {
$elements = array();
while (!empty($args)) {
- $string
= implode('/', $args);
- $string
= CRM_Core_DAO::escapeString($string);
+ $string = implode('/', $args);
+ $string = CRM_Core_DAO::escapeString($string);
$elements[] = "'{$string}'";
array_pop($args);
}
$elements[] = "'{$string}'";
array_pop($args);
}
- $queryString
= implode(', ', $elements);
- $domainID
= CRM_Core_Config::domainID();
+ $queryString = implode(', ', $elements);
+ $domainID = CRM_Core_Config::domainID();
$domainWhereClause = " AND domain_id = $domainID ";
if ($config->isUpgradeMode() &&
!CRM_Core_DAO::checkFieldExists('civicrm_menu', 'domain_id')
$domainWhereClause = " AND domain_id = $domainID ";
if ($config->isUpgradeMode() &&
!CRM_Core_DAO::checkFieldExists('civicrm_menu', 'domain_id')
@@
-741,11
+742,12
@@
UNION (
$urlToSession[$count]['sessionVar'],
$urlToSession[$count]['type'],
$urlToSession[$count]['default']
$urlToSession[$count]['sessionVar'],
$urlToSession[$count]['type'],
$urlToSession[$count]['default']
- ) = explode(':', $keyVal);
+
) = explode(':', $keyVal);
$count++;
}
$arr['urlToSession'] = $urlToSession;
}
return $arr;
}
$count++;
}
$arr['urlToSession'] = $urlToSession;
}
return $arr;
}
+
}
}