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


PHP CRM_Contact_BAO_Query::_considerCompActivities方法代码示例

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


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

示例1: initialize

 /**
  * function which actually does all the work for the constructor
  *
  * @return void
  * @access private
  */
 function initialize()
 {
     $this->_select = array();
     $this->_element = array();
     $this->_tables = array();
     $this->_whereTables = array();
     $this->_where = array();
     $this->_qill = array();
     $this->_options = array();
     $this->_cfIDs = array();
     $this->_paramLookup = array();
     $this->_having = array();
     $this->_customQuery = NULL;
     //reset cache, CRM-5803
     self::$_activityRole = NULL;
     self::$_considerCompActivities = NULL;
     self::$_withContactActivitiesOnly = NULL;
     $this->_select['contact_id'] = 'contact_a.id as contact_id';
     $this->_element['contact_id'] = 1;
     $this->_tables['civicrm_contact'] = 1;
     if (!empty($this->_params)) {
         $this->buildParamsLookup();
     }
     $this->_whereTables = $this->_tables;
     $this->selectClause();
     $this->_whereClause = $this->whereClause();
     $this->_fromClause = self::fromClause($this->_tables, NULL, NULL, $this->_primaryLocation, $this->_mode);
     $this->_simpleFromClause = self::fromClause($this->_whereTables, NULL, NULL, $this->_primaryLocation, $this->_mode);
     $this->openedSearchPanes(TRUE);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:36,代码来源:Query.php

示例2: whereClauseSingle

 /**
  * where clause for a single field
  *
  * @return void
  * @access public
  */
 static function whereClauseSingle(&$values, &$query)
 {
     list($name, $op, $value, $grouping, $wildcard) = $values;
     $strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
     $query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1;
     if ($query->_mode & CRM_Contact_BAO_Query::MODE_ACTIVITY) {
         $query->_skipDeleteClause = TRUE;
     }
     switch ($name) {
         case 'activity_type_id':
         case 'activity_type':
             $types = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
             //get the component activity types.
             $compActTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE, TRUE);
             $activityTypeIds = self::buildWhereAndQill($query, $value, $types, $op, $grouping, array('Activity Type', 'civicrm_activity.activity_type_id'));
             foreach ($activityTypeIds as $activityTypeId) {
                 if (array_key_exists($activityTypeId, $compActTypes)) {
                     CRM_Contact_BAO_Query::$_considerCompActivities = TRUE;
                     break;
                 }
             }
             break;
         case 'activity_survey_id':
             if (!$value) {
                 break;
             }
             $value = CRM_Utils_Type::escape($value, 'Integer');
             $query->_where[$grouping][] = " source_record_id = {$value}";
             $query->_qill[$grouping][] = ts('Survey') . ' - ' . CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey', $value, 'title');
             break;
         case 'activity_engagement_level':
             if (!$value) {
                 break;
             }
             $value = CRM_Utils_Type::escape($value, 'Integer');
             $query->_where[$grouping][] = " engagement_level = {$value}";
             $query->_qill[$grouping][] = ts('Engagement Index') . ' - ' . CRM_Core_OptionGroup::getLabel('engagement_index', $value);
             break;
         case 'activity_role':
             CRM_Contact_BAO_Query::$_activityRole = $values[2];
             $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
             $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
             $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
             $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
             if ($values[2]) {
                 $query->_tables['civicrm_activity_contact'] = $query->_whereTables['civicrm_activity_contact'] = 1;
                 if ($values[2] == 1) {
                     $query->_where[$grouping][] = " civicrm_activity_contact.record_type_id = {$sourceID}";
                     $query->_qill[$grouping][] = ts('Activity created by');
                 } else {
                     if ($values[2] == 2) {
                         $query->_where[$grouping][] = " civicrm_activity_contact.record_type_id = {$assigneeID}";
                         $query->_qill[$grouping][] = ts('Activity assigned to');
                     } else {
                         if ($values[2] == 3) {
                             $query->_where[$grouping][] = " civicrm_activity_contact.record_type_id = {$targetID}";
                             $query->_qill[$grouping][] = ts('Activity targeted to');
                         }
                     }
                 }
             }
             break;
         case 'activity_status':
             $status = CRM_Core_PseudoConstant::activityStatus();
             $activityTypeIds = self::buildWhereAndQill($query, $value, $status, $op, $grouping, array('Activity Status', 'civicrm_activity.status_id'));
             break;
         case 'activity_subject':
             $n = trim($value);
             $value = strtolower(CRM_Core_DAO::escapeString($n));
             if ($wildcard) {
                 if (strpos($value, '%') !== FALSE) {
                     // only add wild card if not there
                     $value = "'{$value}'";
                 } else {
                     $value = "'%{$value}%'";
                 }
                 $op = 'LIKE';
             } else {
                 $value = "'{$value}'";
             }
             $wc = $op != 'LIKE' ? "LOWER(civicrm_activity.subject)" : "civicrm_activity.subject";
             $query->_where[$grouping][] = " {$wc} {$op} {$value}";
             $query->_qill[$grouping][] = ts('Subject') . " {$op} - '{$n}'";
             break;
         case 'activity_test':
             // We dont want to include all tests for sql OR CRM-7827
             if (!$value || $query->getOperator() != 'OR') {
                 $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_activity.is_test", $op, $value, "Boolean");
                 if ($value) {
                     $query->_qill[$grouping][] = ts('Activity is a Test');
                 }
             }
             break;
         case 'activity_date':
//.........这里部分代码省略.........
开发者ID:hguru,项目名称:224Civi,代码行数:101,代码来源:Query.php

示例3: initialize

 /**
  * Function which actually does all the work for the constructor.
  */
 public function initialize()
 {
     $this->_select = array();
     $this->_element = array();
     $this->_tables = array();
     $this->_whereTables = array();
     $this->_where = array();
     $this->_qill = array();
     $this->_options = array();
     $this->_cfIDs = array();
     $this->_paramLookup = array();
     $this->_having = array();
     $this->_customQuery = NULL;
     // reset cached static variables - CRM-5803
     self::$_activityRole = NULL;
     self::$_considerCompActivities = NULL;
     self::$_withContactActivitiesOnly = NULL;
     $this->_select['contact_id'] = 'contact_a.id as contact_id';
     $this->_element['contact_id'] = 1;
     $this->_tables['civicrm_contact'] = 1;
     if (!empty($this->_params)) {
         $this->buildParamsLookup();
     }
     $this->_whereTables = $this->_tables;
     $this->selectClause();
     $this->_whereClause = $this->whereClause();
     if (array_key_exists('civicrm_contribution', $this->_whereTables)) {
         $component = 'contribution';
     }
     if (array_key_exists('civicrm_membership', $this->_whereTables)) {
         $component = 'membership';
     }
     if (isset($component)) {
         CRM_Financial_BAO_FinancialType::buildPermissionedClause($this->_whereClause, $component);
     }
     $this->_fromClause = self::fromClause($this->_tables, NULL, NULL, $this->_primaryLocation, $this->_mode);
     $this->_simpleFromClause = self::fromClause($this->_whereTables, NULL, NULL, $this->_primaryLocation, $this->_mode);
     $this->openedSearchPanes(TRUE);
 }
开发者ID:hazemtorab,项目名称:civicrm-core,代码行数:42,代码来源:Query.php

示例4: whereClauseSingle

 /**
  * where clause for a single field
  *
  * @return void
  * @access public
  */
 static function whereClauseSingle(&$values, &$query)
 {
     list($name, $op, $value, $grouping, $wildcard) = $values;
     $strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
     $query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1;
     if ($query->_mode & CRM_Contact_BAO_Query::MODE_ACTIVITY) {
         $query->_skipDeleteClause = TRUE;
     }
     switch ($name) {
         case 'activity_type_id':
             $types = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
             //get the component activity types.
             $compActTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE, TRUE);
             $clause = array();
             if (is_array($value)) {
                 foreach ($value as $id => $dontCare) {
                     if (array_key_exists($id, $types) && $dontCare) {
                         $clause[] = "'" . CRM_Utils_Type::escape($types[$id], 'String') . "'";
                         if (array_key_exists($id, $compActTypes)) {
                             CRM_Contact_BAO_Query::$_considerCompActivities = TRUE;
                         }
                     }
                 }
                 $activityTypes = implode(',', array_keys($value));
             } else {
                 $clause[] = "'" . CRM_Utils_Type::escape($value, 'String') . "'";
                 $activityTypes = $value;
                 if (array_key_exists($value, $compActTypes)) {
                     CRM_Contact_BAO_Query::$_considerCompActivities = TRUE;
                 }
             }
             $query->_where[$grouping][] = ' civicrm_activity.activity_type_id IN (' . $activityTypes . ')';
             $query->_qill[$grouping][] = ts('Activity Type') . ' ' . implode(' ' . ts('or') . ' ', $clause);
             break;
         case 'activity_survey_id':
             if (!$value) {
                 break;
             }
             $value = CRM_Utils_Type::escape($value, 'Integer');
             $query->_where[$grouping][] = " source_record_id = {$value}";
             $query->_qill[$grouping][] = ts('Survey') . ' - ' . CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey', $value, 'title');
             break;
         case 'activity_engagement_level':
             if (!$value) {
                 break;
             }
             $value = CRM_Utils_Type::escape($value, 'Integer');
             $query->_where[$grouping][] = " engagement_level = {$value}";
             $query->_qill[$grouping][] = ts('Engagement Index') . ' - ' . CRM_Core_OptionGroup::getLabel('engagement_index', $value);
             break;
         case 'activity_role':
             CRM_Contact_BAO_Query::$_activityRole = $values[2];
             //for activity target name
             $activityTargetName = $query->getWhereValues('activity_contact_name', $grouping);
             if (!$activityTargetName[2]) {
                 $name = NULL;
             } else {
                 $name = trim($activityTargetName[2]);
                 $name = strtolower(CRM_Core_DAO::escapeString($name));
             }
             $query->_where[$grouping][] = " contact_activity_source.is_deleted = 0 AND contact_activity_source.sort_name LIKE '%{$name}%'";
             if ($values[2] == 1) {
                 $query->_where[$grouping][] = " civicrm_activity.source_contact_id = contact_activity_source.id";
                 $query->_qill[$grouping][] = ts('Activity created by') . " '{$name}'";
                 $query->_tables['civicrm_activity_contact'] = $query->_whereTables['civicrm_activity_contact'] = 1;
             } elseif ($values[2] == 2) {
                 $query->_where[$grouping][] = " civicrm_activity_assignment.activity_id = civicrm_activity.id AND civicrm_activity_assignment.assignee_contact_id = contact_activity_source.id";
                 $query->_tables['civicrm_activity_assignment'] = $query->_whereTables['civicrm_activity_assignment'] = 1;
                 $query->_tables['civicrm_activity_contact'] = $query->_whereTables['civicrm_activity_contact'] = 1;
                 $query->_qill[$grouping][] = ts('Activity assigned to') . " '{$name}'";
             }
             break;
         case 'activity_status':
             $status = CRM_Core_PseudoConstant::activityStatus();
             $clause = array();
             if (is_array($value)) {
                 foreach ($value as $k => $v) {
                     if ($k) {
                         $clause[] = "'" . CRM_Utils_Type::escape($status[$k], 'String') . "'";
                     }
                 }
             } else {
                 $clause[] = "'" . CRM_Utils_Type::escape($value, 'String') . "'";
             }
             $query->_where[$grouping][] = ' civicrm_activity.status_id IN (' . implode(',', array_keys($value)) . ')';
             $query->_qill[$grouping][] = ts('Activity Status') . ' - ' . implode(' ' . ts('or') . ' ', $clause);
             break;
         case 'activity_subject':
             $n = trim($value);
             $value = strtolower(CRM_Core_DAO::escapeString($n));
             if ($wildcard) {
                 if (strpos($value, '%') !== FALSE) {
                     // only add wild card if not there
                     $value = "'{$value}'";
//.........这里部分代码省略.........
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:Query.php


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