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


PHP CRM_Report_Form::whereGroupClause方法代码示例

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


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

示例1: whereGroupClause

 /**
  * Build where clause for groups.
  *
  * This has been overridden in order to:
  *  1) only build the group clause when filtering
  *  2) render the id field as id rather than contact_id in
  *   order to allow us to join on hte created temp table as if it
  *   were the contact table.
  *
  * Further refactoring could break down the parent function so it can be selectively
  * leveraged.
  *
  * @param string $field
  * @param mixed $value
  * @param string $op
  *
  * @return string
  */
 public function whereGroupClause($field, $value, $op)
 {
     if ($op == 'notin') {
         // We do not have an optimisation for this scenario at this stage. Use
         // parent.
         return parent::whereGroupClause($field, $value, $op);
     }
     if (empty($this->groupTempTable)) {
         $group = new CRM_Contact_DAO_Group();
         $group->is_active = 1;
         $group->find();
         $smartGroups = array();
         while ($group->fetch()) {
             if (in_array($group->id, $this->_params['gid_value']) && $group->saved_search_id) {
                 $smartGroups[] = $group->id;
             }
         }
         CRM_Contact_BAO_GroupContactCache::check($smartGroups);
         $smartGroupQuery = '';
         if (!empty($smartGroups)) {
             $smartGroups = implode(',', $smartGroups);
             $smartGroupQuery = " UNION DISTINCT\n                  SELECT DISTINCT smartgroup_contact.contact_id as id\n                  FROM civicrm_group_contact_cache smartgroup_contact\n                  WHERE smartgroup_contact.group_id IN ({$smartGroups}) ";
         }
         $sqlOp = $this->getSQLOperator($op);
         if (!is_array($value)) {
             $value = array($value);
         }
         $clause = "{$field['dbAlias']} IN (" . implode(', ', $value) . ")";
         $query = "SELECT DISTINCT {$this->_aliases['civicrm_group']}.contact_id as id\n                 FROM civicrm_group_contact {$this->_aliases['civicrm_group']}\n                 WHERE {$clause} AND {$this->_aliases['civicrm_group']}.status = 'Added'\n                 {$smartGroupQuery}  ";
         $this->buildGroupTempTable($query);
     }
     return "1";
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:51,代码来源:Lybunt.php


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