本文整理匯總了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']);
}
}