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


PHP CRM_Utils_Hook::selectWhereClause方法代码示例

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


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

示例1: addSelectWhereClause

 /**
  * Generates acl clauses suitable for adding to WHERE or ON when doing an api.get for this entity
  *
  * Return format is in the form of fieldname => clauses starting with an operator. e.g.:
  * @code
  *   array(
  *     'location_type_id' => array('IS NOT NULL', 'IN (1,2,3)')
  *   )
  * @endcode
  *
  * Note that all array keys must be actual field names in this entity. Use subqueries to filter on other tables e.g. custom values.
  *
  * @return array
  */
 public function addSelectWhereClause()
 {
     // This is the default fallback, and works for contact-related entities like Email, Relationship, etc.
     $clauses = array();
     foreach ($this->fields() as $fieldName => $field) {
         if (strpos($fieldName, 'contact_id') === 0 && CRM_Utils_Array::value('FKClassName', $field) == 'CRM_Contact_DAO_Contact') {
             $clauses[$fieldName] = CRM_Utils_SQL::mergeSubquery('Contact');
         }
     }
     CRM_Utils_Hook::selectWhereClause($this, $clauses);
     return $clauses;
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:26,代码来源:DAO.php

示例2: addSelectWhereClause

 /**
  * @inheritDoc
  */
 public function addSelectWhereClause()
 {
     // Prevent default behavior of joining ACLs onto the contact_id field
     $clauses = array();
     CRM_Utils_Hook::selectWhereClause($this, $clauses);
     return $clauses;
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:10,代码来源:UFMatch.php

示例3: addSelectWhereClause

 /**
  * @inheritDoc
  */
 public function addSelectWhereClause()
 {
     // We always return an array with these keys, even if they are empty,
     // because this tells the query builder that we have considered these fields for acls
     $clauses = array('id' => array(), 'is_deleted' => CRM_Core_Permission::check('administer CiviCase') ? array() : array("= 0"));
     // Ensure the user has permission to view the case client
     $contactClause = CRM_Utils_SQL::mergeSubquery('Contact');
     if ($contactClause) {
         $contactClause = implode(' AND contact_id ', $contactClause);
         $clauses['id'][] = "IN (SELECT case_id FROM civicrm_case_contact WHERE contact_id {$contactClause})";
     }
     // The api gatekeeper ensures the user has at least "access my cases and activities"
     // so if they do not have permission to see all cases we'll assume they can only access their own
     if (!CRM_Core_Permission::check('access all cases and activities')) {
         $user = (int) CRM_Core_Session::getLoggedInContactID();
         $clauses['id'][] = "IN (\n        SELECT r.case_id FROM civicrm_relationship r, civicrm_case_contact cc WHERE r.is_active = 1 AND cc.case_id = r.case_id AND (\n          (r.contact_id_a = cc.contact_id AND r.contact_id_b = {$user}) OR (r.contact_id_b = cc.contact_id AND r.contact_id_a = {$user})\n        )\n      )";
     }
     CRM_Utils_Hook::selectWhereClause($this, $clauses);
     return $clauses;
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:23,代码来源:Case.php

示例4: addSelectWhereClause

 /**
  * @inheritDoc
  */
 public function addSelectWhereClause()
 {
     // We always return an array with these keys, even if they are empty,
     // because this tells the query builder that we have considered these fields for acls
     $clauses = array('id' => (array) CRM_Contact_BAO_Contact_Permission::cacheSubquery(), 'is_deleted' => CRM_Core_Permission::check('access deleted contacts') ? array() : array('!= 1'));
     CRM_Utils_Hook::selectWhereClause($this, $clauses);
     return $clauses;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:11,代码来源:Contact.php

示例5: addSelectWhereClause

 /**
  * Generates acl clauses suitable for adding to WHERE or ON when doing an api.get for this entity
  *
  * Return format is in the form of fieldname => clauses starting with an operator. e.g.:
  * @code
  *   array(
  *     'location_type_id' => array('IS NOT NULL', 'IN (1,2,3)')
  *   )
  * @endcode
  *
  * Note that all array keys must be actual field names in this entity. Use subqueries to filter on other tables e.g. custom values.
  *
  * @return array
  */
 public function addSelectWhereClause()
 {
     $clauses = array();
     $fields = $this->fields();
     foreach ($fields as $fieldName => $field) {
         // Clause for contact-related entities like Email, Relationship, etc.
         if (strpos($fieldName, 'contact_id') === 0 && CRM_Utils_Array::value('FKClassName', $field) == 'CRM_Contact_DAO_Contact') {
             $clauses[$fieldName] = CRM_Utils_SQL::mergeSubquery('Contact');
         }
         // Clause for an entity_table/entity_id combo
         if ($fieldName == 'entity_id' && isset($fields['entity_table'])) {
             $relatedClauses = array();
             $relatedEntities = $this->buildOptions('entity_table', 'get');
             foreach ((array) $relatedEntities as $table => $ent) {
                 if (!empty($ent)) {
                     $ent = CRM_Core_DAO_AllCoreTables::getBriefName(CRM_Core_DAO_AllCoreTables::getClassForTable($table));
                     $subquery = CRM_Utils_SQL::mergeSubquery($ent);
                     if ($subquery) {
                         $relatedClauses[] = "(entity_table = '{$table}' AND entity_id " . implode(' AND entity_id ', $subquery) . ")";
                     } else {
                         $relatedClauses[] = "(entity_table = '{$table}')";
                     }
                 }
             }
             if ($relatedClauses) {
                 $clauses['id'] = 'IN (SELECT id FROM `' . $this->tableName() . '` WHERE (' . implode(') OR (', $relatedClauses) . '))';
             }
         }
     }
     CRM_Utils_Hook::selectWhereClause($this, $clauses);
     return $clauses;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:46,代码来源:DAO.php


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