本文整理汇总了PHP中CRM_Core_BAO_Navigation::find方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Navigation::find方法的具体用法?PHP CRM_Core_BAO_Navigation::find怎么用?PHP CRM_Core_BAO_Navigation::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_Navigation
的用法示例。
在下文中一共展示了CRM_Core_BAO_Navigation::find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUpdateExistingReportMenuLink
/**
* Test that an existing report link is rebuilt under it's parent.
*
* Function tests CRM_Core_BAO_Navigation::rebuildReportsNavigation.
*/
public function testUpdateExistingReportMenuLink()
{
$url = 'civicrm/report/instance/1';
$url_params = 'reset=1';
$existing_nav = CRM_Core_BAO_Navigation::getNavItemByUrl($url, $url_params);
$this->assertNotEquals(FALSE, $existing_nav);
$existing_nav->parent_id = 1;
$existing_nav->save();
CRM_Core_BAO_Navigation::rebuildReportsNavigation(CRM_Core_Config::domainID());
$parent_url = 'civicrm/report/list';
$parent_url_params = 'compid=99&reset=1';
$reportsMenu = CRM_Core_BAO_Navigation::createOrUpdateTopLevelReportsNavItem(CRM_Core_Config::domainID());
$parent_nav = CRM_Core_BAO_Navigation::getNavItemByUrl($parent_url, $parent_url_params, $reportsMenu->id);
$this->assertNotEquals($parent_nav->id, 1);
$changed_existing_nav = new CRM_Core_BAO_Navigation();
$changed_existing_nav->id = $existing_nav->id;
$changed_existing_nav->find(TRUE);
$this->assertEquals($changed_existing_nav->parent_id, $parent_nav->id);
}
示例2: getNavItemByUrl
/**
* Retrieve a navigation item using it's url.
*
* Note that we use LIKE to permit a wildcard as the calling code likely doesn't
* care about output params appended.
*
* @param string $url
* @param array $url_params
*
* @param int|null $parent_id
* Optionally restrict to one parent.
*
* @return bool|\CRM_Core_BAO_Navigation
*/
public static function getNavItemByUrl($url, $url_params, $parent_id = NULL)
{
$nav = new CRM_Core_BAO_Navigation();
$nav->parent_id = $parent_id;
$nav->whereAdd("url LIKE '{$url}?{$url_params}'");
if ($nav->find(TRUE)) {
return $nav;
}
return FALSE;
}