本文整理汇总了PHP中CRM_Contact_BAO_Contact::makeHierReturnProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_Contact::makeHierReturnProperties方法的具体用法?PHP CRM_Contact_BAO_Contact::makeHierReturnProperties怎么用?PHP CRM_Contact_BAO_Contact::makeHierReturnProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_BAO_Contact
的用法示例。
在下文中一共展示了CRM_Contact_BAO_Contact::makeHierReturnProperties方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getProfileContact
/**
* Function to get the list of contacts for a profile
*
* @param $form object
*
* @access public
*/
function getProfileContact($gid)
{
$session =& CRM_Core_Session::singleton();
$params = $session->get('profileParams');
$details = array();
$ufGroupParam = array('id' => $gid);
require_once "CRM/Core/BAO/UFGroup.php";
CRM_Core_BAO_UFGroup::retrieve($ufGroupParam, $details);
// make sure this group can be mapped
if (!$details['is_map']) {
CRM_Core_Error::statusBounce(ts('This profile does not have the map feature turned on.'));
}
$groupId = CRM_Utils_Array::value('limit_listings_group_id', $details);
// add group id to params if a uf group belong to a any group
if ($groupId) {
if (CRM_Utils_Array::value('group', $params)) {
$params['group'][$groupId] = 1;
} else {
$params['group'] = array($groupId => 1);
}
}
$fields = CRM_Core_BAO_UFGroup::getListingFields(CRM_Core_Action::VIEW, CRM_Core_BAO_UFGroup::PUBLIC_VISIBILITY | CRM_Core_BAO_UFGroup::LISTINGS_VISIBILITY, false, $gid);
$returnProperties =& CRM_Contact_BAO_Contact::makeHierReturnProperties($fields);
$returnProperties['contact_type'] = 1;
$returnProperties['sort_name'] = 1;
$queryParams =& CRM_Contact_BAO_Query::convertFormValues($params, 1);
$query =& new CRM_Contact_BAO_Query($queryParams, $returnProperties, $fields);
$ids = $query->searchQuery(0, 0, null, false, false, false, true, false);
$contactIds = explode(',', $ids);
return $contactIds;
}
示例2: __construct
/**
* Class constructor
*
* @param $customSearchClass
* @param array $formValues array of form values imported
* @param array $params array of parameters for query
* @param null $returnProperties
* @param \const|int $action - action of search basic or advanced.
*
* @param bool $includeContactIds
* @param bool $searchDescendentGroups
* @param string $searchContext
* @param null $contextMenu
*
* @return CRM_Contact_Selector
* @access public
*/
function __construct($customSearchClass, $formValues = NULL, $params = NULL, $returnProperties = NULL, $action = CRM_Core_Action::NONE, $includeContactIds = FALSE, $searchDescendentGroups = TRUE, $searchContext = 'search', $contextMenu = NULL)
{
//don't build query constructor, if form is not submitted
$force = CRM_Utils_Request::retrieve('force', 'Boolean', CRM_Core_DAO::$_nullObject);
if (empty($formValues) && !$force) {
return;
}
// submitted form values
$this->_formValues =& $formValues;
$this->_params =& $params;
$this->_returnProperties =& $returnProperties;
$this->_contextMenu =& $contextMenu;
$this->_context = $searchContext;
// type of selector
$this->_action = $action;
$this->_searchContext = $searchContext;
$this->_ufGroupID = CRM_Utils_Array::value('uf_group_id', $this->_formValues);
if ($this->_ufGroupID) {
$this->_fields = CRM_Core_BAO_UFGroup::getListingFields(CRM_Core_Action::VIEW, CRM_Core_BAO_UFGroup::PUBLIC_VISIBILITY | CRM_Core_BAO_UFGroup::LISTINGS_VISIBILITY, FALSE, $this->_ufGroupID);
self::$_columnHeaders = NULL;
$this->_customFields = CRM_Core_BAO_CustomField::getFieldsForImport('Individual');
$this->_returnProperties = CRM_Contact_BAO_Contact::makeHierReturnProperties($this->_fields);
$this->_returnProperties['contact_type'] = 1;
$this->_returnProperties['contact_sub_type'] = 1;
$this->_returnProperties['sort_name'] = 1;
}
$displayRelationshipType = CRM_Utils_Array::value('display_relationship_type', $this->_formValues);
$operator = CRM_Utils_Array::value('operator', $this->_formValues, 'AND');
// rectify params to what proximity search expects if there is a value for prox_distance
// CRM-7021
if (!empty($this->_params)) {
CRM_Contact_BAO_ProximityQuery::fixInputParams($this->_params);
}
$this->_query = new CRM_Contact_BAO_Query($this->_params, $this->_returnProperties, NULL, $includeContactIds, FALSE, CRM_Contact_BAO_Query::MODE_CONTACTS, FALSE, $searchDescendentGroups, FALSE, $displayRelationshipType, $operator);
$this->_options =& $this->_query->_options;
}
示例3: __construct
/**
* Class constructor
*
* @param string params the params for the where clause
*
* @return CRM_Contact_Selector_Profile
* @access public
*/
function __construct(&$params, &$customFields, $ufGroupIds = NULL, $map = FALSE, $editLink = FALSE, $linkToUF = FALSE)
{
$this->_params = $params;
if (is_array($ufGroupIds)) {
$this->_profileIds = $ufGroupIds;
$this->_gid = $ufGroupIds[0];
} else {
$this->_profileIds = array($ufGroupIds);
$this->_gid = $ufGroupIds;
}
$this->_map = $map;
$this->_editLink = $editLink;
$this->_linkToUF = $linkToUF;
//get the details of the uf group
if ($this->_gid) {
$groupId = CRM_Core_DAO::getFieldValue('CRM_Core_BAO_UFGroup', $this->_gid, 'limit_listings_group_id');
}
// add group id to params if a uf group belong to a any group
if ($groupId) {
if (!empty($this->_params['group'])) {
$this->_params['group'][$groupId] = 1;
} else {
$this->_params['group'] = array($groupId => 1);
}
}
$this->_fields = CRM_Core_BAO_UFGroup::getListingFields(CRM_Core_Action::VIEW, CRM_Core_BAO_UFGroup::PUBLIC_VISIBILITY | CRM_Core_BAO_UFGroup::LISTINGS_VISIBILITY, FALSE, $this->_profileIds);
$this->_customFields =& $customFields;
$returnProperties = CRM_Contact_BAO_Contact::makeHierReturnProperties($this->_fields);
$returnProperties['contact_type'] = 1;
$returnProperties['contact_sub_type'] = 1;
$returnProperties['sort_name'] = 1;
$queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_params, 1);
$this->_query = new CRM_Contact_BAO_Query($queryParams, $returnProperties, $this->_fields);
//the below is done for query building for multirecord custom field listing
//to show all the custom field multi valued records of a particular contact
$this->setMultiRecordTableName($this->_fields);
$this->_options =& $this->_query->_options;
}
示例4: getValues
/**
* Given a contact id and a field set, return the values from the db
* for this contact
*
* @param int $cid
* @param array $fields
* The profile fields of interest.
* @param array $values
* The values for the above fields.
* @param bool $searchable
* Searchable or not.
* @param array $componentWhere
* Component condition.
* @param bool $absolute
* Return urls in absolute form (useful when sending an email).
* @param null $additionalWhereClause
*/
public static function getValues($cid, &$fields, &$values, $searchable = TRUE, $componentWhere = NULL, $absolute = FALSE, $additionalWhereClause = NULL)
{
if (empty($cid) && empty($componentWhere)) {
return NULL;
}
// get the contact details (hier)
$returnProperties = CRM_Contact_BAO_Contact::makeHierReturnProperties($fields);
$params = $cid ? array(array('contact_id', '=', $cid, 0, 0)) : array();
// add conditions specified by components. eg partcipant_id etc
if (!empty($componentWhere)) {
$params = array_merge($params, $componentWhere);
}
$query = new CRM_Contact_BAO_Query($params, $returnProperties, $fields);
$options =& $query->_options;
$details = $query->searchQuery(0, 0, NULL, FALSE, FALSE, FALSE, FALSE, FALSE, $additionalWhereClause);
if (!$details->fetch()) {
return;
}
$query->convertToPseudoNames($details);
$config = CRM_Core_Config::singleton();
$locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
$imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id');
$websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id');
$multipleFields = array('url');
//start of code to set the default values
foreach ($fields as $name => $field) {
// fix for CRM-3962
if ($name == 'id') {
$name = 'contact_id';
}
// skip fields that should not be displayed separately
if (!empty($field['skipDisplay'])) {
continue;
}
// Create a unique, non-empty index for each field.
$index = $field['title'];
if ($index === '') {
$index = ' ';
}
while (array_key_exists($index, $values)) {
$index .= ' ';
}
$params[$index] = $values[$index] = '';
$customFieldName = NULL;
// hack for CRM-665
if (isset($details->{$name}) || $name == 'group' || $name == 'tag') {
// to handle gender / suffix / prefix
if (in_array(substr($name, 0, -3), array('gender', 'prefix', 'suffix'))) {
$params[$index] = $details->{$name};
$values[$index] = $details->{$name};
} elseif (in_array($name, CRM_Contact_BAO_Contact::$_greetingTypes)) {
$dname = $name . '_display';
$values[$index] = $details->{$dname};
$name = $name . '_id';
$params[$index] = $details->{$name};
} elseif (in_array($name, array('state_province', 'country', 'county'))) {
$values[$index] = $details->{$name};
$idx = $name . '_id';
$params[$index] = $details->{$idx};
} elseif ($name === 'preferred_communication_method') {
$communicationFields = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method');
$compref = array();
$pref = explode(CRM_Core_DAO::VALUE_SEPARATOR, $details->{$name});
foreach ($pref as $k) {
if ($k) {
$compref[] = $communicationFields[$k];
}
}
$params[$index] = $details->{$name};
$values[$index] = implode(',', $compref);
} elseif ($name === 'preferred_language') {
$params[$index] = $details->{$name};
$values[$index] = CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', 'preferred_language', $details->{$name});
} elseif ($name == 'group') {
$groups = CRM_Contact_BAO_GroupContact::getContactGroup($cid, 'Added', NULL, FALSE, TRUE);
$title = $ids = array();
foreach ($groups as $g) {
// CRM-8362: User and User Admin visibility groups should be included in display if user has
// VIEW permission on that group
$groupPerm = CRM_Contact_BAO_Group::checkPermission($g['group_id'], $g['title']);
if ($g['visibility'] != 'User and User Admin Only' || CRM_Utils_Array::key(CRM_Core_Permission::VIEW, $groupPerm)) {
$title[] = $g['title'];
if ($g['visibility'] == 'Public Pages') {
//.........这里部分代码省略.........
示例5: getValues
/**
* Given a contact id and a field set, return the values from the db
* for this contact
*
* @param int $id the contact id
* @param array $fields the profile fields of interest
* @param array $values the values for the above fields
* @return void
* @access public
* @static
*/
function getValues($cid, &$fields, &$values)
{
$options = array();
// get the contact details (hier)
$returnProperties =& CRM_Contact_BAO_Contact::makeHierReturnProperties($fields);
$params = array('id' => $cid);
$query =& new CRM_Contact_BAO_Query($params, $returnProperties, $fields);
$options =& $query->_options;
$details = $query->searchQuery();
if (!$details->fetch()) {
return;
}
require_once 'CRM/Core/PseudoConstant.php';
$locationTypes = CRM_Core_PseudoConstant::locationType();
//start of code to set the default values
foreach ($fields as $name => $field) {
$index = $field['title'];
$params[$index] = $values[$index] = '';
if ($details->{$name} || $name == 'group' || $name == 'tag') {
//hack for CRM-665
//to handle custom data (checkbox) to be written
// to handle gender / suffix / prefix
if (in_array($name, array('gender', 'individual_prefix', 'individual_suffix'))) {
$values[$index] = $details->{$name};
$name = $name . '_id';
$params[$index] = $details->{$name};
} else {
if (in_array($name, array('state_province', 'country'))) {
$values[$index] = $details->{$name};
$idx = $name . '_id';
$params[$index] = $details->{$idx};
} else {
if (substr($name, 0, 7) === 'do_not_' or substr($name, 0, 3) === 'is_') {
if ($details->{$name}) {
$values[$index] = '[ x ]';
}
} else {
if ($name == 'group') {
$groups = CRM_Contact_BAO_GroupContact::getContactGroup($cid, 'Added', null, false, true);
$title = array();
$ids = array();
foreach ($groups as $g) {
if ($g['visibility'] != 'User and User Admin Only') {
$title[] = $g['title'];
if ($g['visibility'] == 'Public User Pages and Listings') {
$ids[] = $g['group_id'];
}
}
}
$values[$index] = implode(', ', $title);
$params[$index] = implode(',', $ids);
} else {
if ($name == 'tag') {
require_once 'CRM/Core/BAO/EntityTag.php';
$entityTags =& CRM_Core_BAO_EntityTag::getTag('civicrm_contact', $cid);
$allTags =& CRM_Core_PseudoConstant::tag();
$title = array();
foreach ($entityTags as $tagId) {
$title[] = $allTags[$tagId];
}
$values[$index] = implode(', ', $title);
$params[$index] = implode(',', $entityTags);
} else {
require_once 'CRM/Core/BAO/CustomField.php';
if ($cfID = CRM_Core_BAO_CustomField::getKeyID($name)) {
$params[$index] = $details->{$name};
$values[$index] = CRM_Core_BAO_CustomField::getDisplayValue($details->{$name}, $cfID, $options);
} else {
$values[$index] = $details->{$name};
}
}
}
}
}
}
} else {
if (strpos($name, '-') !== false) {
list($fieldName, $id, $type) = explode('-', $name);
$locationTypeName = CRM_Utils_Array::value($id, $locationTypes);
if (!$locationTypeName) {
continue;
}
$detailName = "{$locationTypeName}-{$fieldName}";
if (in_array($fieldName, array('phone', 'im', 'email'))) {
if ($type) {
$detailName .= "-{$type}";
} else {
$detailName .= '-1';
}
//.........这里部分代码省略.........
示例6: getValues
/**
* Given a contact id and a field set, return the values from the db
* for this contact
*
* @param int $id the contact id
* @param array $fields the profile fields of interest
* @param array $values the values for the above fields
* @param boolean $searchable searchable or not
* @param array $componentWhere component condition
*
* @return void
* @access public
* @static
*/
public static function getValues($cid, &$fields, &$values, $searchable = true, $componentWhere = null)
{
if (empty($cid)) {
return null;
}
$options = array();
$studentFields = array();
if (CRM_Core_Permission::access('Quest', false)) {
//student fields ( check box )
require_once 'CRM/Quest/BAO/Student.php';
$studentFields = CRM_Quest_BAO_Student::$multipleSelectFields;
}
// get the contact details (hier)
$returnProperties =& CRM_Contact_BAO_Contact::makeHierReturnProperties($fields);
$params = array(array('contact_id', '=', $cid, 0, 0));
// add conditions specified by components. eg partcipant_id etc
if (!empty($componentWhere)) {
$params = array_merge($params, $componentWhere);
}
$query =& new CRM_Contact_BAO_Query($params, $returnProperties, $fields);
$options =& $query->_options;
$details = $query->searchQuery();
if (!$details->fetch()) {
return;
}
$config =& CRM_Core_Config::singleton();
require_once 'CRM/Core/PseudoConstant.php';
$locationTypes = $imProviders = array();
$locationTypes = CRM_Core_PseudoConstant::locationType();
$imProviders = CRM_Core_PseudoConstant::IMProvider();
//start of code to set the default values
foreach ($fields as $name => $field) {
// fix for CRM-3962
if ($name == 'id') {
$name = 'contact_id';
}
$index = $field['title'];
$params[$index] = $values[$index] = '';
$customFieldName = null;
$elements = array('email_greeting_custom' => 'email_greeting', 'postal_greeting_custom' => 'postal_greeting', 'addressee_custom' => 'addressee');
if (isset($details->{$name}) || $name == 'group' || $name == 'tag') {
//hack for CRM-665
// to handle gender / suffix / prefix
if (in_array($name, array('gender', 'individual_prefix', 'individual_suffix'))) {
$values[$index] = $details->{$name};
$name = $name . '_id';
$params[$index] = $details->{$name};
} else {
if (in_array($name, array('email_greeting', 'postal_greeting', 'addressee'))) {
$dname = $name . '_display';
$values[$index] = $details->{$dname};
$name = $name . '_id';
$params[$index] = $details->{$name};
} else {
if (in_array($name, array('state_province', 'country', 'county'))) {
$values[$index] = $details->{$name};
$idx = $name . '_id';
$params[$index] = $details->{$idx};
} else {
if ($name === 'preferred_communication_method') {
$communicationFields = CRM_Core_PseudoConstant::pcm();
$pref = array();
$compref = array();
$pref = explode(CRM_Core_BAO_CustomOption::VALUE_SEPERATOR, $details->{$name});
foreach ($pref as $k) {
if ($k) {
$compref[] = $communicationFields[$k];
}
}
$params[$index] = $details->{$name};
$values[$index] = implode(",", $compref);
} else {
if ($name == 'group') {
$groups = CRM_Contact_BAO_GroupContact::getContactGroup($cid, 'Added', null, false, true);
$title = array();
$ids = array();
foreach ($groups as $g) {
if ($g['visibility'] != 'User and User Admin Only') {
$title[] = $g['title'];
if ($g['visibility'] == 'Public Pages') {
$ids[] = $g['group_id'];
}
}
}
$values[$index] = implode(', ', $title);
$params[$index] = implode(',', $ids);
//.........这里部分代码省略.........
示例7: __construct
/**
* Class constructor
*
* @param array $formValues array of form values imported
* @param array $params array of parameters for query
* @param int $action - action of search basic or advanced.
*
* @return CRM_Contact_Selector
* @access public
*/
function __construct($customSearchClass, $formValues = null, $params = null, $returnProperties = null, $action = CRM_Core_Action::NONE, $includeContactIds = false, $searchDescendentGroups = true, $searchContext = 'search', $contextMenu = null)
{
//don't build query constructor, if form is not submitted
$force = CRM_Utils_Request::retrieve('force', 'Boolean', CRM_Core_DAO::$_nullObject);
if (empty($formValues) && !$force) {
return;
}
// submitted form values
$this->_formValues =& $formValues;
$this->_params =& $params;
$this->_returnProperties =& $returnProperties;
$this->_contextMenu =& $contextMenu;
// type of selector
$this->_action = $action;
$this->_searchContext = $searchContext;
$this->_ufGroupID = CRM_Utils_Array::value('uf_group_id', $this->_formValues);
if ($this->_ufGroupID) {
require_once 'CRM/Core/BAO/UFGroup.php';
$this->_fields = CRM_Core_BAO_UFGroup::getListingFields(CRM_Core_Action::VIEW, CRM_Core_BAO_UFGroup::PUBLIC_VISIBILITY | CRM_Core_BAO_UFGroup::LISTINGS_VISIBILITY, false, $this->_ufGroupID);
self::$_columnHeaders = null;
//CRM_Core_Error::debug( 'f', $this->_fields );
$this->_customFields =& CRM_Core_BAO_CustomField::getFieldsForImport('Individual');
$this->_returnProperties =& CRM_Contact_BAO_Contact::makeHierReturnProperties($this->_fields);
$this->_returnProperties['contact_type'] = 1;
$this->_returnProperties['contact_sub_type'] = 1;
$this->_returnProperties['sort_name'] = 1;
//$this->_returnProperties['groups' ] = 1;
}
$this->_query =& new CRM_Contact_BAO_Query($this->_params, $this->_returnProperties, null, $includeContactIds, false, 1, false, $searchDescendentGroups);
$this->_options =& $this->_query->_options;
}
示例8: __construct
/**
* Class constructor
*
* @param string params the params for the where clause
*
* @return CRM_Contact_Selector_Profile
* @access public
*/
function __construct(&$params, &$customFields, $ufGroupId = null, $map = false, $editLink = false, $linkToUF = false)
{
$this->_params = $params;
$this->_gid = $ufGroupId;
$this->_map = $map;
$this->_editLink = $editLink;
$this->_linkToUF = $linkToUF;
//get the details of the uf group
if ($ufGroupId) {
$groupId = CRM_Core_DAO::getFieldValue('CRM_Core_BAO_UFGroup', $ufGroupId, 'limit_listings_group_id');
}
// add group id to params if a uf group belong to a any group
if ($groupId) {
if (CRM_Utils_Array::value('group', $this->_params)) {
$this->_params['group'][$groupId] = 1;
} else {
$this->_params['group'] = array($groupId => 1);
}
}
$this->_fields = CRM_Core_BAO_UFGroup::getListingFields(CRM_Core_Action::VIEW, CRM_Core_BAO_UFGroup::PUBLIC_VISIBILITY | CRM_Core_BAO_UFGroup::LISTINGS_VISIBILITY, false, $this->_gid);
$this->_customFields =& $customFields;
$returnProperties =& CRM_Contact_BAO_Contact::makeHierReturnProperties($this->_fields);
$returnProperties['contact_type'] = 1;
$returnProperties['contact_sub_type'] = 1;
$returnProperties['sort_name'] = 1;
$queryParams =& CRM_Contact_BAO_Query::convertFormValues($this->_params, 1);
$this->_query =& new CRM_Contact_BAO_Query($queryParams, $returnProperties, $this->_fields);
$this->_options =& $this->_query->_options;
}
示例9: CRM_Profile_Selector_Listings
/**
* Class constructor
*
* @param string params the params for the where clause
*
* @return CRM_Contact_Selector_Profile
* @access public
*/
function CRM_Profile_Selector_Listings(&$params, &$customFields, $ufGroupId = null)
{
$this->_params = $params;
$this->_gid = $ufGroupId;
//get the details of the uf group
$ufGroupParam = array('id' => $ufGroupId);
CRM_Core_BAO_UFGroup::retrieve($ufGroupParam, $details);
$groupId = CRM_Utils_Array::value('limit_listings_group_id', $details);
// add group id to params if a uf group belong to a any group
if ($groupId) {
if (CRM_Utils_Array::value('group', $this->_params)) {
$this->_params['group'][$groupId] = 1;
} else {
$this->_params['group'] = array($groupId => 1);
}
}
$this->_fields = CRM_Core_BAO_UFGroup::getListingFields(CRM_CORE_ACTION_VIEW, CRM_CORE_BAO_UFGROUP_PUBLIC_VISIBILITY | CRM_CORE_BAO_UFGROUP_LISTINGS_VISIBILITY, false, $this->_gid);
// CRM_Core_Error::debug( 'p', $this->_params );
// CRM_Core_Error::debug( 'f', $this->_fields );
$this->_customFields =& $customFields;
$returnProperties =& CRM_Contact_BAO_Contact::makeHierReturnProperties($this->_fields);
$returnProperties['contact_type'] = 1;
$returnProperties['sort_name'] = 1;
$this->_query =& new CRM_Contact_BAO_Query($this->_params, $returnProperties, $this->_fields);
$this->_options =& $this->_query->_options;
//CRM_Core_Error::debug( 'q', $this->_query );
}
示例10: __construct
/**
* Class constructor
*
* @param array $formValues array of form values imported
* @param array $params array of parameters for query
* @param int $action - action of search basic or advanced.
*
* @return CRM_Contact_Selector
* @access public
*/
function __construct($customSearchClass, $formValues = null, $params = null, $returnProperties = null, $action = CRM_Core_Action::NONE, $includeContactIds = false, $searchDescendentGroups = true, $searchContext = 'search', $contextMenu = null)
{
//don't build query constructor, if form is not submitted
$force = CRM_Utils_Request::retrieve('force', 'Boolean', CRM_Core_DAO::$_nullObject);
if (empty($formValues) && !$force) {
return;
}
// submitted form values
$this->_formValues =& $formValues;
$this->_params =& $params;
$this->_returnProperties =& $returnProperties;
$this->_contextMenu =& $contextMenu;
$this->_context = $searchContext;
// type of selector
$this->_action = $action;
$this->_searchContext = $searchContext;
$this->_ufGroupID = CRM_Utils_Array::value('uf_group_id', $this->_formValues);
if ($this->_ufGroupID) {
require_once 'CRM/Core/BAO/UFGroup.php';
$this->_fields = CRM_Core_BAO_UFGroup::getListingFields(CRM_Core_Action::VIEW, CRM_Core_BAO_UFGroup::PUBLIC_VISIBILITY | CRM_Core_BAO_UFGroup::LISTINGS_VISIBILITY, false, $this->_ufGroupID);
self::$_columnHeaders = null;
//CRM_Core_Error::debug( 'f', $this->_fields );
$this->_customFields =& CRM_Core_BAO_CustomField::getFieldsForImport('Individual');
$this->_returnProperties =& CRM_Contact_BAO_Contact::makeHierReturnProperties($this->_fields);
$this->_returnProperties['contact_type'] = 1;
$this->_returnProperties['contact_sub_type'] = 1;
$this->_returnProperties['sort_name'] = 1;
}
// rectify params to what proximity search expects if there is a value for prox_distance
// CRM-7021
if (!empty($this->_params)) {
foreach ($this->_params as $param) {
if ($param[0] == 'prox_distance') {
// add prox_ prefix to these
$param_alter = array('street_address', 'city', 'postal_code', 'state_province', 'country');
foreach ($this->_params as $key => $_param) {
if (in_array($_param[0], $param_alter)) {
$this->_params[$key][0] = 'prox_' . $_param[0];
// _id suffix where needed
if ($_param[0] == 'country' || $_param[0] == 'state_province') {
$this->_params[$key][0] .= '_id';
// flatten state_province array
if (is_array($this->_params[$key][2])) {
$this->_params[$key][2] = $this->_params[$key][2][0];
}
}
}
}
break;
}
}
}
$this->_query = new CRM_Contact_BAO_Query($this->_params, $this->_returnProperties, null, $includeContactIds, false, CRM_Contact_BAO_Query::MODE_CONTACTS, false, $searchDescendentGroups);
$this->_options =& $this->_query->_options;
}
示例11: getHierContactDetails
/**
* Function to get the all contact details(Hierarchical)
*
* @param int $contactId contact id
* @param array $fields fields array
*
* @return $values array contains the contact details
* @static
* @access public
*/
function getHierContactDetails($contactId, &$fields)
{
$params = array('id' => $contactId);
$options = array();
$returnProperties =& CRM_Contact_BAO_Contact::makeHierReturnProperties($fields);
return list($query, $options) = CRM_Contact_BAO_Query::apiQuery($params, $returnProperties, $options);
}