當前位置: 首頁>>代碼示例>>PHP>>正文


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怎麽用?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']);
        }
    }
}
開發者ID:prashantgajare,項目名稱:civicrm-core,代碼行數:39,代碼來源:Job.php

示例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();
}
開發者ID:hyebahi,項目名稱:civicrm-core,代碼行數:29,代碼來源:Job.php

示例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']);
    }
}
開發者ID:peteainsworth,項目名稱:civicrm-4.2.9-drupal,代碼行數:34,代碼來源:Job.php


注:本文中的CRM_Contact_BAO_Contact_Utils::updateGreeting方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。