本文整理汇总了PHP中CRM_Core_BAO_Navigation::retrieve方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Navigation::retrieve方法的具体用法?PHP CRM_Core_BAO_Navigation::retrieve怎么用?PHP CRM_Core_BAO_Navigation::retrieve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_Navigation
的用法示例。
在下文中一共展示了CRM_Core_BAO_Navigation::retrieve方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
parent::buildQuickForm();
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
if (isset($this->_id)) {
$params = array('id' => $this->_id);
CRM_Core_BAO_Navigation::retrieve($params, $this->_defaults);
}
$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'label', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Navigation', 'label'), true);
$this->add('text', 'url', ts('Url'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Navigation', 'url'));
require_once 'CRM/Core/Permission.php';
$permissions = CRM_Core_Permission::basicPermissions(true);
$include =& $this->addElement('advmultiselect', 'permission', ts('Permission') . ' ', $permissions, array('size' => 5, 'style' => 'width:150px', 'class' => 'advmultiselect'));
$include->setButtonAttributes('add', array('value' => ts('Add >>')));
$include->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$operators = array('AND' => 'AND', 'OR' => 'OR');
$this->add('select', 'permission_operator', ts('Operator'), $operators);
$this->add('checkbox', 'has_separator', ts('Separator?'));
$active = $this->add('checkbox', 'is_active', ts('Enabled?'));
if ($this->_defaults['name'] == 'Home') {
$active->freeze();
} else {
$parentMenu = CRM_Core_BAO_Navigation::getNavigationList();
if (isset($this->_id)) {
unset($parentMenu[$this->_id]);
}
// also unset home.
$homeMenuId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'Home', 'id', 'name');
unset($parentMenu[$homeMenuId]);
$parent = $this->add('select', 'parent_id', ts('Parent'), array('' => ts('-- select --')) + $parentMenu);
}
}
示例2: eventpermissions_civicrm_navigationMenu
/**
* Implements hook_civicrm_navigationMenu().
*/
function eventpermissions_civicrm_navigationMenu(&$params)
{
$searchParams = array('url' => 'civicrm/eventpermissions?reset=1');
$menuItems = array();
CRM_Core_BAO_Navigation::retrieve($searchParams, $menuItems);
if (!empty($menuItems)) {
return;
}
$searchParams = array('url' => 'civicrm/admin/options/participant_role?reset=1');
$menuItems = array();
CRM_Core_BAO_Navigation::retrieve($searchParams, $menuItems);
$parent = CRM_Utils_Array::value('parent_id', $menuItems);
$navId = CRM_Core_DAO::singleValueQuery("SELECT max(id) FROM civicrm_navigation");
if (is_int($navId)) {
$navId++;
}
$basicAttrs = array('label' => ts('Event Permissions', array('domain' => 'com.aghstrategies.eventpermissions')), 'name' => 'Event Permissions', 'url' => 'civicrm/eventpermissions?reset=1', 'permission' => 'administer CiviCRM', 'active' => 1, 'navID' => $navId, 'parentID' => $parent);
$searchParams = array('id' => $parent);
$menuItems = array();
CRM_Core_BAO_Navigation::retrieve($searchParams, $menuItems);
if (empty($menuItems['parent_id'])) {
$params[$parent]['child'][$navId] = $basicAttrs;
} else {
$params[$menuItems['parent_id']]['child'][$parent]['child'][$navId] = array('attributes' => $basicAttrs);
}
}
示例3: addNavigationMenuEntry
/**
* Add the given menu item to the CiviCRM navigation menu if it does not exist yet.
* @param array parent_params the params array into whose 'child' attribute the new item will be added.
* @param array $attributes the attributes array to be added to the navigation menu
*/
static function addNavigationMenuEntry(&$parent_params, $menu_entry_attributes)
{
// see if it is already in the menu...
$menu_item_search = array('url' => $menu_entry_attributes['url']);
$menu_items = array();
CRM_Core_BAO_Navigation::retrieve($menu_item_search, $menu_items);
if (empty($menu_items)) {
// it's not already contained, so we want to add it to the menu
// insert at the bottom
$parent_params['child'][] = array('attributes' => $menu_entry_attributes);
}
}
示例4: queryrunner_civicrm_navigationMenu
function queryrunner_civicrm_navigationMenu(&$params)
{
$menu_item_search = array('url' => 'civicrm/query-runner');
$menu_items = array();
CRM_Core_BAO_Navigation::retrieve($menu_item_search, $menu_items);
if (!empty($menu_items)) {
return;
}
$navId = CRM_Core_DAO::singleValueQuery('SELECT MAX(id) FROM civicrm_navigation') + 1;
$adminID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'Administer', 'id', 'name');
$systemID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'System settings', 'id', 'name');
$params[$adminID]['child'][$systemID]['child'][$navId] = array('attributes' => array('label' => ts('Query Runner'), 'name' => 'Query Runner', 'url' => 'civicrm/query-runner', 'permission' => 'administer CiviCRM', 'operator' => 'AND', 'separator' => null, 'parentID' => $systemID, 'navID' => $navId, 'active' => 1));
}
示例5: hrprofile_civicrm_uninstall
/**
* Implementation of hook_civicrm_uninstall
*/
function hrprofile_civicrm_uninstall()
{
$groups = CRM_Core_PseudoConstant::get('CRM_Core_BAO_UFField', 'uf_group_id', array('labelColumn' => 'name'));
$profileId = array_search('hrstaffdir_listing', $groups);
$isEnabled = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Extension', 'org.civicrm.hrstaffdir', 'is_active', 'full_name');
if ($profileId && $isEnabled) {
$originalUrl = "civicrm/profile/table?reset=1&gid={$profileId}&force=1";
$updatedUrl = "civicrm/profile?reset=1&gid={$profileId}&force=1";
hrprofile_updateNavigation($originalUrl, $updatedUrl);
} else {
$navigationParams = array('label' => 'Directory', 'url' => "civicrm/profile/table?reset=1&gid={$profileId}&force=1");
$navigation = CRM_Core_BAO_Navigation::retrieve($navigationParams, $defaultParams);
CRM_Core_BAO_Navigation::processDelete($navigation->id);
CRM_Core_BAO_Navigation::resetNavigation();
}
return _hrprofile_civix_civicrm_uninstall();
}
示例6: setDefaultValues
public function setDefaultValues()
{
$defaults = array();
if (isset($this->_id)) {
$params = array('id' => $this->_id);
CRM_Core_BAO_Navigation::retrieve($params, $defaults);
if (CRM_Utils_Array::value('permission', $defaults)) {
foreach (explode(',', $defaults['permission']) as $value) {
$components[$value] = $value;
}
$defaults['permission'] = $components;
}
//Take parent id in object variable to calculate the menu
//weight if menu parent id changed
$this->_currentParentID = CRM_Utils_Array::value('parent_id', $defaults);
} else {
$defaults['permission'] = "access CiviCRM";
}
// its ok if there is no element called is_active
$defaults['is_active'] = $this->_id ? $defaults['is_active'] : 1;
return $defaults;
}
示例7: buildQuickForm
/**
* Build the form object.
*/
public function buildQuickForm()
{
parent::buildQuickForm();
$this->setPageTitle(ts('Menu Item'));
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
if (isset($this->_id)) {
$params = array('id' => $this->_id);
CRM_Core_BAO_Navigation::retrieve($params, $this->_defaults);
}
$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'label', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Navigation', 'label'), TRUE);
$this->add('text', 'url', ts('Url'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Navigation', 'url'));
$permissions = array();
foreach (CRM_Core_Permission::basicPermissions(TRUE, TRUE) as $id => $vals) {
$permissions[] = array('id' => $id, 'label' => $vals[0], 'description' => (array) CRM_Utils_Array::value(1, $vals));
}
$this->add('text', 'permission', ts('Permission'), array('placeholder' => ts('Unrestricted'), 'class' => 'huge', 'data-select-params' => json_encode(array('data' => array('results' => $permissions, 'text' => 'label')))));
$operators = array('AND' => ts('AND'), 'OR' => ts('OR'));
$this->add('select', 'permission_operator', NULL, $operators);
//make separator location configurable
$separator = array(ts('None'), ts('After menu element'), ts('Before menu element'));
$this->add('select', 'has_separator', ts('Separator'), $separator);
$active = $this->add('advcheckbox', 'is_active', ts('Enabled'));
if (CRM_Utils_Array::value('name', $this->_defaults) == 'Home') {
$active->freeze();
} else {
$parentMenu = CRM_Core_BAO_Navigation::getNavigationList();
if (isset($this->_id)) {
unset($parentMenu[$this->_id]);
}
// also unset home.
$homeMenuId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'Home', 'id', 'name');
unset($parentMenu[$homeMenuId]);
$this->add('select', 'parent_id', ts('Parent'), array('' => ts('Top level')) + $parentMenu, FALSE, array('class' => 'crm-select2'));
}
}
示例8: webtracking_civicrm_navigationMenu
/**
* This hook is used to add the web tracking report link to the navigation menu
*
*/
function webtracking_civicrm_navigationMenu(&$params)
{
// Check that our item doesn't already exist
$menu_item_search = array('url' => 'civicrm/report/webtracking');
$menu_items = array();
CRM_Core_BAO_Navigation::retrieve($menu_item_search, $menu_items);
if (!empty($menu_items)) {
return;
}
$navId = CRM_Core_DAO::singleValueQuery("SELECT max(id) FROM civicrm_navigation");
if (is_integer($navId)) {
$navId++;
}
// Find the Report menu
$reportID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'Reports', 'id', 'name');
$params[$reportID]['child'][$navId] = array('attributes' => array('label' => ts('Web Tracking Report', array('domain' => 'org.civicrm.webtracking')), 'name' => 'Web Tracking Report', 'url' => 'civicrm/report/webtracking', 'permission' => 'access CiviReport,access CiviEvent', 'operator' => 'OR', 'separator' => 1, 'parentID' => $reportID, 'navID' => $navId, 'active' => 1));
}
示例9: bic_civicrm_navigationMenu
/**
* Implementation of hook_civicrm_navigationMenu
*
* Inject the 'civicrm/bicList' item unter the 'Search' top menu, unless it's already in there...
*
* based on https://github.com/Project60/sepa_dd/commit/f342a223c41d7fc940294f24999fc5bdf637b98b
*/
function bic_civicrm_navigationMenu(&$params)
{
// see if it is already in the menu...
$menu_item_search = array('url' => 'civicrm/bicList');
$menu_items = array();
CRM_Core_BAO_Navigation::retrieve($menu_item_search, $menu_items);
if (empty($menu_items)) {
// it's not already contained, so we want to add it to the menu
// now, by default we want to add it to the Contributions menu -> find it
$search_menu_id = 0;
foreach ($params as $key => $value) {
if ($value['attributes']['name'] == 'Search...') {
$search_menu_id = $key;
break;
}
}
if (empty($search_menu_id)) {
error_log("org.project60.bic: Cannot find 'Contributions' menu item.");
} else {
// insert at the bottom
$params[$search_menu_id]['child'][] = array('attributes' => array('label' => ts('Find Banks', array('domain' => 'org.project60.bic')), 'name' => 'BankLists', 'url' => 'civicrm/bicList', 'permission' => 'access CiviContribute', 'operator' => NULL, 'separator' => 2, 'parentID' => $search_menu_id, 'navID' => bic_navhelper_create_unique_nav_id($params), 'active' => 1));
}
}
}
示例10: cdntaxreceipts_civicrm_navigationMenu
/**
* Implementation of hook_civicrm_managed
*
* Add entries to the navigation menu, automatically removed on uninstall
*/
function cdntaxreceipts_civicrm_navigationMenu(&$params)
{
// Check that our item doesn't already exist
$cdntax_search = array('url' => 'civicrm/cdntaxreceipts/settings?reset=1');
$cdntax_item = array();
CRM_Core_BAO_Navigation::retrieve($cdntax_search, $cdntax_item);
if (!empty($cdntax_item)) {
return;
}
// Get the maximum key of $params using method mentioned in discussion
// https://issues.civicrm.org/jira/browse/CRM-13803
$navId = CRM_Core_DAO::singleValueQuery("SELECT max(id) FROM civicrm_navigation");
if (is_integer($navId)) {
$navId++;
}
// Find the Memberships menu
foreach ($params as $key => $value) {
if ('Administer' == $value['attributes']['name']) {
$parent_key = $key;
foreach ($value['child'] as $child_key => $child_value) {
if ('CiviContribute' == $child_value['attributes']['name']) {
$params[$parent_key]['child'][$child_key]['child'][$navId] = array('attributes' => array('label' => ts('CDN Tax Receipts', array('domain' => 'org.civicrm.cdntaxreceipts')), 'name' => 'CDN Tax Receipts', 'url' => 'civicrm/cdntaxreceipts/settings?reset=1', 'permission' => 'access CiviContribute,administer CiviCRM', 'operator' => 'AND', 'separator' => 2, 'parentID' => $child_key, 'navID' => $navId, 'active' => 1));
}
}
}
}
}
示例11: setDefaultValues
static function setDefaultValues(&$form, &$defaults)
{
// we should not build form elements in dashlet mode
if ($form->_section) {
return;
}
$instanceID = $form->getVar('_id');
$navigationDefaults = array();
if (!isset($defaults['permission'])) {
$permissions = array_flip(CRM_Core_Permission::basicPermissions());
$defaults['permission'] = $permissions['CiviReport: access CiviReport'];
}
$config = CRM_Core_Config::singleton();
$defaults['report_header'] = $report_header = "<html>\n <head>\n <title>CiviCRM Report</title>\n <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />\n <style type=\"text/css\">@import url({$config->userFrameworkResourceURL}css/print.css);</style>\n </head>\n <body><div id=\"crm-container\">";
$defaults['report_footer'] = $report_footer = "<p><img src=\"{$config->userFrameworkResourceURL}i/powered_by.png\" /></p></div></body>\n</html>\n";
if ($instanceID) {
// this is already retrieved via Form.php
$defaults['description'] = CRM_Utils_Array::value('description', $defaults);
$defaults['report_header'] = CRM_Utils_Array::value('header', $defaults);
$defaults['report_footer'] = CRM_Utils_Array::value('footer', $defaults);
if (!empty($defaults['navigation_id'])) {
//get the default navigation parent id
$params = array('id' => $defaults['navigation_id']);
CRM_Core_BAO_Navigation::retrieve($params, $navigationDefaults);
$defaults['is_navigation'] = 1;
$defaults['parent_id'] = CRM_Utils_Array::value('parent_id', $navigationDefaults);
if (!empty($navigationDefaults['is_active'])) {
$form->assign('is_navigation', TRUE);
}
if (!empty($navigationDefaults['id'])) {
$form->_navigation['id'] = $navigationDefaults['id'];
$form->_navigation['parent_id'] = $navigationDefaults['parent_id'];
}
}
if (!empty($defaults['grouprole'])) {
foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, $defaults['grouprole']) as $value) {
$grouproles[] = $value;
}
$defaults['grouprole'] = $grouproles;
}
} else {
if (property_exists($form, '_description')) {
$defaults['description'] = $form->_description;
}
}
}
示例12: add
/**
* Function to add or update Contact SubTypes
*
* @param array $params an assoc array of name/value pairs
* @return object
* @access public
* @static
*/
static function add($params)
{
// null if empty params or doesn't contain parent_id
if (!CRM_Utils_Array::value('parent_id', $params)) {
return;
}
// label or name
if (!CRM_Utils_Array::value('label', $params)) {
return;
}
// parent_id
if (!CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_ContactType', $params['parent_id'])) {
return;
}
$contactType = new CRM_Contact_DAO_ContactType();
$contactType->copyValues($params);
$contactType->id = CRM_Utils_Array::value('id', $params);
$contactType->is_active = CRM_Utils_Array::value('is_active', $params, 0);
$contactType->save();
if ($contactType->find(true)) {
$contactName = $contactType->name;
$contact = ucfirst($contactType->label);
$active = $contactType->is_active;
}
if (CRM_Utils_Array::value('id', $params)) {
$params = array('name' => "New {$contactName}");
$newParams = array('label' => "New {$contact}", 'is_active' => $active);
CRM_Core_BAO_Navigation::processUpdate($params, $newParams);
} else {
if (CRM_Utils_Array::value('parent_id', $params)) {
$name = self::getBasicType($contactName);
$value = array('name' => "New {$name}");
CRM_Core_BAO_Navigation::retrieve($value, $navinfo);
$navigation = array('label' => "New {$contact}", 'name' => "New {$contactName}", 'url' => "civicrm/contact/add&ct={$name}&cst={$contactName}&reset=1", 'permission' => "add contacts", 'parent_id' => $navinfo['id'], 'is_active' => $active);
CRM_Core_BAO_Navigation::add($navigation);
}
}
CRM_Core_BAO_Navigation::resetNavigation();
// reset the cache after adding
self::subTypeInfo(null, false, false, true);
return $contactType;
}
示例13: setDefaultValues
static function setDefaultValues(&$form, &$defaults)
{
$instanceID = $form->getVar('_id');
$navigationDefaults = array();
require_once 'CRM/Core/Config.php';
$config = CRM_Core_Config::singleton();
$defaults['report_header'] = $report_header = "<html>\n <head>\n <title>CiviCRM Report</title>\n <style type=\"text/css\">@import url({$config->userFrameworkResourceURL}css/print.css);</style>\n </head>\n <body><div id=\"crm-container\">";
$defaults['report_footer'] = $report_footer = "<p><img src=\"{$config->userFrameworkResourceURL}i/powered_by.png\" /></p></div></body>\n</html>\n";
if ($instanceID) {
// this is already retrieved via Form.php
$defaults['description'] = $defaults['description'];
if (CRM_Utils_Array::value('header', $defaults)) {
$defaults['report_header'] = $defaults['header'];
}
if (CRM_Utils_Array::value('footer', $defaults)) {
$defaults['report_footer'] = $defaults['footer'];
}
if (CRM_Utils_Array::value('navigation_id', $defaults)) {
//get the default navigation parent id
$params = array('id' => $defaults['navigation_id']);
CRM_Core_BAO_Navigation::retrieve($params, $navigationDefaults);
$defaults['is_navigation'] = 1;
$defaults['parent_id'] = CRM_Utils_Array::value('parent_id', $navigationDefaults);
if (CRM_Utils_Array::value('is_active', $navigationDefaults)) {
$form->assign('is_navigation', true);
}
if (CRM_Utils_Array::value('id', $navigationDefaults)) {
$form->_navigation['id'] = $navigationDefaults['id'];
$form->_navigation['parent_id'] = $navigationDefaults['parent_id'];
}
}
} else {
$defaults['description'] = $form->_description;
}
}
示例14: _hrstaffdir_setActiveFields
function _hrstaffdir_setActiveFields($oParams, $nParams)
{
$profileId = hrstaffdir_getUFGroupID();
$path = array('url' => "civicrm/profile?reset=1&gid={$profileId}&force=1");
$navigationPath = CRM_Core_BAO_Navigation::retrieve($path, $defaultpath);
if ($navigationPath) {
$params = array('label' => 'Directory', 'url' => "civicrm/profile?reset=1&gid={$profileId}&force=1", 'is_active' => $oParams);
$newParams = array('is_active' => $nParams);
$navigation = CRM_Core_BAO_Navigation::processUpdate($params, $newParams);
CRM_Core_BAO_Navigation::resetNavigation();
}
//disable/enable ufgroup and uffield
$sql = "UPDATE civicrm_uf_field JOIN civicrm_uf_group ON civicrm_uf_group.id = civicrm_uf_field.uf_group_id SET civicrm_uf_field.is_active = {$nParams} WHERE civicrm_uf_group.name = 'hrstaffdir_listing'";
CRM_Core_DAO::executeQuery($sql);
CRM_Core_DAO::executeQuery("UPDATE civicrm_uf_group SET is_active = {$nParams} WHERE name = 'hrstaffdir_listing'");
}
示例15: iats_civicrm_navigationMenu
function iats_civicrm_navigationMenu(&$navMenu)
{
$pages = array('admin_page' => array('label' => 'iATS Payments Admin', 'name' => 'iATS Payments Admin', 'url' => 'civicrm/iATSAdmin', 'parent' => array('Contributions'), 'permission' => 'access CiviContribute,administer CiviCRM', 'operator' => 'AND', 'separator' => NULL, 'active' => 1), 'settings_page' => array('label' => 'iATS Payments Settings', 'name' => 'iATS Payments Settings', 'url' => 'civicrm/admin/contribute/iatssettings', 'parent' => array('Administer', 'CiviContribute'), 'permission' => 'access CiviContribute,administer CiviCRM', 'operator' => 'AND', 'separator' => NULL, 'active' => 1));
foreach ($pages as $item) {
// Check that our item doesn't already exist
$menu_item_search = array('url' => $item['url']);
$menu_items = array();
CRM_Core_BAO_Navigation::retrieve($menu_item_search, $menu_items);
if (empty($menu_items)) {
$path = implode('/', $item['parent']);
unset($item['parent']);
_iats_civix_insert_navigation_menu($navMenu, $path, $item);
}
}
}