本文整理汇总了PHP中CRM_Contact_BAO_Contact::get方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_Contact::get方法的具体用法?PHP CRM_Contact_BAO_Contact::get怎么用?PHP CRM_Contact_BAO_Contact::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_BAO_Contact
的用法示例。
在下文中一共展示了CRM_Contact_BAO_Contact::get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
function preProcess()
{
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$this->assign('contactId', $this->_contactId);
$contact = new CRM_Contact_BAO_Contact();
$contact->get('id', $this->_contactId);
$this->_apiKey = $contact->api_key;
$this->assign('apiKey', $this->_apiKey);
// check logged in url permission
CRM_Contact_Page_View::checkUserPermission($this);
// set page title
CRM_Contact_Page_View::setTitle($this->_contactId);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
$this->assign('action', $this->_action);
$isAdmin = CRM_Core_Permission::check('administer CiviCRM') && CRM_Core_Permission::check('edit all contacts');
$session = CRM_Core_Session::singleton();
$isMyself = $this->_contactId && $this->_contactId == $session->get('userID');
$this->assign('isAdmin', $isAdmin);
$this->assign('isMyself', $isMyself);
$urlParam = 'reset=1&action=add&cid=' . $this->_contactId;
if ($this->_apiKey) {
$urlParam = 'reset=1&action=edit&cid=' . $this->_contactId;
}
$this->assign('addApiKeyUrl', CRM_Utils_System::url('civicrm/contact/apikey', $urlParam));
}
示例2: addContactTokens
function addContactTokens($contact_id, $variable_name)
{
if (empty($contact_id)) {
return;
}
// use the API to load a extensive contact information bulk
$contact = civicrm_api('Contact', 'getsingle', array('id' => $contact_id, 'version' => 3));
// ... add some missing fields
$bao = new CRM_Contact_BAO_Contact();
$bao->get('id', $contact_id);
$contact['postal_greeting_display'] = $bao->postal_greeting_display;
$contact['email_greeting_display'] = $bao->email_greeting_display;
$contact['addressee_display'] = $bao->addressee_display;
if (empty($contact['is_error'])) {
$this->assign($variable_name, $contact);
}
}
示例3: getContributor
/**
* read out the contributor
*/
public function getContributor($contact_id)
{
if ($this->cached_contributors[$contact_id]) {
return $this->cached_contributors[$contact_id];
}
// not cached? build it.
$contributor = array();
// load the contact
$contact = new CRM_Contact_BAO_Contact();
$contact->get('id', $contact_id);
// copy the base values
foreach (CRM_Donrec_Logic_ReceiptTokens::$STORED_TOKENS['contributor'] as $key => $value) {
if (isset($contact->{$key})) {
$contributor[$key] = $contact->{$key};
}
}
// add the addresses
$types = $this->getProfile()->getLocationTypes()['legal'];
$contributor_address = $this->lookupAddressTokens($contact_id, $types['address'], $types['fallback']);
if ($contributor_address != NULL) {
$contributor = array_merge($contributor, $contributor_address);
}
// cache the result
$this->cached_contributors[$contact_id] = $contributor;
return $contributor;
}
示例4: lookupAddressTokens
/**
* Get address tokens for a given contact with fallback type
*/
public static function lookupAddressTokens($contact_id, $location_type, $fallback_location_type)
{
if (empty($contact_id)) {
return array();
}
// find the address
$address = self::_lookupAddress($contact_id, $location_type);
if ($address == NULL) {
$address = self::_lookupAddress($contact_id, $fallback_location_type);
}
if ($address == NULL) {
// no address found
return array();
}
//add contact information
$contact_bao = new CRM_Contact_BAO_Contact();
$contact_bao->get('id', $contact_id);
$address['display_name'] = $contact_bao->display_name;
$address['addressee'] = $contact_bao->addressee_display;
return $address;
}