| 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
class CRM_Core_Menu {
/**
- * The list of menu items
+ * The list of menu items.
*
* @var array
- * @static
*/
static $_items = NULL;
/**
- * The list of permissioned menu items
+ * The list of permissioned menu items.
*
* @var array
- * @static
*/
static $_permissionedItems = NULL;
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.
*
* @return array
*/
}
/**
- * 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);
}
/**
- * We use this function to
+ * We use this function to.
*
* 1. Compute the breadcrumb
* 2. Compute local tasks value if any
* 3. Propagate access argument, access callback, page callback to the menu item
* 4. Build the global navigation block
- *
*/
public static function build(&$menu) {
foreach ($menu as $path => $menuItems) {
}
/**
- * 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) {
self::build($menuArray);
-
$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);
'title' => $item['title'],
'desc' => CRM_Utils_Array::value('desc', $item),
'id' => strtr($item['title'], array(
- '(' => '_', ')' => '', ' ' => '',
- ',' => '_', '/' => '_',
+ '(' => '_',
+ ')' => '',
+ ' ' => '',
+ ',' => '_',
+ '/' => '_',
)
),
'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),
foreach ($values as $index => $item) {
if (strpos(CRM_Utils_Array::value($config->userFrameworkURLVar, $_REQUEST),
$item['path']
- ) === 0) {
+ ) === 0
+ ) {
$values[$index]['active'] = 'class="active"';
}
else {
}
}
-
if (!$all) {
// remove all collapsed menu items from the array
foreach ($values as $weight => $v) {
/**
* Get the breadcrumb for a given path.
*
- * @param array $menu An array of all the menu items.
- * @param string $path Path for which breadcrumb is to be build.
+ * @param array $menu
+ * An array of all the menu items.
+ * @param string $path
+ * Path for which breadcrumb is to be build.
*
- * @return array The breadcrumb for this path
+ * @return array
+ * The breadcrumb for this path
*
- * @static
*/
public static function buildBreadcrumb(&$menu, $path) {
$crumbs = array();
$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);
}
- $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')
// Once we have another example of a 'cleanup' we should generalize the clause below so it grabs string
// which follows upgrade/ and checks for existence of a function in Cleanup class.
if ($path == 'civicrm/upgrade/cleanup425') {
- $menuPath['page_callback'] = array('CRM_Upgrade_Page_Cleanup','cleanup425');
+ $menuPath['page_callback'] = array('CRM_Upgrade_Page_Cleanup', 'cleanup425');
$menuPath['access_arguments'][0][] = 'administer CiviCRM';
$menuPath['access_callback'] = array('CRM_Core_Permission', 'checkMenu');
}
$urlToSession[$count]['sessionVar'],
$urlToSession[$count]['type'],
$urlToSession[$count]['default']
- ) = explode(':', $keyVal);
+ ) = explode(':', $keyVal);
$count++;
}
$arr['urlToSession'] = $urlToSession;
}
return $arr;
}
+
}