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


PHP CRM_Contact_BAO_GroupContact::isContactInGroup方法代码示例

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


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

示例1: testMailchimpWebhookUnsubscribe

 function testMailchimpWebhookUnsubscribe()
 {
     $sync_settings = CRM_CiviMailchimp_BAO_SyncSettingsTest::createTestGroupAndSyncSettings('test_group_mailchimp_webhook_unsubscribe');
     $sample_data = self::sampleRequestSubscribeOrProfileUpdate();
     $contact = CRM_CiviMailchimp_Utils::createContactFromMailchimpRequest($sample_data);
     CRM_Contact_BAO_GroupContact::addContactsToGroup(array($contact->id), $sync_settings->civicrm_group_id);
     CRM_CiviMailchimp_Page_Webhook::mailchimpWebhookUnsubscribe($sample_data);
     $this->assertFalse(CRM_Contact_BAO_GroupContact::isContactInGroup($contact->id, $sync_settings->civicrm_group_id));
 }
开发者ID:jaapjansma,项目名称:com.giantrabbit.civimailchimp,代码行数:9,代码来源:WebhookTest.php

示例2: 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

示例3: 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

示例4: testRemoveContactFromGroupMarkedAsNoBulkEmails

 function testRemoveContactFromGroupMarkedAsNoBulkEmails()
 {
     $no_bulk_emails_on_unsubscribe = CRM_Core_BAO_Setting::setItem(1, 'CiviMailchimp Preferences', 'mailchimp_no_bulk_emails_on_unsubscribe');
     $params = CRM_CiviMailchimp_UtilsTest::sampleContactParams();
     $contact = CRM_Contact_BAO_Contact::create($params);
     $mailchimp_sync_setting = CRM_CiviMailchimp_BAO_SyncSettingsTest::createTestGroupAndSyncSettings('Test group testRemoveContactFromGroupMarkedAsNoBulkEmails');
     // Test that the contact is in the group
     $contact_ids = array($contact->id);
     CRM_Contact_BAO_GroupContact::addContactsToGroup($contact_ids, $mailchimp_sync_setting->civicrm_group_id);
     $contact_added_to_group = CRM_Contact_BAO_GroupContact::isContactInGroup($contact->id, $mailchimp_sync_setting->civicrm_group_id);
     $this->assertTrue($contact_added_to_group);
     // Test that the contact is removed from the group
     CRM_CiviMailchimp_Utils::removeContactFromGroup($contact, $mailchimp_sync_setting->mailchimp_list_id);
     $contact_added_to_group = CRM_Contact_BAO_GroupContact::isContactInGroup($contact->id, $mailchimp_sync_setting->civicrm_group_id);
     $this->assertFalse($contact_added_to_group);
     // Test that contact is marked as No Bulk Emails
     $updated_contact = CRM_CiviMailchimp_Utils::getContactById($contact->id);
     $this->assertEquals(1, $updated_contact->is_opt_out);
 }
开发者ID:jaapjansma,项目名称:com.giantrabbit.civimailchimp,代码行数:19,代码来源:UtilsTest.php

示例5: 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
  * @access 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) {
             require_once 'CRM/Contact/BAO/GroupContact.php';
             if (!CRM_Contact_BAO_GroupContact::isContactInGroup($this->_id, $limitListingsGroupsID)) {
                 CRM_Core_Error::statusBounce(ts('You do not have permission to view this contact record. Contact the site administrator if you need assistance.'), $config->userFrameworkBaseURL);
             }
         }
         require_once 'CRM/Core/BAO/UFGroup.php';
         $values = array();
         $fields = CRM_Core_BAO_UFGroup::getFields($this->_gid, false, CRM_Core_Action::VIEW, null, null, false, $this->_restrict, $this->_skipPermission, null, CRM_Core_Permission::VIEW);
         // make sure we dont expose all fields based on permission
         $admin = false;
         $session =& CRM_Core_Session::singleton();
         if (!$config->userFrameworkFrontend && (CRM_Core_Permission::check('administer users') || CRM_Core_Permission::check('view all contacts')) || $this->_id == $session->get('userID')) {
             $admin = true;
         }
         if (!$admin) {
             foreach ($fields as $name => $field) {
                 // make sure that there is enough permission to expose this field
                 if ($field['visibility'] == 'User and User Admin Only') {
                     unset($fields[$name]);
                 }
             }
         }
         CRM_Core_BAO_UFGroup::getValues($this->_id, $fields, $values);
         // $profileFields_$gid array can be used for customized display of field labels and values in Profile/View.tpl
         $profileFields = array();
         $labels = array();
         foreach ($fields as $name => $field) {
             $labels[$field['title']] = preg_replace('/\\s+|\\W+/', '_', $name);
         }
         foreach ($values as $title => $value) {
             $profileFields[$labels[$title]] = array('label' => $title, 'value' => $value);
         }
         $template->assign_by_ref('row', $values);
         $template->assign_by_ref('profileFields_' . $this->_gid, $profileFields);
     }
     // invoke the pagRun hook, CRM-3906
     require_once 'CRM/Utils/Hook.php';
     CRM_Utils_Hook::pageRun($this);
     return trim($template->fetch($this->getTemplateFileName()));
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:58,代码来源:Dynamic.php

示例6: 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
  * @access 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) {
             require_once 'CRM/Contact/BAO/GroupContact.php';
             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.'));
             }
         }
         require_once 'CRM/Core/BAO/UFGroup.php';
         $values = array();
         $fields = CRM_Core_BAO_UFGroup::getFields($this->_profileIds, false, CRM_Core_Action::VIEW, null, null, false, $this->_restrict, $this->_skipPermission, null, CRM_Core_Permission::VIEW);
         require_once 'CRM/Contact/BAO/Contact/Permission.php';
         // make sure we dont expose all fields based on permission
         $admin = false;
         $session = CRM_Core_Session::singleton();
         if (!$config->userFrameworkFrontend && (CRM_Core_Permission::check('administer users') || CRM_Core_Permission::check('view all contacts') || CRM_Contact_BAO_Contact_Permission::allow($this->_id, CRM_Core_Permission::VIEW)) || $this->_id == $session->get('userID')) {
             $admin = true;
         }
         if (!$admin) {
             foreach ($fields as $name => $field) {
                 // make sure that there is enough permission to expose this field
                 if ($field['visibility'] == 'User and User Admin Only') {
                     unset($fields[$name]);
                 }
             }
         }
         CRM_Core_BAO_UFGroup::getValues($this->_id, $fields, $values);
         // $profileFields array can be used for customized display of field labels and values in Profile/View.tpl
         $profileFields = array();
         $labels = array();
         foreach ($fields as $name => $field) {
             $labels[$field['title']] = preg_replace('/\\s+|\\W+/', '_', $name);
         }
         foreach ($values as $title => $value) {
             $profileFields[$labels[$title]] = array('label' => $title, 'value' => $value);
         }
         $template->assign_by_ref('row', $values);
         $template->assign_by_ref('profileFields', $profileFields);
     }
     $name = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'name');
     if (strtolower($name) == 'summary_overlay') {
         $template->assign('overlayProfile', true);
     }
     $title = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'title');
     //CRM-4131.
     $displayName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_id, 'display_name');
     if ($displayName) {
         require_once 'CRM/Core/Permission.php';
         require_once 'CRM/Contact/BAO/Contact/Permission.php';
         $session = CRM_Core_Session::singleton();
         $config = CRM_Core_Config::singleton();
         if ($session->get('userID') && CRM_Core_Permission::check('access CiviCRM') && CRM_Contact_BAO_Contact_Permission::allow($session->get('userID'), CRM_Core_Permission::VIEW) && !$config->userFrameworkFrontend) {
             $contactViewUrl = CRM_Utils_System::url('civicrm/contact/view', "action=view&reset=1&cid={$this->_id}", true);
             $this->assign('displayName', $displayName);
             $displayName = "<a href=\"{$contactViewUrl}\">{$displayName}</a>";
         }
         $title .= ' - ' . $displayName;
     }
     CRM_Utils_System::setTitle($title);
     // invoke the pagRun hook, CRM-3906
     require_once 'CRM/Utils/Hook.php';
     CRM_Utils_Hook::pageRun($this);
     return trim($template->fetch($this->getTemplateFileName()));
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:80,代码来源:Dynamic.php

示例7: 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
  * @access 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.'));
             }
         }
         $values = array();
         $fields = CRM_Core_BAO_UFGroup::getFields($this->_profileIds, FALSE, CRM_Core_Action::VIEW, NULL, NULL, FALSE, $this->_restrict, $this->_skipPermission, NULL, CRM_Core_Permission::VIEW);
         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));
             }
         }
         $session = CRM_Core_Session::singleton();
         $userID = $session->get('userID');
         $this->_isPermissionedChecksum = FALSE;
         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);
             } else {
                 $this->_isPermissionedChecksum = CRM_Contact_BAO_Contact_Permission::validateChecksumContact($this->_id, $this, FALSE);
             }
         }
         // make sure we dont expose all fields based on permission
         $admin = FALSE;
         if (!$config->userFrameworkFrontend && (CRM_Core_Permission::check('administer users') || CRM_Core_Permission::check('view all contacts') || CRM_Contact_BAO_Contact_Permission::allow($this->_id, CRM_Core_Permission::VIEW)) || $this->_id == $userID || $this->_isPermissionedChecksum) {
             $admin = TRUE;
         }
         if (!$admin) {
             foreach ($fields as $name => $field) {
                 // make sure that there is enough permission to expose this field
                 if ($field['visibility'] == 'User and User Admin Only') {
                     unset($fields[$name]);
                 }
             }
         }
         // also eliminate all formatting fields
         foreach ($fields as $name => $field) {
             if (CRM_Utils_Array::value('field_type', $field) == 'Formatting') {
                 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 {
             CRM_Core_BAO_UFGroup::getValues($this->_id, $fields, $values);
         }
         // $profileFields array can be used for customized display of field labels and values in Profile/View.tpl
         $profileFields = array();
         $labels = array();
         foreach ($fields as $name => $field) {
             $labels[$field['title']] = preg_replace('/\\s+|\\W+/', '_', $name);
         }
         foreach ($values as $title => $value) {
             $profileFields[$labels[$title]] = array('label' => $title, 'value' => $value);
         }
         $template->assign_by_ref('row', $values);
         $template->assign_by_ref('profileFields', $profileFields);
     }
     $name = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'name');
     if (strtolower($name) == 'summary_overlay') {
         $template->assign('overlayProfile', TRUE);
     }
     $title = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'title');
     //CRM-4131.
     $displayName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_id, 'display_name');
     if ($displayName) {
         $session = CRM_Core_Session::singleton();
         $config = CRM_Core_Config::singleton();
         if ($session->get('userID') && CRM_Core_Permission::check('access CiviCRM') && CRM_Contact_BAO_Contact_Permission::allow($session->get('userID'), CRM_Core_Permission::VIEW) && !$config->userFrameworkFrontend) {
//.........这里部分代码省略.........
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:Dynamic.php

示例8: getContactInMailchimpListByEmail

 /**
  * Given an array of Contacts, return the first contact in the given
  * Mailchimp list.
  */
 static function getContactInMailchimpListByEmail($email, $mailchimp_list_id)
 {
     $contacts = self::getContactsWithPrimaryOrBulkEmail($email);
     $mailchimp_sync_settings = CRM_CiviMailchimp_BAO_SyncSettings::findByListId($mailchimp_list_id);
     $civicrm_group_id = $mailchimp_sync_settings->civicrm_group_id;
     $mailchimp_contact = NULL;
     foreach ($contacts as $key => $contact) {
         if (CRM_Contact_BAO_GroupContact::isContactInGroup($contact->id, $civicrm_group_id)) {
             $mailchimp_contact = $contact;
             break;
         }
     }
     if (!$mailchimp_contact) {
         throw new CRM_CiviMailchimp_Exception("Contact record with email {$email} not found in group ID {$civicrm_group_id}.");
     }
     return $mailchimp_contact;
 }
开发者ID:jaapjansma,项目名称:com.giantrabbit.civimailchimp,代码行数:21,代码来源:Utils.php


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