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


PHP CRM_Core_DAO::getContactIDsFromComponent方法代码示例

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


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

示例1: exportComponents


//.........这里部分代码省略.........
         unset($returnProperties[$relationKeyMOH]['im_provider']);
         unset($returnProperties[$relationKeyHOH]['location_type']);
         unset($returnProperties[$relationKeyHOH]['im_provider']);
     }
     $allRelContactArray = $relationQuery = array();
     foreach ($contactRelationshipTypes as $rel => $dnt) {
         if ($relationReturnProperties = CRM_Utils_Array::value($rel, $returnProperties)) {
             $allRelContactArray[$rel] = array();
             // build Query for each relationship
             $relationQuery[$rel] = new CRM_Contact_BAO_Query(NULL, $relationReturnProperties, NULL, FALSE, FALSE, $queryMode);
             list($relationSelect, $relationFrom, $relationWhere, $relationHaving) = $relationQuery[$rel]->query();
             list($id, $direction) = explode('_', $rel, 2);
             // identify the relationship direction
             $contactA = 'contact_id_a';
             $contactB = 'contact_id_b';
             if ($direction == 'b_a') {
                 $contactA = 'contact_id_b';
                 $contactB = 'contact_id_a';
             }
             if ($exportMode == CRM_Export_Form_Select::CONTACT_EXPORT) {
                 $relIDs = $ids;
             } elseif ($exportMode == CRM_Export_Form_Select::ACTIVITY_EXPORT) {
                 $sourceID = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_ActivityContact', 'record_type_id', 'Activity Source');
                 $query = "SELECT contact_id FROM civicrm_activity_contact\n                              WHERE activity_id IN ( " . implode(',', $ids) . ") AND\n                              record_type_id = {$sourceID}";
                 $dao = CRM_Core_DAO::executeQuery($query);
                 while ($dao->fetch()) {
                     $relIDs[] = $dao->contact_id;
                 }
             } else {
                 $component = self::exportComponent($exportMode);
                 if ($exportMode == CRM_Export_Form_Select::CASE_EXPORT) {
                     $relIDs = CRM_Case_BAO_Case::retrieveContactIdsByCaseId($ids);
                 } else {
                     $relIDs = CRM_Core_DAO::getContactIDsFromComponent($ids, $component);
                 }
             }
             $relationshipJoin = $relationshipClause = '';
             if (!$selectAll && $componentTable) {
                 $relationshipJoin = " INNER JOIN {$componentTable} ctTable ON ctTable.contact_id = {$contactA}";
             } elseif (!empty($relIDs)) {
                 $relID = implode(',', $relIDs);
                 $relationshipClause = " AND crel.{$contactA} IN ( {$relID} )";
             }
             $relationFrom = " {$relationFrom}\n                INNER JOIN civicrm_relationship crel ON crel.{$contactB} = contact_a.id AND crel.relationship_type_id = {$id}\n                {$relationshipJoin} ";
             //check for active relationship status only
             $today = date('Ymd');
             $relationActive = " AND (crel.is_active = 1 AND ( crel.end_date is NULL OR crel.end_date >= {$today} ) )";
             $relationWhere = " WHERE contact_a.is_deleted = 0 {$relationshipClause} {$relationActive}";
             $relationGroupBy = " GROUP BY crel.{$contactA}";
             $relationSelect = "{$relationSelect}, {$contactA} as refContact ";
             $relationQueryString = "{$relationSelect} {$relationFrom} {$relationWhere} {$relationHaving} {$relationGroupBy}";
             $allRelContactDAO = CRM_Core_DAO::executeQuery($relationQueryString);
             while ($allRelContactDAO->fetch()) {
                 //FIX Me: Migrate this to table rather than array
                 // build the array of all related contacts
                 $allRelContactArray[$rel][$allRelContactDAO->refContact] = clone $allRelContactDAO;
             }
             $allRelContactDAO->free();
         }
     }
     // make sure the groups stuff is included only if specifically specified
     // by the fields param (CRM-1969), else we limit the contacts outputted to only
     // ones that are part of a group
     if (!empty($returnProperties['groups'])) {
         $oldClause = "( contact_a.id = civicrm_group_contact.contact_id )";
         $newClause = " ( {$oldClause} AND ( civicrm_group_contact.status = 'Added' OR civicrm_group_contact.status IS NULL ) )";
开发者ID:jenlampton,项目名称:civicrm-core,代码行数:67,代码来源:Export.php

示例2: setContactIDs

 /**
  * Given the signer id, compute the contact id
  * since its used for things like send email
  */
 public function setContactIDs()
 {
     $this->_contactIds =& CRM_Core_DAO::getContactIDsFromComponent($this->_caseIds, 'civicrm_case');
 }
开发者ID:hguru,项目名称:224Civi,代码行数:8,代码来源:Task.php

示例3: setContactIDs

 /**
  * Given the membership id, compute the contact id
  * since its used for things like send email
  */
 public function setContactIDs()
 {
     $this->_contactIds =& CRM_Core_DAO::getContactIDsFromComponent($this->_memberIds, 'civicrm_membership');
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:8,代码来源:Task.php

示例4: setContactIDs

 /**
  * Given the contribution id, compute the contact id
  * since its used for things like send email
  */
 public function setContactIDs()
 {
     if (!$this->_includesSoftCredits) {
         $this->_contactIds =& CRM_Core_DAO::getContactIDsFromComponent($this->_contributionIds, 'civicrm_contribution');
     }
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:10,代码来源:Task.php

示例5: setContactIDs

 /**
  * Given the participant id, compute the contact id
  * since its used for things like send email
  */
 public function setContactIDs()
 {
     $this->_contactIds =& CRM_Core_DAO::getContactIDsFromComponent($this->_participantIds, 'civicrm_participant');
 }
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:8,代码来源:Task.php

示例6: exportComponents


//.........这里部分代码省略.........
                 $contactA = 'contact_id_b';
                 $contactB = 'contact_id_a';
             }
             if ($exportMode == CRM_Export_Form_Select::CONTACT_EXPORT) {
                 $relIDs = $ids;
             } else {
                 if ($exportMode == CRM_Export_Form_Select::ACTIVITY_EXPORT) {
                     $query = "SELECT source_contact_id FROM civicrm_activity\n                              WHERE id IN ( " . implode(',', $ids) . ")";
                     $dao = CRM_Core_DAO::executeQuery($query);
                     while ($dao->fetch()) {
                         $relIDs[] = $dao->source_contact_id;
                     }
                 } else {
                     switch ($exportMode) {
                         case CRM_Export_Form_Select::CONTRIBUTE_EXPORT:
                             $component = 'civicrm_contribution';
                             break;
                         case CRM_Export_Form_Select::EVENT_EXPORT:
                             $component = 'civicrm_participant';
                             break;
                         case CRM_Export_Form_Select::MEMBER_EXPORT:
                             $component = 'civicrm_membership';
                             break;
                         case CRM_Export_Form_Select::PLEDGE_EXPORT:
                             $component = 'civicrm_pledge';
                             break;
                         case CRM_Export_Form_Select::CASE_EXPORT:
                             $component = 'civicrm_case';
                             break;
                         case CRM_Export_Form_Select::GRANT_EXPORT:
                             $component = 'civicrm_grant';
                             break;
                     }
                     $relIDs = CRM_Core_DAO::getContactIDsFromComponent($ids, $component);
                 }
             }
             $relationshipJoin = $relationshipClause = '';
             if ($componentTable) {
                 $relationshipJoin = " INNER JOIN {$componentTable} ctTable ON ctTable.contact_id = {$contactA}";
             } else {
                 $relID = implode(',', $relIDs);
                 $relationshipClause = " AND crel.{$contactA} IN ( {$relID} )";
             }
             $relationFrom = " {$relationFrom}\n                INNER JOIN civicrm_relationship crel ON crel.{$contactB} = contact_a.id AND crel.relationship_type_id = {$id} \n                {$relationshipJoin} ";
             $relationWhere = " WHERE contact_a.is_deleted = 0 {$relationshipClause}";
             $relationGroupBy = " GROUP BY crel.{$contactA}";
             $relationSelect = "{$relationSelect}, {$contactA} as refContact ";
             $relationQueryString = "{$relationSelect} {$relationFrom} {$relationWhere} {$relationGroupBy}";
             $allRelContactDAO = CRM_Core_DAO::executeQuery($relationQueryString);
             while ($allRelContactDAO->fetch()) {
                 //FIX Me: Migrate this to table rather than array
                 // build the array of all related contacts
                 $allRelContactArray[$rel][$allRelContactDAO->refContact] = clone $allRelContactDAO;
             }
             $allRelContactDAO->free();
         }
     }
     // make sure the groups stuff is included only if specifically specified
     // by the fields param (CRM-1969), else we limit the contacts outputted to only
     // ones that are part of a group
     if (CRM_Utils_Array::value('groups', $returnProperties)) {
         $oldClause = "contact_a.id = civicrm_group_contact.contact_id";
         $newClause = " ( {$oldClause} AND civicrm_group_contact.status = 'Added' OR civicrm_group_contact.status IS NULL ) ";
         // total hack for export, CRM-3618
         $from = str_replace($oldClause, $newClause, $from);
     }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:67,代码来源:Export.php

示例7: preProcessCommon

 static function preProcessCommon(&$form, $useTable = true)
 {
     $form->_contactIds = array();
     $form->_contactTypes = array();
     $form->_searchFrom = $searchformName = 'contact';
     $searchFrom = $form->get('searchFormName');
     $pages = $form->controller->_pages;
     $prefix = 'contact';
     if ($pages[$searchFrom]) {
         $prefix = $pages[$searchFrom]->getVar('_prefix');
         if ($prefix == 'member_') {
             $searchformName = 'member';
         }
     }
     if ($searchformName == 'member') {
         $form->_searchFrom = $searchformName;
         $values = $form->controller->exportValues($form->get('searchFormName'));
         $ids = array();
         if ($values['radio_ts'] == 'ts_sel') {
             foreach ($values as $name => $value) {
                 if (substr($name, 0, CRM_Core_Form::CB_PREFIX_LEN) == CRM_Core_Form::CB_PREFIX) {
                     $ids[] = substr($name, CRM_Core_Form::CB_PREFIX_LEN);
                 }
             }
         } else {
             $queryParams = $form->get('queryParams');
             $sortOrder = null;
             if ($form->get(CRM_Utils_Sort::SORT_ORDER)) {
                 $sortOrder = $form->get(CRM_Utils_Sort::SORT_ORDER);
             }
             $query = new CRM_Contact_BAO_Query($queryParams, NULL, NULL, FALSE, FALSE, CRM_Contact_BAO_Query::MODE_MEMBER);
             $query->_distinctComponentClause = ' civicrm_membership.id';
             $query->_groupByComponentClause = ' GROUP BY civicrm_membership.id ';
             $result = $query->searchQuery(0, 0, $sortOrder);
             while ($result->fetch()) {
                 $ids[] = $result->membership_id;
             }
         }
         if (!empty($ids)) {
             $form->_componentClause = ' civicrm_membership.id IN ( ' . implode(',', $ids) . ' ) ';
             $form->assign('totalSelectedMembers', count($ids));
         }
         $form->_memberIds = $form->_componentIds = $ids;
         $form->_contactIds =& CRM_Core_DAO::getContactIDsFromComponent($ids, 'civicrm_membership');
         $form->assign('totalSelectedContacts', count($form->_contactIds));
     } else {
         parent::preProcessCommon($form);
     }
 }
开发者ID:krishgopi,项目名称:uk.co.vedaconsulting.module.wordmailmerge,代码行数:49,代码来源:WordMailMergeForm.php


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