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


PHP CRM_Core_Permission::ufGroupClause方法代码示例

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


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

示例1: getModuleUFGroup

 /**
  * Function to get the uf group for a module
  *
  * @param string $moduleName module name 
  * $param int    $count no to increment the weight
  *
  * @return array $ufGroups array of ufgroups for a module
  * @access public
  * @static
  */
 public static function getModuleUFGroup($moduleName = null, $count = 0, $skipPermission = true)
 {
     require_once 'CRM/Core/DAO.php';
     $dao =& new CRM_Core_DAO();
     $queryString = 'SELECT civicrm_uf_group.id, title, civicrm_uf_group.is_active, is_reserved, group_type
                     FROM civicrm_uf_group
                     LEFT JOIN civicrm_uf_join ON (civicrm_uf_group.id = uf_group_id)';
     $p = array();
     if ($moduleName) {
         $queryString .= ' AND civicrm_uf_group.is_active = 1
                           WHERE civicrm_uf_join.module = %2';
         $p[2] = array($moduleName, 'String');
     }
     // add permissioning for profiles only if not registration
     if (!$skipPermission) {
         require_once 'CRM/Core/Permission.php';
         $permissionClause = CRM_Core_Permission::ufGroupClause(CRM_Core_Permission::VIEW, 'civicrm_uf_group.');
         if (strpos($queryString, 'WHERE') !== false) {
             $queryString .= " AND {$permissionClause} ";
         } else {
             $queryString .= " {$permissionClause} ";
         }
     }
     $queryString .= ' ORDER BY civicrm_uf_join.weight, civicrm_uf_group.title';
     $dao =& CRM_Core_DAO::executeQuery($queryString, $p);
     $ufGroups = array();
     require_once 'CRM/Core/BAO/UFField.php';
     while ($dao->fetch()) {
         //skip mix profiles in user Registration / User Account
         if (($moduleName == 'User Registration' || $moduleName == 'User Account') && CRM_Core_BAO_UFField::checkProfileType($dao->id)) {
             continue;
         }
         $ufGroups[$dao->id]['name'] = $dao->title;
         $ufGroups[$dao->id]['title'] = $dao->title;
         $ufGroups[$dao->id]['is_active'] = $dao->is_active;
         $ufGroups[$dao->id]['group_type'] = $dao->group_type;
         $ufGroups[$dao->id]['is_reserved'] = $dao->is_reserved;
     }
     return $ufGroups;
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:50,代码来源:UFGroup.php

示例2: getModuleUFGroup

 /**
  * Get the uf group for a module.
  *
  * @param string $moduleName
  *   Module name.
  * @param int $count
  *   No to increment the weight.
  * @param bool $skipPermission
  * @param int $op
  *   Which operation (view, edit, create, etc) to check permission for.
  * @param array|NULL $returnFields list of UFGroup fields to return; NULL for default
  *
  * @return array
  *   array of ufgroups for a module
  */
 public static function getModuleUFGroup($moduleName = NULL, $count = 0, $skipPermission = TRUE, $op = CRM_Core_Permission::VIEW, $returnFields = NULL)
 {
     $selectFields = array('id', 'title', 'created_id', 'is_active', 'is_reserved', 'group_type');
     if (!CRM_Core_Config::isUpgradeMode()) {
         // CRM-13555, since description field was added later (4.4), and to avoid any problems with upgrade
         $selectFields[] = 'description';
     }
     if (!empty($returnFields)) {
         $selectFields = array_merge($returnFields, array_diff($selectFields, $returnFields));
     }
     $queryString = 'SELECT civicrm_uf_group.' . implode(', civicrm_uf_group.', $selectFields) . '
                     FROM civicrm_uf_group
                     LEFT JOIN civicrm_uf_join ON (civicrm_uf_group.id = uf_group_id)';
     $p = array();
     if ($moduleName) {
         $queryString .= ' AND civicrm_uf_group.is_active = 1
                           WHERE civicrm_uf_join.module = %2';
         $p[2] = array($moduleName, 'String');
     }
     // add permissioning for profiles only if not registration
     if (!$skipPermission) {
         $permissionClause = CRM_Core_Permission::ufGroupClause($op, 'civicrm_uf_group.');
         if (strpos($queryString, 'WHERE') !== FALSE) {
             $queryString .= " AND {$permissionClause} ";
         } else {
             $queryString .= " {$permissionClause} ";
         }
     }
     $queryString .= ' ORDER BY civicrm_uf_join.weight, civicrm_uf_group.title';
     $dao = CRM_Core_DAO::executeQuery($queryString, $p);
     $ufGroups = array();
     while ($dao->fetch()) {
         //skip mix profiles in user Registration / User Account
         if (($moduleName == 'User Registration' || $moduleName == 'User Account') && CRM_Core_BAO_UFField::checkProfileType($dao->id)) {
             continue;
         }
         foreach ($selectFields as $key => $field) {
             if ($field == 'id') {
                 continue;
             }
             $ufGroups[$dao->id][$field] = $dao->{$field};
         }
     }
     // Allow other modules to alter/override the UFGroups.
     CRM_Utils_Hook::buildUFGroupsForModule($moduleName, $ufGroups);
     return $ufGroups;
 }
开发者ID:rollox,项目名称:civicrm-core,代码行数:62,代码来源:UFGroup.php

示例3: getModuleUFGroup

 /**
  * Function to get the uf group for a module
  *
  * @param string $moduleName module name
  * $param int    $count no to increment the weight
  *
  * @return array $ufGroups array of ufgroups for a module
  * @access public
  * @static
  */
 public static function getModuleUFGroup($moduleName = NULL, $count = 0, $skipPermission = TRUE)
 {
     $dao = new CRM_Core_DAO();
     $queryString = 'SELECT civicrm_uf_group.id, title, civicrm_uf_group.is_active, is_reserved, group_type
                     FROM civicrm_uf_group
                     LEFT JOIN civicrm_uf_join ON (civicrm_uf_group.id = uf_group_id)';
     $p = array();
     if ($moduleName) {
         $queryString .= ' AND civicrm_uf_group.is_active = 1
                           WHERE civicrm_uf_join.module = %2';
         $p[2] = array($moduleName, 'String');
     }
     // add permissioning for profiles only if not registration
     if (!$skipPermission) {
         $permissionClause = CRM_Core_Permission::ufGroupClause(CRM_Core_Permission::VIEW, 'civicrm_uf_group.');
         if (strpos($queryString, 'WHERE') !== FALSE) {
             $queryString .= " AND {$permissionClause} ";
         } else {
             $queryString .= " {$permissionClause} ";
         }
     }
     $queryString .= ' ORDER BY civicrm_uf_join.weight, civicrm_uf_group.title';
     $dao = CRM_Core_DAO::executeQuery($queryString, $p);
     $ufGroups = array();
     while ($dao->fetch()) {
         //skip mix profiles in user Registration / User Account
         if (($moduleName == 'User Registration' || $moduleName == 'User Account') && CRM_Core_BAO_UFField::checkProfileType($dao->id)) {
             continue;
         }
         $ufGroups[$dao->id]['name'] = $dao->title;
         $ufGroups[$dao->id]['title'] = $dao->title;
         $ufGroups[$dao->id]['is_active'] = $dao->is_active;
         $ufGroups[$dao->id]['group_type'] = $dao->group_type;
         $ufGroups[$dao->id]['is_reserved'] = $dao->is_reserved;
     }
     // Allow other modules to alter/override the UFGroups.
     CRM_Utils_Hook::buildUFGroupsForModule($moduleName, $ufGroups);
     return $ufGroups;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:49,代码来源:UFGroup.php


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