当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Contact_BAO_Contact_Utils::defaultGreeting方法代码示例

本文整理汇总了PHP中CRM_Contact_BAO_Contact_Utils::defaultGreeting方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_Contact_Utils::defaultGreeting方法的具体用法?PHP CRM_Contact_BAO_Contact_Utils::defaultGreeting怎么用?PHP CRM_Contact_BAO_Contact_Utils::defaultGreeting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Contact_BAO_Contact_Utils的用法示例。


在下文中一共展示了CRM_Contact_BAO_Contact_Utils::defaultGreeting方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processFormSubmission


//.........这里部分代码省略.........
     }
     // check for profile double opt-in and get groups to be subscribed
     $subscribeGroupIds = CRM_Core_BAO_UFGroup::getDoubleOptInGroupIds($params, $contactID);
     // since we are directly adding contact to group lets unset it from mailing
     if (!empty($addToGroups)) {
         foreach ($addToGroups as $groupId) {
             if (isset($subscribeGroupIds[$groupId])) {
                 unset($subscribeGroupIds[$groupId]);
             }
         }
     }
     foreach ($addToGroups as $k) {
         if (array_key_exists($k, $subscribeGroupIds)) {
             unset($addToGroups[$k]);
         }
     }
     if (empty($contactID)) {
         $dupeParams = $params;
         if (!empty($dupeParams['onbehalf'])) {
             unset($dupeParams['onbehalf']);
         }
         if (!empty($dupeParams['honor'])) {
             unset($dupeParams['honor']);
         }
         $dedupeParams = CRM_Dedupe_Finder::formatParams($dupeParams, 'Individual');
         $dedupeParams['check_permission'] = FALSE;
         $ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams, 'Individual');
         // if we find more than one contact, use the first one
         $contactID = CRM_Utils_Array::value(0, $ids);
         // Fetch default greeting id's if creating a contact
         if (!$contactID) {
             foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) {
                 if (!isset($params[$greeting])) {
                     $params[$greeting] = CRM_Contact_BAO_Contact_Utils::defaultGreeting('Individual', $greeting);
                 }
             }
         }
         $contactType = NULL;
     } else {
         $contactType = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $contactID, 'contact_type');
     }
     $contactID = CRM_Contact_BAO_Contact::createProfileContact($params, $fields, $contactID, $addToGroups, NULL, $contactType, TRUE);
     // Make the contact ID associated with the contribution available at the Class level.
     // Also make available to the session.
     //@todo consider handling this in $this->getContactID();
     $this->set('contactID', $contactID);
     $this->_contactID = $contactID;
     //get email primary first if exist
     $subscriptionEmail = array('email' => CRM_Utils_Array::value('email-Primary', $params));
     if (!$subscriptionEmail['email']) {
         $subscriptionEmail['email'] = CRM_Utils_Array::value("email-{$this->_bltID}", $params);
     }
     // subscribing contact to groups
     if (!empty($subscribeGroupIds) && $subscriptionEmail['email']) {
         CRM_Mailing_Event_BAO_Subscribe::commonSubscribe($subscribeGroupIds, $subscriptionEmail, $contactID);
     }
     // If onbehalf-of-organization contribution / signup, add organization
     // and it's location.
     if (isset($this->_values['onbehalf_profile_id']) && isset($behalfOrganization['organization_name'])) {
         $ufFields = array();
         foreach ($this->_fields['onbehalf'] as $name => $value) {
             $ufFields[$name] = 1;
         }
         self::processOnBehalfOrganization($behalfOrganization, $contactID, $this->_values, $this->_params, $ufFields);
     } elseif (!empty($this->_membershipContactID) && $contactID != $this->_membershipContactID) {
         // this is an onbehalf renew case for inherited membership. For e.g a permissioned member of household,
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:67,代码来源:Confirm.php

示例2: setDefaultValues

 /**
  * Set default values for the form.
  *
  * @param CRM_Core_Form $form
  * @param array $defaults
  */
 public static function setDefaultValues(&$form, &$defaults)
 {
     if (!empty($defaults['preferred_language'])) {
         $languages = CRM_Contact_BAO_Contact::buildOptions('preferred_language');
         $defaults['preferred_language'] = CRM_Utils_Array::key($defaults['preferred_language'], $languages);
     }
     // CRM-7119: set preferred_language to default if unset
     if (empty($defaults['preferred_language'])) {
         $config = CRM_Core_Config::singleton();
         $defaults['preferred_language'] = $config->lcMessages;
     }
     if (empty($defaults['communication_style_id'])) {
         $defaults['communication_style_id'] = array_pop(CRM_Core_OptionGroup::values('communication_style', TRUE, NULL, NULL, 'AND is_default = 1'));
     }
     // CRM-17778 -- set preferred_mail_format to default if unset
     if (empty($defaults['preferred_mail_format'])) {
         $defaults['preferred_mail_format'] = 'Both';
     } else {
         $defaults['preferred_mail_format'] = array_search($defaults['preferred_mail_format'], CRM_Core_SelectValues::pmf());
     }
     //set default from greeting types CRM-4575, CRM-9739
     if ($form->_action & CRM_Core_Action::ADD) {
         foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) {
             if (empty($defaults[$greeting . '_id'])) {
                 if ($defaultGreetingTypeId = CRM_Contact_BAO_Contact_Utils::defaultGreeting($form->_contactType, $greeting)) {
                     $defaults[$greeting . '_id'] = $defaultGreetingTypeId;
                 }
             }
         }
     } else {
         foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) {
             $name = "{$greeting}_display";
             $form->assign($name, CRM_Utils_Array::value($name, $defaults));
         }
     }
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:42,代码来源:CommunicationPreferences.php

示例3: foreach

 /**
  * Create contact.
  *
  * takes an associative array and creates a contact object and all the associated
  * derived objects (i.e. individual, location, email, phone etc)
  *
  * This function is invoked from within the web form layer and also from the api layer
  *
  * @param array $params
  *   (reference ) an assoc array of name/value pairs.
  * @param bool $fixAddress
  *   If we need to fix address.
  * @param bool $invokeHooks
  *   If we need to invoke hooks.
  *
  * @param bool $skipDelete
  *   Unclear parameter, passed to website create
  *
  * @todo explain this parameter
  *
  * @throws Exception
  * @return CRM_Contact_BAO_Contact|CRM_Core_Error
  *   Created or updated contribution object. We are deprecating returning an error in
  *   favour of exceptions
  */
 public static function &create(&$params, $fixAddress = TRUE, $invokeHooks = TRUE, $skipDelete = FALSE)
 {
     $contact = NULL;
     if (empty($params['contact_type']) && empty($params['contact_id'])) {
         return $contact;
     }
     $isEdit = TRUE;
     if ($invokeHooks) {
         if (!empty($params['contact_id'])) {
             CRM_Utils_Hook::pre('edit', $params['contact_type'], $params['contact_id'], $params);
         } else {
             CRM_Utils_Hook::pre('create', $params['contact_type'], NULL, $params);
             $isEdit = FALSE;
         }
     }
     $config = CRM_Core_Config::singleton();
     // CRM-6942: set preferred language to the current language if it’s unset (and we’re creating a contact).
     if (empty($params['contact_id']) && empty($params['preferred_language'])) {
         $params['preferred_language'] = $config->lcMessages;
     }
     // CRM-9739: set greeting & addressee if unset and we’re creating a contact.
     if (empty($params['contact_id'])) {
         foreach (self::$_greetingTypes as $greeting) {
             if (empty($params[$greeting . '_id'])) {
                 if ($defaultGreetingTypeId = CRM_Contact_BAO_Contact_Utils::defaultGreeting($params['contact_type'], $greeting)) {
                     $params[$greeting . '_id'] = $defaultGreetingTypeId;
                 }
             }
         }
     }
     $transaction = new CRM_Core_Transaction();
     $contact = self::add($params);
     if (!$contact) {
         // Not dying here is stupid, since we get into wierd situation and into a bug that
         // is impossible to figure out for the user or for us
         // CRM-7925
         CRM_Core_Error::fatal();
     }
     $params['contact_id'] = $contact->id;
     if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME, 'is_enabled')) {
         // Enabling multisite causes the contact to be added to the domain group.
         $domainGroupID = CRM_Core_BAO_Domain::getGroupId();
         if (!empty($domainGroupID)) {
             if (!empty($params['group']) && is_array($params['group'])) {
                 $params['group'][$domainGroupID] = 1;
             } else {
                 $params['group'] = array($domainGroupID => 1);
             }
         }
     }
     if (array_key_exists('group', $params)) {
         $contactIds = array($params['contact_id']);
         foreach ($params['group'] as $groupId => $flag) {
             if ($flag == 1) {
                 CRM_Contact_BAO_GroupContact::addContactsToGroup($contactIds, $groupId);
             } elseif ($flag == -1) {
                 CRM_Contact_BAO_GroupContact::removeContactsFromGroup($contactIds, $groupId);
             }
         }
     }
     // Add location Block data.
     $blocks = CRM_Core_BAO_Location::create($params, $fixAddress);
     foreach ($blocks as $name => $value) {
         $contact->{$name} = $value;
     }
     //add website
     CRM_Core_BAO_Website::create($params['website'], $contact->id, $skipDelete);
     //get userID from session
     $session = CRM_Core_Session::singleton();
     $userID = $session->get('userID');
     // add notes
     if (!empty($params['note'])) {
         if (is_array($params['note'])) {
             foreach ($params['note'] as $note) {
                 $contactId = $contact->id;
//.........这里部分代码省略.........
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:101,代码来源:Contact.php

示例4: postProcess


//.........这里部分代码省略.........
         if (!empty($params['onbehalf[image_URL]'])) {
             $behalfOrganization['image_URL'] = $params['onbehalf[image_URL]'];
         }
     }
     // check for profile double opt-in and get groups to be subscribed
     $subscribeGroupIds = CRM_Core_BAO_UFGroup::getDoubleOptInGroupIds($params, $contactID);
     // since we are directly adding contact to group lets unset it from mailing
     if (!empty($addToGroups)) {
         foreach ($addToGroups as $groupId) {
             if (isset($subscribeGroupIds[$groupId])) {
                 unset($subscribeGroupIds[$groupId]);
             }
         }
     }
     foreach ($addToGroups as $k) {
         if (array_key_exists($k, $subscribeGroupIds)) {
             unset($addToGroups[$k]);
         }
     }
     if (empty($contactID)) {
         $dupeParams = $params;
         if (!empty($dupeParams['onbehalf'])) {
             unset($dupeParams['onbehalf']);
         }
         $dedupeParams = CRM_Dedupe_Finder::formatParams($dupeParams, 'Individual');
         $dedupeParams['check_permission'] = FALSE;
         $ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams, 'Individual');
         // if we find more than one contact, use the first one
         $contact_id = CRM_Utils_Array::value(0, $ids);
         // Fetch default greeting id's if creating a contact
         if (!$contact_id) {
             foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) {
                 if (!isset($params[$greeting])) {
                     $params[$greeting] = CRM_Contact_BAO_Contact_Utils::defaultGreeting('Individual', $greeting);
                 }
             }
         }
         $contactID = CRM_Contact_BAO_Contact::createProfileContact($params, $fields, $contact_id, $addToGroups, NULL, NULL, TRUE);
     } else {
         $ctype = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $contactID, 'contact_type');
         $contactID = CRM_Contact_BAO_Contact::createProfileContact($params, $fields, $contactID, $addToGroups, NULL, $ctype, TRUE);
     }
     // Make the contact ID associated with the contribution available at the Class level.
     // Also make available to the session.
     //@todo consider handling this in $this->getContactID();
     $this->set('contactID', $contactID);
     $this->_contactID = $contactID;
     //get email primary first if exist
     $subscribtionEmail = array('email' => CRM_Utils_Array::value('email-Primary', $params));
     if (!$subscribtionEmail['email']) {
         $subscribtionEmail['email'] = CRM_Utils_Array::value("email-{$this->_bltID}", $params);
     }
     // subscribing contact to groups
     if (!empty($subscribeGroupIds) && $subscribtionEmail['email']) {
         CRM_Mailing_Event_BAO_Subscribe::commonSubscribe($subscribeGroupIds, $subscribtionEmail, $contactID);
     }
     // If onbehalf-of-organization contribution / signup, add organization
     // and it's location.
     if (isset($params['hidden_onbehalf_profile']) && isset($behalfOrganization['organization_name'])) {
         $ufFields = array();
         foreach ($this->_fields['onbehalf'] as $name => $value) {
             $ufFields[$name] = 1;
         }
         self::processOnBehalfOrganization($behalfOrganization, $contactID, $this->_values, $this->_params, $ufFields);
     } else {
         if (!empty($this->_membershipContactID) && $contactID != $this->_membershipContactID) {
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:67,代码来源:Confirm.php

示例5: postProcess

 /**
  * Process the user submitted custom data values.
  *
  *
  * @return void
  */
 public function postProcess()
 {
     $params = $this->controller->exportValues($this->_name);
     //if the delete record button is clicked
     if ($this->_deleteButtonName) {
         if (!empty($_POST[$this->_deleteButtonName]) && $this->_recordId) {
             $filterParams['id'] = $this->_customGroupId;
             $returnProperties = array('is_multiple', 'table_name');
             CRM_Core_DAO::commonRetrieve("CRM_Core_DAO_CustomGroup", $filterParams, $returnValues, $returnProperties);
             if (!empty($returnValues['is_multiple'])) {
                 if ($tableName = CRM_Utils_Array::value('table_name', $returnValues)) {
                     $sql = "DELETE FROM {$tableName} WHERE id = %1 AND entity_id = %2";
                     $sqlParams = array(1 => array($this->_recordId, 'Integer'), 2 => array($this->_id, 'Integer'));
                     CRM_Core_DAO::executeQuery($sql, $sqlParams);
                     CRM_Core_Session::setStatus(ts('Your record has been deleted.'), ts('Deleted'), 'success');
                 }
             }
             return;
         }
     }
     CRM_Utils_Hook::processProfile($this->_ufGroup['name']);
     if (!empty($params['image_URL'])) {
         CRM_Contact_BAO_Contact::processImageParams($params);
     }
     $greetingTypes = array('addressee' => 'addressee_id', 'email_greeting' => 'email_greeting_id', 'postal_greeting' => 'postal_greeting_id');
     $details = array();
     if ($this->_id) {
         $contactDetails = CRM_Contact_BAO_Contact::getHierContactDetails($this->_id, $greetingTypes);
         $details = $contactDetails[0][$this->_id];
     }
     if (!(!empty($details['addressee_id']) || !empty($details['email_greeting_id']) || CRM_Utils_Array::value('postal_greeting_id', $details))) {
         $profileType = CRM_Core_BAO_UFField::getProfileType($this->_gid);
         //Though Profile type is contact we need
         //Individual/Household/Organization for setting Greetings.
         if ($profileType == 'Contact') {
             $profileType = 'Individual';
             //if we editing Household/Organization.
             if ($this->_id) {
                 $profileType = CRM_Contact_BAO_Contact::getContactType($this->_id);
             }
         }
         if (CRM_Contact_BAO_ContactType::isaSubType($profileType)) {
             $profileType = CRM_Contact_BAO_ContactType::getBasicType($profileType);
         }
         foreach ($greetingTypes as $key => $value) {
             if (!array_key_exists($key, $params)) {
                 $params[$key] = CRM_Contact_BAO_Contact_Utils::defaultGreeting($profileType, $key);
             }
         }
     }
     $transaction = new CRM_Core_Transaction();
     //used to send subscribe mail to the group which user want.
     //if the profile double option in is enabled
     $mailingType = array();
     $result = NULL;
     foreach ($params as $name => $values) {
         if (substr($name, 0, 6) == 'email-') {
             $result['email'] = $values;
         }
     }
     //array of group id, subscribed by contact
     $contactGroup = array();
     if (!empty($params['group']) && CRM_Core_BAO_UFGroup::isProfileDoubleOptin()) {
         $groupSubscribed = array();
         if (!empty($result['email'])) {
             if ($this->_id) {
                 $contactGroups = new CRM_Contact_DAO_GroupContact();
                 $contactGroups->contact_id = $this->_id;
                 $contactGroups->status = 'Added';
                 $contactGroups->find();
                 $contactGroup = array();
                 while ($contactGroups->fetch()) {
                     $contactGroup[] = $contactGroups->group_id;
                     $groupSubscribed[$contactGroups->group_id] = 1;
                 }
             }
             foreach ($params['group'] as $key => $val) {
                 if (!$val) {
                     unset($params['group'][$key]);
                     continue;
                 }
                 $groupTypes = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $key, 'group_type', 'id');
                 $groupType = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($groupTypes, 1, -1));
                 //filter group of mailing type and unset it from params
                 if (in_array(2, $groupType)) {
                     //if group is already subscribed , ignore it
                     $groupExist = CRM_Utils_Array::key($key, $contactGroup);
                     if (!isset($groupExist)) {
                         $mailingType[] = $key;
                         unset($params['group'][$key]);
                     }
                 }
             }
         }
//.........这里部分代码省略.........
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:101,代码来源:Form.php

示例6: setTemplateValues

 /**
  * Set the post action values for the block.
  *
  * php is lame and u cannot call functions from static initializers
  * hence this hack
  *
  * @param int $id
  *
  * @return void
  */
 private static function setTemplateValues($id)
 {
     switch ($id) {
         case self::CREATE_NEW:
             self::setTemplateShortcutValues();
             break;
         case self::DASHBOARD:
             self::setTemplateDashboardValues();
             break;
         case self::ADD:
             $defaultLocation = CRM_Core_BAO_LocationType::getDefault();
             $defaultPrimaryLocationId = $defaultLocation->id;
             $values = array('postURL' => CRM_Utils_System::url('civicrm/contact/add', 'reset=1&ct=Individual'), 'primaryLocationType' => $defaultPrimaryLocationId);
             foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) {
                 $values[$greeting . '_id'] = CRM_Contact_BAO_Contact_Utils::defaultGreeting('Individual', $greeting);
             }
             self::setProperty(self::ADD, 'templateValues', $values);
             break;
         case self::LANGSWITCH:
             // gives the currentPath without trailing empty lcMessages to be completed
             $values = array('queryString' => CRM_Utils_System::getLinksUrl('lcMessages', TRUE, FALSE, FALSE));
             self::setProperty(self::LANGSWITCH, 'templateValues', $values);
             break;
         case self::FULLTEXT_SEARCH:
             $urlArray = array('fullTextSearchID' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', 'CRM_Contact_Form_Search_Custom_FullText', 'value', 'name'));
             self::setProperty(self::FULLTEXT_SEARCH, 'templateValues', $urlArray);
             break;
         case self::RECENTLY_VIEWED:
             $recent = CRM_Utils_Recent::get();
             self::setProperty(self::RECENTLY_VIEWED, 'templateValues', array('recentlyViewed' => $recent));
             break;
         case self::EVENT:
             self::setTemplateEventValues();
             break;
     }
 }
开发者ID:utkarshsharma,项目名称:civicrm-core,代码行数:46,代码来源:Block.php

示例7: setDefaultValues

 /**
  * This function sets the default values for the form. Note that in edit/view mode
  * the default values are retrieved from the database
  *
  * @access public
  *
  * @return None
  */
 function setDefaultValues(&$form, &$defaults)
 {
     if (!empty($defaults['preferred_language'])) {
         $languages = array_flip(CRM_Core_PseudoConstant::languages());
         $defaults['preferred_language'] = $languages[$defaults['preferred_language']];
     }
     // CRM-7119: set preferred_language to default if unset
     if (empty($defaults['preferred_language'])) {
         $config = CRM_Core_Config::singleton();
         $defaults['preferred_language'] = $config->lcMessages;
     }
     //set default from greeting types CRM-4575, CRM-9739
     if ($form->_action & CRM_Core_Action::ADD) {
         foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) {
             if (empty($defaults[$greeting . '_id'])) {
                 if ($defaultGreetingTypeId = CRM_Contact_BAO_Contact_Utils::defaultGreeting($form->_contactType, $greeting)) {
                     $defaults[$greeting . '_id'] = $defaultGreetingTypeId;
                 }
             }
         }
     } else {
         foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) {
             $name = "{$greeting}_display";
             $form->assign($name, CRM_Utils_Array::value($name, $defaults));
         }
     }
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:35,代码来源:CommunicationPreferences.php

示例8: updateContactFields

 /**
  * Update contact fields.
  *
  * @param int $contactID
  * @param array $params
  * @param array $fields
  * @param CRM_Core_Form $form
  *
  * @return int
  */
 public static function updateContactFields($contactID, $params, $fields, &$form)
 {
     //add the contact to group, if add to group is selected for a
     //particular uf group
     // get the add to groups
     $addToGroups = array();
     if (!empty($form->_fields)) {
         foreach ($form->_fields as $key => $value) {
             if (!empty($value['add_to_group_id'])) {
                 $addToGroups[$value['add_to_group_id']] = $value['add_to_group_id'];
             }
         }
     }
     // check for profile double opt-in and get groups to be subscribed
     $subscribeGroupIds = CRM_Core_BAO_UFGroup::getDoubleOptInGroupIds($params, $contactID);
     foreach ($addToGroups as $k) {
         if (array_key_exists($k, $subscribeGroupIds)) {
             unset($addToGroups[$k]);
         }
     }
     // since we are directly adding contact to group lets unset it from mailing
     if (!empty($addToGroups)) {
         foreach ($addToGroups as $groupId) {
             if (isset($subscribeGroupIds[$groupId])) {
                 unset($subscribeGroupIds[$groupId]);
             }
         }
     }
     if ($contactID) {
         $ctype = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $contactID, 'contact_type');
         if (array_key_exists('contact_id', $params) && empty($params['contact_id'])) {
             // we unset this here because the downstream function ignores the contactID we give it
             // if it is set & it is difficult to understand the implications of 'fixing' this downstream
             // but if we are passing a contact id into this function it's reasonable to assume we don't
             // want it ignored
             unset($params['contact_id']);
         }
         $contactID = CRM_Contact_BAO_Contact::createProfileContact($params, $fields, $contactID, $addToGroups, NULL, $ctype, TRUE);
     } else {
         foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) {
             if (!isset($params[$greeting . '_id'])) {
                 $params[$greeting . '_id'] = CRM_Contact_BAO_Contact_Utils::defaultGreeting('Individual', $greeting);
             }
         }
         $contactID = CRM_Contact_BAO_Contact::createProfileContact($params, $fields, NULL, $addToGroups, NULL, NULL, TRUE);
         $form->set('contactID', $contactID);
     }
     //get email primary first if exist
     $subscribtionEmail = array('email' => CRM_Utils_Array::value('email-Primary', $params));
     if (!$subscribtionEmail['email']) {
         $subscribtionEmail['email'] = CRM_Utils_Array::value("email-{$form->_bltID}", $params);
     }
     // subscribing contact to groups
     if (!empty($subscribeGroupIds) && $subscribtionEmail['email']) {
         CRM_Mailing_Event_BAO_Subscribe::commonSubscribe($subscribeGroupIds, $subscribtionEmail, $contactID);
     }
     return $contactID;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:68,代码来源:Confirm.php

示例9: updateContactFields

 /**
  * function to update contact fields
  *
  * @return void
  * @access public
  */
 public function updateContactFields($contactID, $params, $fields)
 {
     //add the contact to group, if add to group is selected for a
     //particular uf group
     // get the add to groups
     $addToGroups = array();
     if (!empty($this->_fields)) {
         foreach ($this->_fields as $key => $value) {
             if (CRM_Utils_Array::value('add_to_group_id', $value)) {
                 $addToGroups[$value['add_to_group_id']] = $value['add_to_group_id'];
             }
         }
     }
     // check for profile double opt-in and get groups to be subscribed
     $subscribeGroupIds = CRM_Core_BAO_UFGroup::getDoubleOptInGroupIds($params, $contactID);
     foreach ($addToGroups as $k) {
         if (array_key_exists($k, $subscribeGroupIds)) {
             unset($addToGroups[$k]);
         }
     }
     // since we are directly adding contact to group lets unset it from mailing
     if (!empty($addToGroups)) {
         foreach ($addToGroups as $groupId) {
             if (isset($subscribeGroupIds[$groupId])) {
                 unset($subscribeGroupIds[$groupId]);
             }
         }
     }
     if ($contactID) {
         $ctype = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $contactID, 'contact_type');
         $contactID =& CRM_Contact_BAO_Contact::createProfileContact($params, $fields, $contactID, $addToGroups, NULL, $ctype, TRUE);
     } else {
         foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) {
             if (!isset($params[$greeting . '_id'])) {
                 $params[$greeting . '_id'] = CRM_Contact_BAO_Contact_Utils::defaultGreeting('Individual', $greeting);
             }
         }
         $contactID = CRM_Contact_BAO_Contact::createProfileContact($params, $fields, NULL, $addToGroups, NULL, NULL, TRUE);
         $this->set('contactID', $contactID);
     }
     //get email primary first if exist
     $subscribtionEmail = array('email' => CRM_Utils_Array::value('email-Primary', $params));
     if (!$subscribtionEmail['email']) {
         $subscribtionEmail['email'] = CRM_Utils_Array::value("email-{$this->_bltID}", $params);
     }
     // subscribing contact to groups
     if (!empty($subscribeGroupIds) && $subscribtionEmail['email']) {
         CRM_Mailing_Event_BAO_Subscribe::commonSubscribe($subscribeGroupIds, $subscribtionEmail, $contactID);
     }
     return $contactID;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:57,代码来源:Confirm.php


注:本文中的CRM_Contact_BAO_Contact_Utils::defaultGreeting方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。