• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CRM_Contact_BAO_ProximityQuery类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: exportComponents


//.........这里部分代码省略.........
                 $returnProperties[$column] = 1;
                 $column = $column == 'id' ? 'civicrm_primary_id' : $column;
                 $exportParams['merge_same_address']['temp_columns'][$column] = 1;
             }
         }
     }
     if (!$selectAll && $componentTable && !empty($exportParams['additional_group'])) {
         // If an Additional Group is selected, then all contacts in that group are
         // added to the export set (filtering out duplicates).
         $query = "\nINSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_contact gc WHERE gc.group_id = {$exportParams['additional_group']} ON DUPLICATE KEY UPDATE {$componentTable}.contact_id = gc.contact_id";
         CRM_Core_DAO::executeQuery($query);
     }
     if ($moreReturnProperties) {
         // fix for CRM-7066
         if (!empty($moreReturnProperties['group'])) {
             unset($moreReturnProperties['group']);
             $moreReturnProperties['groups'] = 1;
         }
         $returnProperties = array_merge($returnProperties, $moreReturnProperties);
     }
     $exportParams['postal_mailing_export']['temp_columns'] = array();
     if ($exportParams['exportOption'] == 2 && isset($exportParams['postal_mailing_export']) && CRM_Utils_Array::value('postal_mailing_export', $exportParams['postal_mailing_export']) == 1) {
         $postalColumns = array('is_deceased', 'do_not_mail', 'street_address', 'supplemental_address_1');
         foreach ($postalColumns as $column) {
             if (!array_key_exists($column, $returnProperties)) {
                 $returnProperties[$column] = 1;
                 $exportParams['postal_mailing_export']['temp_columns'][$column] = 1;
             }
         }
     }
     // rectify params to what proximity search expects if there is a value for prox_distance
     // CRM-7021
     if (!empty($params)) {
         CRM_Contact_BAO_ProximityQuery::fixInputParams($params);
     }
     $query = new CRM_Contact_BAO_Query($params, $returnProperties, NULL, FALSE, FALSE, $queryMode, FALSE, TRUE, TRUE, NULL, $queryOperator);
     //sort by state
     //CRM-15301
     $query->_sort = $order;
     list($select, $from, $where, $having) = $query->query();
     if ($mergeSameHousehold == 1) {
         if (!$returnProperties['id']) {
             $returnProperties['id'] = 1;
         }
         //also merge Head of Household
         $relationKeyMOH = CRM_Utils_Array::key('Household Member of', $contactRelationshipTypes);
         $relationKeyHOH = CRM_Utils_Array::key('Head of Household for', $contactRelationshipTypes);
         foreach ($returnProperties as $key => $value) {
             if (!array_key_exists($key, $contactRelationshipTypes)) {
                 $returnProperties[$relationKeyMOH][$key] = $value;
                 $returnProperties[$relationKeyHOH][$key] = $value;
             }
         }
         unset($returnProperties[$relationKeyMOH]['location_type']);
         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);
开发者ID:jenlampton,项目名称:civicrm-core,代码行数:67,代码来源:Export.php


示例2: contactIDQuery

 /**
  * @param $params
  * @param $action
  * @param $sortID
  * @param null $displayRelationshipType
  * @param string $queryOperator
  *
  * @return CRM_Contact_DAO_Contact
  */
 function contactIDQuery($params, $action, $sortID, $displayRelationshipType = NULL, $queryOperator = 'AND')
 {
     $sortOrder =& $this->getSortOrder($this->_action);
     $sort = new CRM_Utils_Sort($sortOrder, $sortID);
     // rectify params to what proximity search expects if there is a value for prox_distance
     // CRM-7021 CRM-7905
     if (!empty($params)) {
         CRM_Contact_BAO_ProximityQuery::fixInputParams($params);
     }
     if (!$displayRelationshipType) {
         $query = new CRM_Contact_BAO_Query($params, $this->_returnProperties, NULL, FALSE, FALSE, 1, FALSE, TRUE, TRUE, NULL, $queryOperator);
     } else {
         $query = new CRM_Contact_BAO_Query($params, $this->_returnProperties, NULL, FALSE, FALSE, 1, FALSE, TRUE, TRUE, $displayRelationshipType, $queryOperator);
     }
     $value = $query->searchQuery(0, 0, $sort, FALSE, FALSE, FALSE, FALSE, FALSE);
     return $value;
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:26,代码来源:Selector.php


示例3: load

 /**
  * Load the smart group cache for a saved search.
  *
  * @param object $group
  *   The smart group that needs to be loaded.
  * @param bool $force
  *   Should we force a search through.
  */
 public static function load(&$group, $force = FALSE)
 {
     $groupID = $group->id;
     $savedSearchID = $group->saved_search_id;
     if (array_key_exists($groupID, self::$_alreadyLoaded) && !$force) {
         return;
     }
     // grab a lock so other processes don't compete and do the same query
     $lock = Civi::lockManager()->acquire("data.core.group.{$groupID}");
     if (!$lock->isAcquired()) {
         // this can cause inconsistent results since we don't know if the other process
         // will fill up the cache before our calling routine needs it.
         // however this routine does not return the status either, so basically
         // its a "lets return and hope for the best"
         return;
     }
     self::$_alreadyLoaded[$groupID] = 1;
     // we now have the lock, but some other process could have actually done the work
     // before we got here, so before we do any work, lets ensure that work needs to be
     // done
     // we allow hidden groups here since we dont know if the caller wants to evaluate an
     // hidden group
     if (!$force && !self::shouldGroupBeRefreshed($groupID, TRUE)) {
         $lock->release();
         return;
     }
     $sql = NULL;
     $idName = 'id';
     $customClass = NULL;
     if ($savedSearchID) {
         $ssParams = CRM_Contact_BAO_SavedSearch::getSearchParams($savedSearchID);
         // rectify params to what proximity search expects if there is a value for prox_distance
         // CRM-7021
         if (!empty($ssParams)) {
             CRM_Contact_BAO_ProximityQuery::fixInputParams($ssParams);
         }
         $returnProperties = array();
         if (CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $savedSearchID, 'mapping_id')) {
             $fv = CRM_Contact_BAO_SavedSearch::getFormValues($savedSearchID);
             $returnProperties = CRM_Core_BAO_Mapping::returnProperties($fv);
         }
         if (isset($ssParams['customSearchID'])) {
             // if custom search
             // we split it up and store custom class
             // so temp tables are not destroyed if they are used
             // hence customClass is defined above at top of function
             $customClass = CRM_Contact_BAO_SearchCustom::customClass($ssParams['customSearchID'], $savedSearchID);
             $searchSQL = $customClass->contactIDs();
             $searchSQL = str_replace('ORDER BY contact_a.id ASC', '', $searchSQL);
             if (!strstr($searchSQL, 'WHERE')) {
                 $searchSQL .= " WHERE ( 1 ) ";
             }
             $idName = 'contact_id';
         } else {
             $formValues = CRM_Contact_BAO_SavedSearch::getFormValues($savedSearchID);
             // CRM-17075 using the formValues in this way imposes extra logic and complexity.
             // we have the where_clause and where tables stored in the saved_search table
             // and should use these rather than re-processing the form criteria (which over-works
             // the link between the form layer & the query layer too).
             // It's hard to think of when you would want to use anything other than return
             // properties = array('contact_id' => 1) here as the point would appear to be to
             // generate the list of contact ids in the group.
             // @todo review this to use values in saved_search table (preferably for 4.8).
             $query = new CRM_Contact_BAO_Query($ssParams, $returnProperties, NULL, FALSE, FALSE, 1, TRUE, TRUE, FALSE, CRM_Utils_Array::value('display_relationship_type', $formValues), CRM_Utils_Array::value('operator', $formValues, 'AND'));
             $query->_useDistinct = FALSE;
             $query->_useGroupBy = FALSE;
             $searchSQL = $query->searchQuery(0, 0, NULL, FALSE, FALSE, FALSE, TRUE, TRUE, NULL, NULL, NULL, TRUE);
         }
         $groupID = CRM_Utils_Type::escape($groupID, 'Integer');
         $sql = $searchSQL . " AND contact_a.id NOT IN (\n                              SELECT contact_id FROM civicrm_group_contact\n                              WHERE civicrm_group_contact.status = 'Removed'\n                              AND   civicrm_group_contact.group_id = {$groupID} ) ";
     }
     if ($sql) {
         $sql = preg_replace("/^\\s*SELECT/", "SELECT {$groupID} as group_id, ", $sql);
     }
     // lets also store the records that are explicitly added to the group
     // this allows us to skip the group contact LEFT JOIN
     $sqlB = "\nSELECT {$groupID} as group_id, contact_id as {$idName}\nFROM   civicrm_group_contact\nWHERE  civicrm_group_contact.status = 'Added'\n  AND  civicrm_group_contact.group_id = {$groupID} ";
     $groupIDs = array($groupID);
     self::remove($groupIDs);
     $processed = FALSE;
     $tempTable = 'civicrm_temp_group_contact_cache' . rand(0, 2000);
     foreach (array($sql, $sqlB) as $selectSql) {
         if (!$selectSql) {
             continue;
         }
         $insertSql = "CREATE TEMPORARY TABLE {$tempTable} ({$selectSql});";
         $processed = TRUE;
         CRM_Core_DAO::executeQuery($insertSql);
         CRM_Core_DAO::executeQuery("INSERT IGNORE INTO civicrm_group_contact_cache (contact_id, group_id)\n        SELECT DISTINCT {$idName}, group_id FROM {$tempTable}\n      ");
         CRM_Core_DAO::executeQuery(" DROP TEMPORARY TABLE {$tempTable}");
     }
     self::updateCacheTime($groupIDs, $processed);
//.........这里部分代码省略.........
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:101,代码来源:GroupContactCache.php


示例4: whereClauseSingle


//.........这里部分代码省略.........
             return;
         case 'sortByCharacter':
             $this->sortByCharacter($values);
             return;
         case 'location_type':
             $this->locationType($values);
             return;
         case 'county':
             $this->county($values);
             return;
         case 'state_province':
             $this->stateProvince($values);
             return;
         case 'country':
             $this->country($values, FALSE);
             return;
         case 'postal_code':
         case 'postal_code_low':
         case 'postal_code_high':
             $this->postalCode($values);
             return;
         case 'activity_date':
         case 'activity_date_low':
         case 'activity_date_high':
         case 'activity_role':
         case 'activity_status':
         case 'activity_subject':
         case 'test_activities':
         case 'activity_type_id':
         case 'activity_survey_id':
         case 'activity_tags':
         case 'activity_taglist':
         case 'activity_test':
         case 'activity_contact_name':
         case 'activity_campaign_id':
         case 'activity_engagement_level':
         case 'activity_id':
             CRM_Activity_BAO_Query::whereClauseSingle($values, $this);
             return;
         case 'birth_date_low':
         case 'birth_date_high':
         case 'deceased_date_low':
         case 'deceased_date_high':
             $this->demographics($values);
             return;
         case 'log_date_low':
         case 'log_date_high':
             $this->modifiedDates($values);
             return;
         case 'changed_by':
             $this->changeLog($values);
             return;
         case 'do_not_phone':
         case 'do_not_email':
         case 'do_not_mail':
         case 'do_not_sms':
         case 'do_not_trade':
         case 'is_opt_out':
             $this->privacy($values);
             return;
         case 'privacy_options':
             $this->privacyOptions($values);
             return;
         case 'privacy_operator':
         case 'privacy_toggle':
             // these are handled by privacy options
             return;
         case 'preferred_communication_method':
             $this->preferredCommunication($values);
             return;
         case 'relation_type_id':
             $this->relationship($values);
             return;
         case 'relation_target_name':
             // since this case is handled with the above
             return;
         case 'relation_status':
             // since this case is handled with the above
             return;
         case 'task_status_id':
             $this->task($values);
             return;
         case 'task_id':
             // since this case is handled with the above
             return;
         case 'prox_distance':
             CRM_Contact_BAO_ProximityQuery::process($this, $values);
             return;
         case 'prox_street_address':
         case 'prox_city':
         case 'prox_postal_code':
         case 'prox_state_province_id':
         case 'prox_country_id':
             // handled by the proximity_distance clause
             return;
         default:
             $this->restWhere($values);
             return;
     }
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:Query.php


示例5: whereClauseSingle


//.........这里部分代码省略.........
             $this->country($values, FALSE);
             return;
         case 'postal_code':
         case 'postal_code_low':
         case 'postal_code_high':
             $this->postalCode($values);
             return;
         case 'activity_date':
         case 'activity_date_low':
         case 'activity_date_high':
         case 'activity_role':
         case 'activity_status_id':
         case 'activity_status':
         case 'followup_parent_id':
         case 'parent_id':
         case 'source_contact_id':
         case 'activity_subject':
         case 'test_activities':
         case 'activity_type_id':
         case 'activity_type':
         case 'activity_survey_id':
         case 'activity_tags':
         case 'activity_taglist':
         case 'activity_test':
         case 'activity_campaign_id':
         case 'activity_engagement_level':
         case 'activity_id':
         case 'activity_result':
         case 'source_contact':
             CRM_Activity_BAO_Query::whereClauseSingle($values, $this);
             return;
         case 'age_low':
         case 'age_high':
         case 'birth_date_low':
         case 'birth_date_high':
         case 'deceased_date_low':
         case 'deceased_date_high':
             $this->demographics($values);
             return;
         case 'age_asof_date':
             // handled by demographics
             return;
         case 'log_date_low':
         case 'log_date_high':
             $this->modifiedDates($values);
             return;
         case 'changed_by':
             $this->changeLog($values);
             return;
         case 'do_not_phone':
         case 'do_not_email':
         case 'do_not_mail':
         case 'do_not_sms':
         case 'do_not_trade':
         case 'is_opt_out':
             $this->privacy($values);
             return;
         case 'privacy_options':
             $this->privacyOptions($values);
             return;
         case 'privacy_operator':
         case 'privacy_toggle':
             // these are handled by privacy options
             return;
         case 'preferred_communication_method':
             $this->preferredCommunication($values);
             return;
         case 'relation_type_id':
         case 'relation_start_date_high':
         case 'relation_start_date_low':
         case 'relation_end_date_high':
         case 'relation_end_date_low':
         case 'relation_target_name':
         case 'relation_status':
         case 'relation_date_low':
         case 'relation_date_high':
             $this->relationship($values);
             $this->_relationshipValuesAdded = TRUE;
             return;
         case 'task_status_id':
             $this->task($values);
             return;
         case 'task_id':
             // since this case is handled with the above
             return;
         case 'prox_distance':
             CRM_Contact_BAO_ProximityQuery::process($this, $values);
             return;
         case 'prox_street_address':
         case 'prox_city':
         case 'prox_postal_code':
         case 'prox_state_province_id':
         case 'prox_country_id':
             // handled by the proximity_distance clause
             return;
         default:
             $this->restWhere($values);
             return;
     }
 }
开发者ID:hoegrammer,项目名称:civicrm-core,代码行数:101,代码来源:Query.php


示例6: civicrm_api3_contact_proximity

/**
 * Get contacts by proximity.
 *
 * @param array $params
 *
 * @return array
 * @throws Exception
 */
function civicrm_api3_contact_proximity($params)
{
    $latitude = CRM_Utils_Array::value('latitude', $params);
    $longitude = CRM_Utils_Array::value('longitude', $params);
    $distance = CRM_Utils_Array::value('distance', $params);
    $unit = CRM_Utils_Array::value('unit', $params);
    // check and ensure that lat/long and distance are floats
    if (!CRM_Utils_Rule::numeric($latitude) || !CRM_Utils_Rule::numeric($longitude) || !CRM_Utils_Rule::numeric($distance)) {
        throw new Exception(ts('Latitude, Longitude and Distance should exist and be numeric'));
    }
    if ($unit == "mile") {
        $conversionFactor = 1609.344;
    } else {
        $conversionFactor = 1000;
    }
    //Distance in meters
    $distance = $distance * $conversionFactor;
    $whereClause = CRM_Contact_BAO_ProximityQuery::where($latitude, $longitude, $distance);
    $query = "\nSELECT    civicrm_contact.id as contact_id,\n          civicrm_contact.display_name as display_name\nFROM      civicrm_contact\nLEFT JOIN civicrm_address ON civicrm_contact.id = civicrm_address.contact_id\nWHERE     {$whereClause}\n";
    $dao = CRM_Core_DAO::executeQuery($query);
    $contacts = array();
    while ($dao->fetch()) {
        $contacts[] = $dao->toArray();
    }
    return civicrm_api3_create_success($contacts, $params, 'Contact', 'get_by_location', $dao);
}
开发者ID:nielosz,项目名称:civicrm-core,代码行数:34,代码来源:Contact.php


示例7: buildProximityWhere

 /**
  * Helper method to filter Projects by location.
  *
  * @param array $params
  *   <ol>
  *     <li>string city - optional. Not used in this function, just passed along for geocoding.</li>
  *     <li>mixed country - required if lat/lon not provided. Can be country_id or string.</li>
  *     <li>float lat - required if country not provided</li>
  *     <li>float lon - required if country not provided</li>
  *     <li>string postal_code - optional. Not used in this function, just passed along for geocoding.</li>
  *     <li>float radius - required</li>
  *     <li>string street_address - optional. Not used in this function, just passed along for geocoding.</li>
  *     <li>string unit - optional, defaults to meters unless 'mile' is specified</li>
  *   </ol>
  * @return string
  *   SQL fragment (partial where clause)
  * @throws Exception
  */
 private static function buildProximityWhere(array $params)
 {
     $country = $lat = $lon = $radius = $unit = NULL;
     extract($params, EXTR_IF_EXISTS);
     // ensure that radius is a float
     if (!CRM_Utils_Rule::numeric($radius)) {
         throw new Exception(ts('Radius should exist and be numeric'));
     }
     if (!CRM_Utils_Rule::numeric($lat) || !CRM_Utils_Rule::numeric($lon)) {
         if (empty($country)) {
             throw new Exception(ts('Either Country or both Latitude and Longitude are required'));
         }
         // TODO: I think CRM_Utils_Geocode_*::format should be responsible for this
         if (CRM_Utils_Type::validate($country, 'Positive', FALSE)) {
             $country = civicrm_api3('Country', 'getvalue', array('id' => $country, 'return' => 'name'));
         }
         // TODO: support other geocoders
         $geocodeSuccess = CRM_Utils_Geocode_Google::format($params);
         if (!$geocodeSuccess) {
             // this is intentionally a string; a query like "SELECT * FROM foo WHERE FALSE"
             // will return an empty set, which is what we should do if the provided address
             // can't be geocoded
             return 'FALSE';
         }
         // $params is passed to the geocoder by reference; on success, these values
         // will be available
         $lat = $params['geo_code_1'];
         $lon = $params['geo_code_2'];
     }
     $conversionFactor = $unit == "mile" ? 1609.344 : 1000;
     //radius in meters
     $radius = $radius * $conversionFactor;
     return CRM_Contact_BAO_ProximityQuery::where($lat, $lon, $radius);
 }
开发者ID:RussellAult,项目名称:org.civicrm.volunteer,代码行数:52,代码来源:Project.php


示例8: where

 /**
  * @param bool $includeContactIDs
  *
  * @return string
  */
 public function where($includeContactIDs = FALSE)
 {
     $params = array();
     $clause = array();
     $where = CRM_Contact_BAO_ProximityQuery::where($this->_latitude, $this->_longitude, $this->_distance, 'address');
     if ($this->_tag) {
         $where .= "\nAND t.tag_id = {$this->_tag}\n";
     }
     if ($this->_group) {
         $where .= "\nAND cgc.group_id = {$this->_group}\n ";
     }
     $where .= " AND contact_a.is_deleted != 1 ";
     return $this->whereClause($where, $params);
 }
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:19,代码来源:Proximity.php


示例9: load

 /**
  * load the smart group cache for a saved search
  */
 static function load(&$group, $fresh = FALSE)
 {
     $groupID = $group->id;
     $savedSearchID = $group->saved_search_id;
     if (array_key_exists($groupID, self::$_alreadyLoaded) && !$fresh) {
         return;
     }
     self::$_alreadyLoaded[$groupID] = 1;
     $sql = NULL;
     $idName = 'id';
     $customClass = NULL;
     if ($savedSearchID) {
         $ssParams = CRM_Contact_BAO_SavedSearch::getSearchParams($savedSearchID);
         // rectify params to what proximity search expects if there is a value for prox_distance
         // CRM-7021
         if (!empty($ssParams)) {
             CRM_Contact_BAO_ProximityQuery::fixInputParams($ssParams);
         }
         $returnProperties = array();
         if (CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $savedSearchID, 'mapping_id')) {
             $fv = CRM_Contact_BAO_SavedSearch::getFormValues($savedSearchID);
             $returnProperties = CRM_Core_BAO_Mapping::returnProperties($fv);
         }
         if (isset($ssParams['customSearchID'])) {
             // if custom search
             // we split it up and store custom class
             // so temp tables are not destroyed if they are used
             // hence customClass is defined above at top of function
             $customClass = CRM_Contact_BAO_SearchCustom::customClass($ssParams['customSearchID'], $savedSearchID);
             $searchSQL = $customClass->contactIDs();
             $idName = 'contact_id';
         } else {
             $formValues = CRM_Contact_BAO_SavedSearch::getFormValues($savedSearchID);
             $query = new CRM_Contact_BAO_Query($ssParams, $returnProperties, NULL, FALSE, FALSE, 1, TRUE, TRUE, FALSE, CRM_Utils_Array::value('display_relationship_type', $formValues), CRM_Utils_Array::value('operator', $formValues, 'AND'));
             $query->_useDistinct = FALSE;
             $query->_useGroupBy = FALSE;
             $searchSQL = $query->searchQuery(0, 0, NULL, FALSE, FALSE, FALSE, TRUE, TRUE, NULL, NULL, NULL, TRUE);
         }
         $groupID = CRM_Utils_Type::escape($groupID, 'Integer');
         $sql = $searchSQL . " AND contact_a.id NOT IN (\n                              SELECT contact_id FROM civicrm_group_contact\n                              WHERE civicrm_group_contact.status = 'Removed'\n                              AND   civicrm_group_contact.group_id = {$groupID} ) ";
     }
     if ($sql) {
         $sql = preg_replace("/^\\s*SELECT/", "SELECT {$groupID} as group_id, ", $sql);
     }
     // lets also store the records that are explicitly added to the group
     // this allows us to skip the group contact LEFT JOIN
     $sqlB = "\nSELECT {$groupID} as group_id, contact_id as {$idName}\nFROM   civicrm_group_contact\nWHERE  civicrm_group_contact.status = 'Added'\n  AND  civicrm_group_contact.group_id = {$groupID} ";
     $groupIDs = array($groupID);
     self::remove($groupIDs);
     foreach (array($sql, $sqlB) as $selectSql) {
         if (!$selectSql) {
             continue;
         }
         $insertSql = "INSERT IGNORE INTO civicrm_group_contact_cache (group_id,contact_id) ({$selectSql});";
         $processed = TRUE;
         // FIXME
         $result = CRM_Core_DAO::executeQuery($insertSql);
     }
     self::updateCacheTime($groupIDs, $processed);
     if ($group->children) {
         //Store a list of contacts who are removed from the parent group
         $sql = "\nSELECT contact_id\nFROM civicrm_group_contact\nWHERE  civicrm_group_contact.status = 'Removed'\nAND  civicrm_group_contact.group_id = {$groupID} ";
         $dao = CRM_Core_DAO::executeQuery($sql);
         $removed_contacts = array();
         while ($dao->fetch()) {
             $removed_contacts[] = $dao->contact_id;
         }
         $childrenIDs = explode(',', $group->children);
         foreach ($childrenIDs as $childID) {
             $contactIDs = CRM_Contact_BAO_Group::getMember($childID, FALSE);
             //Unset each contact that is removed from the parent group
             foreach ($removed_contacts as $removed_contact) {
                 unset($contactIDs[$removed_contact]);
             }
             $values = array();
             foreach ($contactIDs as $contactID => $dontCare) {
                 $values[] = "({$groupID},{$contactID})";
             }
             self::store($groupIDs, $values);
         }
     }
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:85,代码来源:GroupContactCache.php


示例10: where

 function where($includeContactIDs = false)
 {
     $params = array();
     $clause = array();
     require_once 'CRM/Contact/BAO/ProximityQuery.php';
     $where = CRM_Contact_BAO_ProximityQuery::where($this->_latitude, $this->_longitude, $this->_distance, 'address');
     if ($this->_tag) {
         $where .= "\nAND t.tag_id = {$this->_tag}\n";
     }
     if ($this->_group) {
         $where .= "\nAND cgc.group_id = {$this->_group}\n ";
     }
     return $this->whereClause($where, $params);
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:14,代码来源:Proximity.php


示例11: initialize

 static function initialize()
 {
     static $_initialized = FALSE;
     if (!$_initialized) {
         $_initialized = TRUE;
         self::$_earthFlattening = 1.0 / 298.257223563;
         self::$_earthRadiusSemiMajor = 6378137.0;
         self::$_earthRadiusSemiMinor = self::$_earthRadiusSemiMajor * (1.0 - self::$_earthFlattening);
         self::$_earthEccentricitySQ = 2 * self::$_earthFlattening - pow(self::$_earthFlattening, 2);
     }
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:11,代码来源:ProximityQuery.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CRM_Contact_BAO_Query类代码示例发布时间:2022-05-20
下一篇:
PHP CRM_Contact_BAO_GroupContactCache类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap