本文整理汇总了PHP中CRM_Contact_BAO_Contact_Utils::updateGreeting方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_Contact_Utils::updateGreeting方法的具体用法?PHP CRM_Contact_BAO_Contact_Utils::updateGreeting怎么用?PHP CRM_Contact_BAO_Contact_Utils::updateGreeting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_BAO_Contact_Utils
的用法示例。
在下文中一共展示了CRM_Contact_BAO_Contact_Utils::updateGreeting方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: civicrm_api3_job_update_greeting
/**
*
* This method allows to update Email Greetings, Postal Greetings and Addressee for a specific contact type.
* IMPORTANT: You must first create valid option value before using via admin interface.
* Check option lists for Email Greetings, Postal Greetings and Addressee
*
* id - Integer - greetings option group
*
* @param $params
*
* @return boolean true if success, else false
* @static
* @access public
*/
function civicrm_api3_job_update_greeting($params)
{
if (isset($params['ct']) && isset($params['gt'])) {
$ct = $gt = array();
$ct = explode(',', $params['ct']);
$gt = explode(',', $params['gt']);
foreach ($ct as $ctKey => $ctValue) {
foreach ($gt as $gtKey => $gtValue) {
$params['ct'] = trim($ctValue);
$params['gt'] = trim($gtValue);
$result[] = CRM_Contact_BAO_Contact_Utils::updateGreeting($params);
}
}
} else {
$result = CRM_Contact_BAO_Contact_Utils::updateGreeting($params);
}
foreach ($result as $resultKey => $resultValue) {
if ($resultValue['is_error'] == 0) {
//really we should rely on the exception mechanism here - but we need to test that before removing this line
return civicrm_api3_create_success();
} else {
return civicrm_api3_create_error($resultValue['messages']);
}
}
}
示例2: civicrm_api3_job_update_greeting
/**
* This method allows to update Email Greetings, Postal Greetings and Addressee for a specific contact type.
*
* IMPORTANT: You must first create valid option value before using via admin interface.
* Check option lists for Email Greetings, Postal Greetings and Addressee
*
* @todo - is this here by mistake or should it be added to _spec function :id - Integer - greetings option group.
*
* @param array $params
*
* @return array
*/
function civicrm_api3_job_update_greeting($params)
{
if (isset($params['ct']) && isset($params['gt'])) {
$ct = explode(',', $params['ct']);
$gt = explode(',', $params['gt']);
foreach ($ct as $ctKey => $ctValue) {
foreach ($gt as $gtKey => $gtValue) {
$params['ct'] = trim($ctValue);
$params['gt'] = trim($gtValue);
CRM_Contact_BAO_Contact_Utils::updateGreeting($params);
}
}
} else {
CRM_Contact_BAO_Contact_Utils::updateGreeting($params);
}
return civicrm_api3_create_success();
}
示例3: civicrm_api3_job_update_greeting
/**
*
* This method allows to update Email Greetings, Postal Greetings and Addressee for a specific contact type.
* IMPORTANT: You must first create valid option value before using via admin interface.
* Check option lists for Email Greetings, Postal Greetings and Addressee
*
* @param array $params (reference ) input parameters
* ct - String - ct=Individual or ct=Household or ct=Organization
* gt - String - gt=email_greeting or gt=postal_greeting or gt=addressee
* id - Integer - greetings option group
*
* @return boolean true if success, else false
* @static
* @access public
*
*/
function civicrm_api3_job_update_greeting($params)
{
require_once 'CRM/Contact/BAO/Contact/Utils.php';
civicrm_api3_verify_mandatory($params, NULL, array('ct', 'gt'));
// fixme - use the wrapper & getfields to do this checking - advertise as an enum
if (!in_array($params['ct'], array('Individual', 'Household', 'Organization'))) {
return civicrm_api3_create_error(ts('Invalid contact type (ct) parameter value'));
}
if (!in_array($params['gt'], array('email_greeting', 'postal_greeting', 'addressee'))) {
return civicrm_api3_create_error(ts('Invalid greeting type (gt) parameter value'));
}
$result = CRM_Contact_BAO_Contact_Utils::updateGreeting($params);
if ($result['is_error'] == 0) {
return civicrm_api3_create_success();
} else {
return civicrm_api3_create_error($result['messages']);
}
}