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


PHP CRM_Contact_BAO_GroupContact类代码示例

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


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

示例1: browse

 /**
  * called when action is browse.
  *
  */
 public function browse()
 {
     $in = CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, 'Added');
     // keep track of all 'added' contact groups so we can remove them from the smart group
     // section
     $staticGroups = array();
     if (!empty($in)) {
         foreach ($in as $group) {
             $staticGroups[$group['group_id']] = 1;
         }
     }
     $allGroup = CRM_Contact_BAO_GroupContactCache::contactGroup($this->_contactId);
     $this->assign('groupSmart', NULL);
     $this->assign('groupParent', NULL);
     if (!empty($allGroup)) {
         $smart = $parent = array();
         foreach ($allGroup['group'] as $group) {
             // delete all smart groups which are also in static groups
             if (isset($staticGroups[$group['id']])) {
                 continue;
             }
             if (empty($group['children'])) {
                 $smart[] = $group;
             } else {
                 $parent[] = $group;
             }
         }
         if (!empty($smart)) {
             $this->assign_by_ref('groupSmart', $smart);
         }
         if (!empty($parent)) {
             $this->assign_by_ref('groupParent', $parent);
         }
     }
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:39,代码来源:ContactSmartGroup.php

示例2: browse

 /**
  * called when action is browse.
  *
  * @return void
  */
 public function browse()
 {
     $count = CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, NULL, NULL, TRUE, TRUE, $this->_onlyPublicGroups);
     $in =& CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, 'Added', NULL, FALSE, TRUE, $this->_onlyPublicGroups);
     $pending =& CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, 'Pending', NULL, FALSE, TRUE, $this->_onlyPublicGroups);
     $out =& CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, 'Removed', NULL, FALSE, TRUE, $this->_onlyPublicGroups);
     $this->assign('groupCount', $count);
     $this->assign_by_ref('groupIn', $in);
     $this->assign_by_ref('groupPending', $pending);
     $this->assign_by_ref('groupOut', $out);
 }
开发者ID:kidaa30,项目名称:yes,代码行数:16,代码来源:GroupContact.php

示例3: confirm

 /**
  * Confirm a pending subscription
  *
  * @param int $contact_id       The id of the contact
  * @param int $subscribe_id     The id of the subscription event
  * @param string $hash          The hash
  *
  * @return boolean              True on success
  * @access public
  * @static
  */
 public static function confirm($contact_id, $subscribe_id, $hash)
 {
     $se =& CRM_Mailing_Event_BAO_Subscribe::verify($contact_id, $subscribe_id, $hash);
     if (!$se) {
         return FALSE;
     }
     // before we proceed lets just check if this contact is already 'Added'
     // if so, we should ignore this request and hence avoid sending multiple
     // emails - CRM-11157
     $details = CRM_Contact_BAO_GroupContact::getMembershipDetail($contact_id, $se->group_id);
     if ($details && $details->status == 'Added') {
         // This contact is already subscribed
         // lets return the group title
         return CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $se->group_id, 'title');
     }
     $transaction = new CRM_Core_Transaction();
     $ce = new CRM_Mailing_Event_BAO_Confirm();
     $ce->event_subscribe_id = $se->id;
     $ce->time_stamp = date('YmdHis');
     $ce->save();
     CRM_Contact_BAO_GroupContact::addContactsToGroup(array($contact_id), $se->group_id, 'Email', 'Added', $ce->id);
     $transaction->commit();
     $config = CRM_Core_Config::singleton();
     $domain = CRM_Core_BAO_Domain::getDomain();
     list($domainEmailName, $_) = CRM_Core_BAO_Domain::getNameAndEmail();
     list($display_name, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($se->contact_id);
     $group = new CRM_Contact_DAO_Group();
     $group->id = $se->group_id;
     $group->find(TRUE);
     $component = new CRM_Mailing_BAO_Component();
     $component->is_default = 1;
     $component->is_active = 1;
     $component->component_type = 'Welcome';
     $component->find(TRUE);
     $emailDomain = CRM_Core_BAO_MailSettings::defaultDomain();
     $html = $component->body_html;
     if ($component->body_text) {
         $text = $component->body_text;
     } else {
         $text = CRM_Utils_String::htmlToText($component->body_html);
     }
     $bao = new CRM_Mailing_BAO_Mailing();
     $bao->body_text = $text;
     $bao->body_html = $html;
     $tokens = $bao->getTokens();
     $html = CRM_Utils_Token::replaceDomainTokens($html, $domain, TRUE, $tokens['html']);
     $html = CRM_Utils_Token::replaceWelcomeTokens($html, $group->title, TRUE);
     $text = CRM_Utils_Token::replaceDomainTokens($text, $domain, FALSE, $tokens['text']);
     $text = CRM_Utils_Token::replaceWelcomeTokens($text, $group->title, FALSE);
     $mailParams = array('groupName' => 'Mailing Event ' . $component->component_type, 'subject' => $component->subject, 'from' => "\"{$domainEmailName}\" <do-not-reply@{$emailDomain}>", 'toEmail' => $email, 'toName' => $display_name, 'replyTo' => "do-not-reply@{$emailDomain}", 'returnPath' => "do-not-reply@{$emailDomain}", 'html' => $html, 'text' => $text);
     // send - ignore errors because the desired status change has already been successful
     $unused_result = CRM_Utils_Mail::send($mailParams);
     return $group->title;
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:65,代码来源:Confirm.php

示例4: postProcess

 /**
  * Process the form after the input has been submitted and validated.
  */
 public function postProcess()
 {
     $groupId = $this->controller->exportValue('RemoveFromGroup', 'group_id');
     $group = CRM_Core_PseudoConstant::group();
     list($total, $removed, $notRemoved) = CRM_Contact_BAO_GroupContact::removeContactsFromGroup($this->_contactIds, $groupId);
     $status = array(ts("%count contact removed from '%2'", array('count' => $removed, 'plural' => "%count contacts removed from '%2'", 2 => $group[$groupId])));
     if ($notRemoved) {
         $status[] = ts('1 contact was already not in this group', array('count' => $notRemoved, 'plural' => '%count contacts were already not in this group'));
     }
     $status = '<ul><li>' . implode('</li><li>', $status) . '</li></ul>';
     CRM_Core_Session::setStatus($status, ts("Removed Contact From Group", array('plural' => "Removed Contacts From Group", 'count' => $removed)), 'success', array('expires' => 0));
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:15,代码来源:RemoveFromGroup.php

示例5: testForceCiviToMailchimpSyncNullEmail

 function testForceCiviToMailchimpSyncNullEmail()
 {
     $mailchimp_sync_setting = CRM_CiviMailchimp_BAO_SyncSettingsTest::createTestGroupAndSyncSettings('Test Group testForceCiviToMailchimpSyncNullEmail');
     $params = CRM_CiviMailchimp_UtilsTest::sampleContactParams();
     unset($params['email']);
     $contact = CRM_Contact_BAO_Contact::create($params);
     $contact_ids = array($contact->id);
     CRM_Contact_BAO_GroupContact::addContactsToGroup($contact_ids, $mailchimp_sync_setting->civicrm_group_id);
     $contacts = CRM_CiviMailchimp_Form_Sync::forceCiviToMailchimpSync($mailchimp_sync_setting);
     $mailchimp_api_subscribe = civimailchimp_static('mailchimp_api_subscribe');
     $this->assertCount(0, $contacts);
     $this->assertNull($mailchimp_api_subscribe);
 }
开发者ID:jaapjansma,项目名称:com.giantrabbit.civimailchimp,代码行数:13,代码来源:SyncTest.php

示例6: contactIsMemberOfAllGroups

 protected function contactIsMemberOfAllGroups($contact_id, $group_ids)
 {
     $isValid = 0;
     foreach ($group_ids as $gid) {
         if (CRM_Contact_BAO_GroupContact::isContactInGroup($contact_id, $gid)) {
             $isValid++;
         }
     }
     if (count($group_ids) == $isValid && count($group_ids) > 0) {
         return true;
     }
     return false;
 }
开发者ID:Kajakaran,项目名称:org.civicoop.civirules,代码行数:13,代码来源:InGroup.php

示例7: postProcess

 /**
  * process the form after the input has been submitted and validated
  *
  * @access public
  * @return None
  */
 function postProcess()
 {
     $groupId = $this->controller->exportValue('RemoveFromGroup', 'group_id');
     $group =& CRM_Core_PseudoConstant::group();
     list($total, $removed, $notRemoved) = CRM_Contact_BAO_GroupContact::removeContactsFromGroup($this->_contactIds, $groupId);
     $status = array(ts('Removed Contact(s) from %1', array(1 => $group[$groupId])), ts('Total Selected Contact(s): %1', array(1 => $total)));
     if ($removed) {
         $status[] = ts('Total Contact(s) removed from group: %1', array(1 => $removed));
     }
     if ($notRemoved) {
         $status[] = ts('Total Contact(s) not in group: %1', array(1 => $notRemoved));
     }
     CRM_Core_Session::setStatus($status);
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:20,代码来源:RemoveFromGroup.php

示例8: testFindByContactId

 function testFindByContactId()
 {
     $expected_mailchimp_sync_setting = self::createTestGroupAndSyncSettings('Test group testFindByContactId');
     $params = CRM_CiviMailchimp_UtilsTest::sampleContactParams();
     $contact = CRM_Contact_BAO_Contact::create($params);
     $contact_ids = array($contact->id);
     CRM_Contact_BAO_GroupContact::addContactsToGroup($contact_ids, $expected_mailchimp_sync_setting->civicrm_group_id);
     $mailchimp_sync_settings = CRM_CiviMailchimp_BAO_SyncSettings::findByContactId($contact->id);
     $mailchimp_sync_setting = $mailchimp_sync_settings[$expected_mailchimp_sync_setting->civicrm_group_id];
     $this->assertEquals($expected_mailchimp_sync_setting->id, $mailchimp_sync_setting->id);
     $this->assertEquals($expected_mailchimp_sync_setting->civicrm_group_id, $mailchimp_sync_setting->civicrm_group_id);
     $this->assertEquals($expected_mailchimp_sync_setting->mailchimp_list_id, $mailchimp_sync_setting->mailchimp_list_id);
     $this->assertEquals($expected_mailchimp_sync_setting->mailchimp_interest_groups, $mailchimp_sync_setting->mailchimp_interest_groups);
 }
开发者ID:jaapjansma,项目名称:com.giantrabbit.civimailchimp,代码行数:14,代码来源:SyncSettingsTest.php

示例9: confirm

 /**
  * Confirm a pending subscription
  *
  * @param int $contact_id       The id of the contact
  * @param int $subscribe_id     The id of the subscription event
  * @param string $hash          The hash
  * @return boolean              True on success
  * @access public
  * @static
  */
 function confirm($contact_id, $subscribe_id, $hash)
 {
     $se =& CRM_Mailing_Event_BAO_Subscribe::verify($contact_id, $subscribe_id, $hash);
     if (!$se) {
         return false;
     }
     CRM_Core_DAO::transaction('BEGIN');
     $ce =& new CRM_Mailing_Event_BAO_Confirm();
     $ce->event_subscribe_id = $se->id;
     $ce->time_stamp = date('YmdHis');
     $ce->save();
     CRM_Contact_BAO_GroupContact::updateGroupMembershipStatus($contact_id, $se->group_id, 'Email', $ce->id);
     CRM_Core_DAO::transaction('COMMIT');
     $config =& CRM_Core_Config::singleton();
     $domain =& CRM_Mailing_Event_BAO_Subscribe::getDomain($subscribe_id);
     list($display_name, $email) = CRM_Contact_BAO_Contact::getEmailDetails($se->contact_id);
     $group =& new CRM_Contact_DAO_Group();
     $group->id = $se->group_id;
     $group->find(true);
     require_once 'CRM/Mailing/BAO/Component.php';
     $component =& new CRM_Mailing_BAO_Component();
     $component->domain_id = $domain->id;
     $component->is_default = 1;
     $component->is_active = 1;
     $component->component_type = 'Welcome';
     $component->find(true);
     $headers = array('Subject' => $component->subject, 'From' => ts('"%1 Administrator" <do-not-reply@%2>', array(1 => $domain->name, 2 => $domain->email_domain)), 'To' => $email, 'Reply-To' => "do-not-reply@{$domain->email_domain}", 'Return-Path' => "do-not-reply@{$domain->email_domain}");
     $html = $component->body_html;
     require_once 'CRM/Utils/Token.php';
     $html = CRM_Utils_Token::replaceDomainTokens($html, $domain, true);
     $html = CRM_Utils_Token::replaceWelcomeTokens($html, $group->name, true);
     $text = $component->body_text;
     $text = CRM_Utils_Token::replaceDomainTokens($text, $domain, false);
     $text = CRM_Utils_Token::replaceWelcomeTokens($text, $group->name, false);
     $message =& new Mail_Mime("\n");
     $message->setHTMLBody($html);
     $message->setTxtBody($text);
     $b = $message->get();
     $h = $message->headers($headers);
     $mailer =& $config->getMailer();
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array('CRM_Mailing_BAO_Mailing', 'catchSMTP'));
     $mailer->send($email, $h, $b);
     CRM_Core_Error::setCallback();
     return true;
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:55,代码来源:Confirm.php

示例10: getGroups

 /**
  * Method to get groups
  *
  * @return array
  * @access protected
  */
 protected function getGroups()
 {
     return array('' => ts('-- please select --')) + CRM_Contact_BAO_GroupContact::getGroupList();
 }
开发者ID:alejandro-ixiam,项目名称:org.civicoop.civirules,代码行数:10,代码来源:GroupId.php

示例11: add2group

 /**
  * @param int $groupID
  */
 public function add2group($groupID)
 {
     if (is_numeric($groupID)) {
         $sql = "\n{$this->_select} {$this->_from}  {$this->_where} {$this->_groupBy}\nORDER BY civicrm_contribution_total_amount_sum DESC\n) as abc {$this->_groupLimit}";
         $dao = CRM_Core_DAO::executeQuery($sql);
         $contact_ids = array();
         // Add resulting contacts to group
         while ($dao->fetch()) {
             $contact_ids[$dao->civicrm_contact_id] = $dao->civicrm_contact_id;
         }
         CRM_Contact_BAO_GroupContact::addContactsToGroup($contact_ids, $groupID);
         CRM_Core_Session::setStatus(ts("Listed contact(s) have been added to the selected group."), ts('Contacts Added'), 'success');
     }
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:17,代码来源:TopDonor.php

示例12: civicrm_api3_group_contact_update_status

/**
 * Update group contact status.
 *
 * @deprecated - this should be part of create but need to know we aren't missing something
 *
 * @param array $params
 *
 * @return bool
 * @throws \API_Exception
 */
function civicrm_api3_group_contact_update_status($params)
{
    civicrm_api3_verify_mandatory($params, NULL, array('contact_id', 'group_id'));
    CRM_Contact_BAO_GroupContact::addContactsToGroup(array($params['contact_id']), $params['group_id'], CRM_Utils_Array::value('method', $params, 'API'), 'Added', CRM_Utils_Array::value('tracking', $params));
    return TRUE;
}
开发者ID:utkarshsharma,项目名称:civicrm-core,代码行数:16,代码来源:GroupContact.php

示例13: displayProfile


//.........这里部分代码省略.........
                         if ('gender' == substr($name, 0, 6)) {
                             $gender = CRM_Core_PseudoConstant::gender();
                             $values[$index] = $gender[$params[$name]];
                         } else {
                             if ('individual_prefix' == substr($name, 0, 17)) {
                                 $prefix = CRM_Core_PseudoConstant::individualPrefix();
                                 $values[$index] = $prefix[$params[$name]];
                             } else {
                                 if ('individual_suffix' == substr($name, 0, 17)) {
                                     $suffix = CRM_Core_PseudoConstant::individualSuffix();
                                     $values[$index] = $suffix[$params[$name]];
                                 } else {
                                     if (in_array($name, array('addressee', 'email_greeting', 'postal_greeting'))) {
                                         $filterCondition = array('greeting_type' => $name);
                                         $greeting =& CRM_Core_PseudoConstant::greeting($filterCondition);
                                         $values[$index] = $greeting[$params[$name]];
                                     } else {
                                         if ($name === 'preferred_communication_method') {
                                             $communicationFields = CRM_Core_PseudoConstant::pcm();
                                             $pref = array();
                                             $compref = array();
                                             $pref = $params[$name];
                                             if (is_array($pref)) {
                                                 foreach ($pref as $k => $v) {
                                                     if ($v) {
                                                         $compref[] = $communicationFields[$k];
                                                     }
                                                 }
                                             }
                                             $values[$index] = implode(",", $compref);
                                         } else {
                                             if ($name == 'group') {
                                                 require_once 'CRM/Contact/BAO/GroupContact.php';
                                                 $groups = CRM_Contact_BAO_GroupContact::getGroupList();
                                                 $title = array();
                                                 foreach ($params[$name] as $gId => $dontCare) {
                                                     if ($dontCare) {
                                                         $title[] = $groups[$gId];
                                                     }
                                                 }
                                                 $values[$index] = implode(', ', $title);
                                             } else {
                                                 if ($name == 'tag') {
                                                     require_once 'CRM/Core/BAO/EntityTag.php';
                                                     $entityTags = $params[$name];
                                                     $allTags =& CRM_Core_PseudoConstant::tag();
                                                     $title = array();
                                                     if (is_array($entityTags)) {
                                                         foreach ($entityTags as $tagId => $dontCare) {
                                                             $title[] = $allTags[$tagId];
                                                         }
                                                     }
                                                     $values[$index] = implode(', ', $title);
                                                 } else {
                                                     if ('participant_role_id' == $name) {
                                                         $roles = CRM_Event_PseudoConstant::participantRole();
                                                         $values[$index] = $roles[$params[$name]];
                                                     } else {
                                                         if ('participant_status_id' == $name) {
                                                             $status = CRM_Event_PseudoConstant::participantStatus();
                                                             $values[$index] = $status[$params[$name]];
                                                         } else {
                                                             if (strpos($name, '-') !== false) {
                                                                 list($fieldName, $id) = CRM_Utils_System::explode('-', $name, 2);
                                                                 $detailName = str_replace(' ', '_', $name);
                                                                 if (in_array($fieldName, array('state_province', 'country', 'county'))) {
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:67,代码来源:Event.php

示例14: run

 /**
  * Run the page.
  *
  * This method is called after the page is created. It checks for the
  * type of action and executes that action.
  *
  * @return void
  */
 public function run()
 {
     $template = CRM_Core_Smarty::singleton();
     if ($this->_id && $this->_gid) {
         // first check that id is part of the limit group id, CRM-4822
         $limitListingsGroupsID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'limit_listings_group_id');
         $config = CRM_Core_Config::singleton();
         if ($limitListingsGroupsID) {
             if (!CRM_Contact_BAO_GroupContact::isContactInGroup($this->_id, $limitListingsGroupsID)) {
                 CRM_Utils_System::setTitle(ts('Profile View - Permission Denied'));
                 return CRM_Core_Session::setStatus(ts('You do not have permission to view this contact record. Contact the site administrator if you need assistance.'), ts('Permission Denied'), 'error');
             }
         }
         $session = CRM_Core_Session::singleton();
         $userID = $session->get('userID');
         $this->_isPermissionedChecksum = $allowPermission = FALSE;
         $permissionType = CRM_Core_Permission::VIEW;
         if (CRM_Core_Permission::check('administer users') || CRM_Core_Permission::check('view all contacts') || CRM_Contact_BAO_Contact_Permission::allow($this->_id)) {
             $allowPermission = TRUE;
         }
         if ($this->_id != $userID) {
             // do not allow edit for anon users in joomla frontend, CRM-4668, unless u have checksum CRM-5228
             if ($config->userFrameworkFrontend) {
                 $this->_isPermissionedChecksum = CRM_Contact_BAO_Contact_Permission::validateOnlyChecksum($this->_id, $this, FALSE);
                 if (!$this->_isPermissionedChecksum) {
                     $this->_isPermissionedChecksum = $allowPermission;
                 }
             } else {
                 $this->_isPermissionedChecksum = CRM_Contact_BAO_Contact_Permission::validateChecksumContact($this->_id, $this, FALSE);
             }
         }
         // CRM-10853
         // Users with create or edit permission should be allowed to view their own profile
         if ($this->_id == $userID || $this->_isPermissionedChecksum) {
             if (!CRM_Core_Permission::check('profile view')) {
                 if (CRM_Core_Permission::check('profile create') || CRM_Core_Permission::check('profile edit')) {
                     $this->_skipPermission = TRUE;
                 }
             }
         }
         // make sure we dont expose all fields based on permission
         $admin = FALSE;
         if (!$config->userFrameworkFrontend && $allowPermission || $this->_id == $userID || $this->_isPermissionedChecksum) {
             $admin = TRUE;
         }
         $values = array();
         $fields = CRM_Core_BAO_UFGroup::getFields($this->_profileIds, FALSE, CRM_Core_Action::VIEW, NULL, NULL, FALSE, $this->_restrict, $this->_skipPermission, NULL, $permissionType);
         if ($this->_multiRecord & CRM_Core_Action::VIEW && $this->_recordId && !$this->_allFields) {
             CRM_Core_BAO_UFGroup::shiftMultiRecordFields($fields, $multiRecordFields);
             $fields = $multiRecordFields;
         }
         if ($this->_isContactActivityProfile && $this->_gid) {
             $errors = CRM_Profile_Form::validateContactActivityProfile($this->_activityId, $this->_id, $this->_gid);
             if (!empty($errors)) {
                 CRM_Core_Error::fatal(array_pop($errors));
             }
         }
         //reformat fields array
         foreach ($fields as $name => $field) {
             // also eliminate all formatting fields
             if (CRM_Utils_Array::value('field_type', $field) == 'Formatting') {
                 unset($fields[$name]);
             }
             // make sure that there is enough permission to expose this field
             if (!$admin && $field['visibility'] == 'User and User Admin Only') {
                 unset($fields[$name]);
             }
         }
         if ($this->_isContactActivityProfile) {
             $contactFields = $activityFields = array();
             foreach ($fields as $fieldName => $field) {
                 if (CRM_Utils_Array::value('field_type', $field) == 'Activity') {
                     $activityFields[$fieldName] = $field;
                 } else {
                     $contactFields[$fieldName] = $field;
                 }
             }
             CRM_Core_BAO_UFGroup::getValues($this->_id, $contactFields, $values);
             if ($this->_activityId) {
                 CRM_Core_BAO_UFGroup::getValues(NULL, $activityFields, $values, TRUE, array(array('activity_id', '=', $this->_activityId, 0, 0)));
             }
         } else {
             $customWhereClause = NULL;
             if ($this->_multiRecord & CRM_Core_Action::VIEW && $this->_recordId) {
                 if ($this->_allFields) {
                     $copyFields = $fields;
                     CRM_Core_BAO_UFGroup::shiftMultiRecordFields($copyFields, $multiRecordFields);
                     $fieldKey = key($multiRecordFields);
                 } else {
                     $fieldKey = key($fields);
                 }
                 if ($fieldID = CRM_Core_BAO_CustomField::getKeyID($fieldKey)) {
//.........这里部分代码省略.........
开发者ID:sarehag,项目名称:civicrm-core,代码行数:101,代码来源:Dynamic.php

示例15: postProcessOld


//.........这里部分代码省略.........
             }
         } else {
             if (isset($mapFields[$mapper[$key][0]])) {
                 $header[] = $mapFields[$mapper[$key][0]];
                 if (isset($mapper[$key][1])) {
                     $header[] = $locationTypes[$mapper[$key][1]];
                 }
                 if (isset($mapper[$key][2])) {
                     $header[] = $phoneTypes[$mapper[$key][2]];
                 }
             }
         }
         $mapperFields[] = implode(' - ', $header);
     }
     $tableName = $this->get('importTableName');
     //print "Running parser on table: $tableName<br/>";
     $parser->run($tableName, $mapperFields, CRM_Import_Parser::MODE_IMPORT, $this->get('contactType'), $this->get('primaryKeyName'), $this->get('statusFieldName'), $onDuplicate, $this->get('statusID'), $this->get('totalRowCount'), $doGeocodeAddress, CRM_Contact_Import_Parser::DEFAULT_TIMEOUT, $this->get('contactSubType'), $this->get('dedupe'));
     // add the new contacts to selected groups
     $contactIds =& $parser->getImportedContacts();
     // add the new related contacts to selected groups
     $relatedContactIds =& $parser->getRelatedImportedContacts();
     $this->set('relatedCount', count($relatedContactIds));
     $newGroupId = NULL;
     //changed below if-statement "if ($newGroup) {" to "if ($newGroupName) {"
     if ($newGroupName) {
         /* Create a new group */
         $gParams = array('name' => $newGroupName, 'title' => $newGroupName, 'description' => $newGroupDesc, 'is_active' => TRUE);
         $group = CRM_Contact_BAO_Group::create($gParams);
         $groups[] = $newGroupId = $group->id;
     }
     if (is_array($groups)) {
         $groupAdditions = array();
         foreach ($groups as $groupId) {
             $addCount = CRM_Contact_BAO_GroupContact::addContactsToGroup($contactIds, $groupId);
             if (!empty($relatedContactIds)) {
                 $addRelCount = CRM_Contact_BAO_GroupContact::addContactsToGroup($relatedContactIds, $groupId);
             }
             $totalCount = $addCount[1] + $addRelCount[1];
             if ($groupId == $newGroupId) {
                 $name = $newGroupName;
                 $new = TRUE;
             } else {
                 $name = $allGroups[$groupId];
                 $new = FALSE;
             }
             $groupAdditions[] = array('url' => CRM_Utils_System::url('civicrm/group/search', 'reset=1&force=1&context=smog&gid=' . $groupId), 'name' => $name, 'added' => $totalCount, 'notAdded' => $addCount[2] + $addRelCount[2], 'new' => $new);
         }
         $this->set('groupAdditions', $groupAdditions);
     }
     $newTagId = NULL;
     if ($newTagName) {
         /* Create a new Tag */
         $tagParams = array('name' => $newTagName, 'title' => $newTagName, 'description' => $newTagDesc, 'is_active' => TRUE);
         $id = array();
         $addedTag = CRM_Core_BAO_Tag::add($tagParams, $id);
         $tag[$addedTag->id] = 1;
     }
     //add Tag to Import
     if (is_array($tag)) {
         $tagAdditions = array();
         foreach ($tag as $tagId => $val) {
             $addTagCount = CRM_Core_BAO_EntityTag::addContactsToTag($contactIds, $tagId);
             if (!empty($relatedContactIds)) {
                 $addRelTagCount = CRM_Core_BAO_EntityTag::addContactsToTag($relatedContactIds, $tagId);
             }
             $totalTagCount = $addTagCount[1] + $addRelTagCount[1];
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:67,代码来源:Preview.php


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