本文整理汇总了PHP中CRM_Utils_Address::sequence方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_Address::sequence方法的具体用法?PHP CRM_Utils_Address::sequence怎么用?PHP CRM_Utils_Address::sequence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_Address
的用法示例。
在下文中一共展示了CRM_Utils_Address::sequence方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addressSequence
/**
* Provide addressSequence
*
* @param
*
* @return string
*/
public function addressSequence()
{
$addressFormat = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'address_format');
return CRM_Utils_Address::sequence($addressFormat);
}
示例2: addressSequence
/**
* @deprecated
*/
public function addressSequence()
{
return CRM_Utils_Address::sequence(Civi::settings()->get('address_format'));
}
示例3: getAddressReturnProperties
/**
* Get array of return properties for address fields required for mailing label
* @return array return properites for address e.g
* array (
* - [street_address] => 1,
* - [supplemental_address_1] => 1,
* - [supplemental_address_2] => 1
* )
*/
function getAddressReturnProperties()
{
$mailingFormat = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'mailing_format');
$addressFields = CRM_Utils_Address::sequence($mailingFormat);
$addressReturnProperties = array_fill_keys($addressFields, 1);
if (array_key_exists('postal_code', $addressReturnProperties)) {
$addressReturnProperties['postal_code_suffix'] = 1;
}
return $addressReturnProperties;
}
示例4: postProcess
/**
* process the form after the input has been submitted and validated
*
* @access public
*
* @return void
*/
public function postProcess()
{
$fv = $this->controller->exportValues($this->_name);
$config = CRM_Core_Config::singleton();
$locName = NULL;
//get the address format sequence from the config file
$mailingFormat = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'mailing_format');
$sequence = CRM_Utils_Address::sequence($mailingFormat);
foreach ($sequence as $v) {
$address[$v] = 1;
}
if (array_key_exists('postal_code', $address)) {
$address['postal_code_suffix'] = 1;
}
//build the returnproperties
$returnProperties = array('display_name' => 1, 'contact_type' => 1);
$mailingFormat = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'mailing_format');
$mailingFormatProperties = array();
if ($mailingFormat) {
$mailingFormatProperties = self::getReturnProperties($mailingFormat);
$returnProperties = array_merge($returnProperties, $mailingFormatProperties);
}
//we should not consider addressee for data exists, CRM-6025
if (array_key_exists('addressee', $mailingFormatProperties)) {
unset($mailingFormatProperties['addressee']);
}
$customFormatProperties = array();
if (stristr($mailingFormat, 'custom_')) {
foreach ($mailingFormatProperties as $token => $true) {
if (substr($token, 0, 7) == 'custom_') {
if (empty($customFormatProperties[$token])) {
$customFormatProperties[$token] = $mailingFormatProperties[$token];
}
}
}
}
if (!empty($customFormatProperties)) {
$returnProperties = array_merge($returnProperties, $customFormatProperties);
}
if (isset($fv['merge_same_address'])) {
// we need first name/last name for summarising to avoid spillage
$returnProperties['first_name'] = 1;
$returnProperties['last_name'] = 1;
}
$individualFormat = FALSE;
/*
* CRM-8338: replace ids of household members with the id of their household
* so we can merge labels by household.
*/
if (isset($fv['merge_same_household'])) {
$this->mergeContactIdsByHousehold();
$individualFormat = TRUE;
}
//get the contacts information
$params = array();
if (!empty($fv['location_type_id'])) {
$locType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
$locName = $locType[$fv['location_type_id']];
$location = array('location' => array("{$locName}" => $address));
$returnProperties = array_merge($returnProperties, $location);
$params[] = array('location_type', '=', array($fv['location_type_id'] => 1), 0, 0);
} else {
$returnProperties = array_merge($returnProperties, $address);
}
$rows = array();
foreach ($this->_contactIds as $key => $contactID) {
$params[] = array(CRM_Core_Form::CB_PREFIX . $contactID, '=', 1, 0, 0);
}
// fix for CRM-2651
if (!empty($fv['do_not_mail'])) {
$params[] = array('do_not_mail', '=', 0, 0, 0);
}
// fix for CRM-2613
$params[] = array('is_deceased', '=', 0, 0, 0);
$custom = array();
foreach ($returnProperties as $name => $dontCare) {
$cfID = CRM_Core_BAO_CustomField::getKeyID($name);
if ($cfID) {
$custom[] = $cfID;
}
}
//get the total number of contacts to fetch from database.
$numberofContacts = count($this->_contactIds);
$query = new CRM_Contact_BAO_Query($params, $returnProperties);
$details = $query->apiQuery($params, $returnProperties, NULL, NULL, 0, $numberofContacts);
$messageToken = CRM_Utils_Token::getTokens($mailingFormat);
// also get all token values
CRM_Utils_Hook::tokenValues($details[0], $this->_contactIds, NULL, $messageToken, 'CRM_Contact_Form_Task_Label');
$tokens = array();
CRM_Utils_Hook::tokens($tokens);
$tokenFields = array();
foreach ($tokens as $category => $catTokens) {
foreach ($catTokens as $token => $tokenName) {
//.........这里部分代码省略.........
示例5: getAddressReturnProperties
/**
* Get array of return properties for address fields required for mailing label.
*
* @return array
* return properties for address e.g
* [street_address => 1, supplemental_address_1 => 1, supplemental_address_2 => 1]
*/
public static function getAddressReturnProperties()
{
$mailingFormat = Civi::settings()->get('mailing_format');
$addressFields = CRM_Utils_Address::sequence($mailingFormat);
$addressReturnProperties = array_fill_keys($addressFields, 1);
if (array_key_exists('postal_code', $addressReturnProperties)) {
$addressReturnProperties['postal_code_suffix'] = 1;
}
return $addressReturnProperties;
}