本文整理汇总了PHP中CRM_Core_BAO_UFGroup::getDoubleOptInGroupIds方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_UFGroup::getDoubleOptInGroupIds方法的具体用法?PHP CRM_Core_BAO_UFGroup::getDoubleOptInGroupIds怎么用?PHP CRM_Core_BAO_UFGroup::getDoubleOptInGroupIds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_UFGroup
的用法示例。
在下文中一共展示了CRM_Core_BAO_UFGroup::getDoubleOptInGroupIds方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
//.........这里部分代码省略.........
} elseif (!strstr($fld, '-')) {
if (in_array($fld, array('contribution_campaign_id', 'member_campaign_id'))) {
$fld = 'campaign_id';
} else {
$behalfOrganization[$fld] = $values;
}
$this->_params[$fld] = $values;
}
}
}
if (array_key_exists('onbehalf_location', $params) && is_array($params['onbehalf_location'])) {
foreach ($params['onbehalf_location'] as $block => $vals) {
//fix for custom data (of type checkbox, multi-select)
if (substr($block, 0, 7) == 'custom_') {
continue;
}
// fix the index of block elements
if (is_array($vals)) {
foreach ($vals as $key => $val) {
//dont adjust the index of address block as
//it's index is WRT to location type
$newKey = $block == 'address' ? $key : ++$key;
$behalfOrganization[$block][$newKey] = $val;
}
}
}
unset($params['onbehalf_location']);
}
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);
示例2: processFormSubmission
/**
* Post form submission handling.
*
* This is also called from the test suite.
*
* @param int $contactID
*
* @return array
*/
protected function processFormSubmission($contactID)
{
$isPayLater = $this->_params['is_pay_later'];
if (!isset($this->_params['payment_processor_id'])) {
// If there is no processor we are using the pay-later manual pseudo-processor.
// (note it might make sense to make this a row in the processor table in the db).
$this->_params['payment_processor_id'] = 0;
}
if (isset($this->_params['payment_processor_id']) && $this->_params['payment_processor_id'] == 0) {
$this->_params['is_pay_later'] = $isPayLater = TRUE;
}
// add a description field at the very beginning
$this->_params['description'] = ts('Online Contribution') . ': ' . ($this->_pcpInfo['title'] ? $this->_pcpInfo['title'] : $this->_values['title']);
$this->_params['accountingCode'] = CRM_Utils_Array::value('accountingCode', $this->_values);
// fix currency ID
$this->_params['currencyID'] = CRM_Core_Config::singleton()->defaultCurrency;
//carry payment processor id.
if (CRM_Utils_Array::value('id', $this->_paymentProcessor)) {
$this->_params['payment_processor_id'] = $this->_paymentProcessor['id'];
}
$premiumParams = $membershipParams = $params = $this->_params;
if (!empty($params['image_URL'])) {
CRM_Contact_BAO_Contact::processImageParams($params);
}
$fields = array('email-Primary' => 1);
// get the add to groups
$addToGroups = array();
// now set the values for the billing location.
foreach ($this->_fields as $name => $value) {
$fields[$name] = 1;
// get the add to groups for uf fields
if (!empty($value['add_to_group_id'])) {
$addToGroups[$value['add_to_group_id']] = $value['add_to_group_id'];
}
}
$fields = $this->formatParamsForPaymentProcessor($fields);
// billing email address
$fields["email-{$this->_bltID}"] = 1;
// if onbehalf-of-organization contribution, take out
// organization params in a separate variable, to make sure
// normal behavior is continued. And use that variable to
// process on-behalf-of functionality.
if (!empty($this->_values['onbehalf_profile_id'])) {
$behalfOrganization = array();
$orgFields = array('organization_name', 'organization_id', 'org_option');
foreach ($orgFields as $fld) {
if (array_key_exists($fld, $params)) {
$behalfOrganization[$fld] = $params[$fld];
unset($params[$fld]);
}
}
if (is_array($params['onbehalf']) && !empty($params['onbehalf'])) {
foreach ($params['onbehalf'] as $fld => $values) {
if (strstr($fld, 'custom_')) {
$behalfOrganization[$fld] = $values;
} elseif (!strstr($fld, '-')) {
if (in_array($fld, array('contribution_campaign_id', 'member_campaign_id'))) {
$fld = 'campaign_id';
} else {
$behalfOrganization[$fld] = $values;
}
$this->_params[$fld] = $values;
}
}
}
if (array_key_exists('onbehalf_location', $params) && is_array($params['onbehalf_location'])) {
foreach ($params['onbehalf_location'] as $block => $vals) {
//fix for custom data (of type checkbox, multi-select)
if (substr($block, 0, 7) == 'custom_') {
continue;
}
// fix the index of block elements
if (is_array($vals)) {
foreach ($vals as $key => $val) {
//dont adjust the index of address block as
//it's index is WRT to location type
$newKey = $block == 'address' ? $key : ++$key;
$behalfOrganization[$block][$newKey] = $val;
}
}
}
unset($params['onbehalf_location']);
}
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)) {
//.........这里部分代码省略.........
示例3: 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;
}
示例4: 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
require_once 'CRM/Core/BAO/UFGroup.php';
$subscribeGroupIds = CRM_Core_BAO_UFGroup::getDoubleOptInGroupIds($params, $contactID);
require_once "CRM/Contact/BAO/Contact.php";
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);
} else {
// when we have allow_same_participant_emails = 1
// don't take email address in dedupe params - CRM-4886
// here we are making dedupe weak - so to make dedupe
// more effective please update individual 'Strict' rule.
$allowSameEmailAddress = CRM_Utils_Array::value('allow_same_participant_emails', $this->_values['event']);
require_once 'CRM/Dedupe/Finder.php';
//suppress "email-Primary" when allow_same_participant_emails = 1
if ($allowSameEmailAddress && ($email = CRM_Utils_Array::value('email-Primary', $params)) && CRM_Utils_Array::value('registered_by_id', $params)) {
//skip dedupe check only for additional participants
unset($params['email-Primary']);
}
$dedupeParams = CRM_Dedupe_Finder::formatParams($params, 'Individual');
$ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams, 'Individual');
// if we find more than one contact, use the first one
$contact_id = $ids[0];
if (isset($email)) {
$params['email-Primary'] = $email;
}
$contactID =& CRM_Contact_BAO_Contact::createProfileContact($params, $fields, $contact_id, $addToGroups);
$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']) {
require_once 'CRM/Mailing/Event/BAO/Subscribe.php';
CRM_Mailing_Event_BAO_Subscribe::commonSubscribe($subscribeGroupIds, $subscribtionEmail, $contactID);
}
return $contactID;
}
示例5: 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;
}
示例6: 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
require_once 'CRM/Core/BAO/UFGroup.php';
$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]);
}
}
}
require_once "CRM/Contact/BAO/Contact.php";
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);
} else {
$contactID = CRM_Contact_BAO_Contact::createProfileContact($params, $fields, null, $addToGroups);
$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']) {
require_once 'CRM/Mailing/Event/BAO/Subscribe.php';
CRM_Mailing_Event_BAO_Subscribe::commonSubscribe($subscribeGroupIds, $subscribtionEmail, $contactID);
}
return $contactID;
}
示例7: postProcess
/**
* Process the form
*
* @return void
* @access public
*/
public function postProcess()
{
$config = CRM_Core_Config::singleton();
require_once 'CRM/Contact/BAO/Contact.php';
$contactID = $this->_userID;
// add a description field at the very beginning
$this->_params['description'] = ts('Online Contribution') . ': ' . ($this->_pcpInfo['title'] ? $this->_pcpInfo['title'] : $this->_values['title']);
// also add accounting code
$this->_params['accountingCode'] = CRM_Utils_Array::value('accountingCode', $this->_values);
// fix currency ID
$this->_params['currencyID'] = $config->defaultCurrency;
$premiumParams = $membershipParams = $tempParams = $params = $this->_params;
//carry payment processor id.
if ($paymentProcessorId = CRM_Utils_Array::value('id', $this->_paymentProcessor)) {
$this->_params['payment_processor_id'] = $paymentProcessorId;
foreach (array('premiumParams', 'membershipParams', 'tempParams', 'params') as $p) {
${$p}['payment_processor_id'] = $paymentProcessorId;
}
}
$now = date('YmdHis');
$fields = array();
if (CRM_Utils_Array::value('image_URL', $params)) {
CRM_Contact_BAO_Contact::processImageParams($params);
}
// set email for primary location.
$fields['email-Primary'] = 1;
// don't create primary email address, just add it to billing location
//$params["email-Primary"] = $params["email-{$this->_bltID}"];
// get the add to groups
$addToGroups = array();
// now set the values for the billing location.
foreach ($this->_fields as $name => $value) {
$fields[$name] = 1;
// get the add to groups for uf fields
if (CRM_Utils_Array::value('add_to_group_id', $value)) {
$addToGroups[$value['add_to_group_id']] = $value['add_to_group_id'];
}
}
if (!array_key_exists('first_name', $fields)) {
$nameFields = array('first_name', 'middle_name', 'last_name');
foreach ($nameFields as $name) {
$fields[$name] = 1;
if (array_key_exists("billing_{$name}", $params)) {
$params[$name] = $params["billing_{$name}"];
$params['preserveDBName'] = true;
}
}
}
// billing email address
$fields["email-{$this->_bltID}"] = 1;
//unset the billing parameters if it is pay later mode
//to avoid creation of billing location
if ($params['is_pay_later']) {
$billingFields = array('billing_first_name', 'billing_middle_name', 'billing_last_name', "billing_street_address-{$this->_bltID}", "billing_city-{$this->_bltID}", "billing_state_province-{$this->_bltID}", "billing_state_province_id-{$this->_bltID}", "billing_postal_code-{$this->_bltID}", "billing_country-{$this->_bltID}", "billing_country_id-{$this->_bltID}");
foreach ($billingFields as $value) {
unset($params[$value]);
unset($fields[$value]);
}
}
// if onbehalf-of-organization contribution, take out
// organization params in a separate variable, to make sure
// normal behavior is continued. And use that variable to
// process on-behalf-of functionality.
if (CRM_Utils_Array::value('is_for_organization', $this->_values)) {
$behalfOrganization = array();
foreach (array('organization_name', 'organization_id', 'org_option') as $fld) {
if (array_key_exists($fld, $params)) {
$behalfOrganization[$fld] = $params[$fld];
unset($params[$fld]);
}
}
if (array_key_exists('onbehalf_location', $params) && is_array($params['onbehalf_location'])) {
foreach ($params['onbehalf_location'] as $block => $vals) {
$behalfOrganization[$block] = $vals;
}
unset($params['onbehalf_location']);
}
}
// check for profile double opt-in and get groups to be subscribed
require_once 'CRM/Core/BAO/UFGroup.php';
$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]);
}
}
//.........这里部分代码省略.........