本文整理汇总了PHP中CRM_Core_BAO_Navigation::getCacheKey方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Navigation::getCacheKey方法的具体用法?PHP CRM_Core_BAO_Navigation::getCacheKey怎么用?PHP CRM_Core_BAO_Navigation::getCacheKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_Navigation
的用法示例。
在下文中一共展示了CRM_Core_BAO_Navigation::getCacheKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_crmNavigationMenu
/**
* Output navigation script tag
*
* @param array $params
* - is_default: bool, true if this is normal/default instance of the menu (which may be subject to CIVICRM_DISABLE_DEFAULT_MENU)
* @param CRM_Core_Smarty $smarty
* The Smarty object.
*
* @return string
* HTML
*/
function smarty_function_crmNavigationMenu($params, &$smarty)
{
$config = CRM_Core_Config::singleton();
//check if logged in user has access CiviCRM permission and build menu
$buildNavigation = !CRM_Core_Config::isUpgradeMode() && CRM_Core_Permission::check('access CiviCRM');
if (defined('CIVICRM_DISABLE_DEFAULT_MENU') && CRM_Utils_Array::value('is_default', $params, FALSE)) {
$buildNavigation = FALSE;
}
if ($config->userFrameworkFrontend) {
$buildNavigation = FALSE;
}
if ($buildNavigation) {
$session = CRM_Core_Session::singleton();
$contactID = $session->get('userID');
if ($contactID) {
// These params force the browser to refresh the js file when switching user, domain, or language
// We don't put them as a query string because some browsers will refuse to cache a page with a ? in the url
// @see CRM_Admin_Page_AJAX::getNavigationMenu
$lang = $config->lcMessages;
$domain = CRM_Core_Config::domainID();
$key = CRM_Core_BAO_Navigation::getCacheKey($contactID);
$src = CRM_Utils_System::url("civicrm/ajax/menujs/{$contactID}/{$lang}/{$domain}/{$key}");
// CRM-15493 QFkey needed for quicksearch bar - must be unique on each page refresh so adding it directly to markup
$qfKey = CRM_Core_Key::get('CRM_Contact_Controller_Search', TRUE);
return '<script id="civicrm-navigation-menu" type="text/javascript" src="' . $src . '" data-qfkey=' . json_encode($qfKey) . '></script>';
}
}
return '';
}
示例2: smarty_function_crmNavigationMenu
/**
* Output navigation script tag
*
* @param array $params
* - is_default: bool, true if this is normal/default instance of the menu (which may be subject to CIVICRM_DISABLE_DEFAULT_MENU)
* @param object $smarty the Smarty object
*
* @return string HTML
*/
function smarty_function_crmNavigationMenu($params, &$smarty)
{
$config = CRM_Core_Config::singleton();
//check if logged in user has access CiviCRM permission and build menu
$buildNavigation = !CRM_Core_Config::isUpgradeMode() && CRM_Core_Permission::check('access CiviCRM');
if (defined('CIVICRM_DISABLE_DEFAULT_MENU') && CRM_Utils_Array::value('is_default', $params, FALSE)) {
$buildNavigation = FALSE;
}
if ($config->userFrameworkFrontend) {
$buildNavigation = FALSE;
}
if ($buildNavigation) {
$session = CRM_Core_Session::singleton();
$contactID = $session->get('userID');
if ($contactID) {
// These params force the browser to refresh the js file when switching user, domain, or language
// We don't put them as a query string because some browsers will refuse to cache a page with a ? in the url
// We end the string with .js to trick apache mods into sending pro-caching headers
// @see CRM_Admin_Page_AJAX::getNavigationMenu
$lang = $config->lcMessages;
$domain = CRM_Core_Config::domainID();
$key = CRM_Core_BAO_Navigation::getCacheKey($contactID);
$src = CRM_Utils_System::url("civicrm/ajax/menujs/{$contactID}/{$lang}/{$domain}/{$key}.js");
return '<script type="text/javascript" src="' . $src . '"></script>';
}
}
return '';
}