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


PHP SecurityGroup::getGroupUsersJoin方法代码示例

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


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

示例1: testgetGroupUsersJoin

 public function testgetGroupUsersJoin()
 {
     $securityGroup = new SecurityGroup();
     $expected = " LEFT JOIN (\n            select distinct sec.user_id as id from securitygroups_users sec\n            inner join securitygroups_users secu on sec.securitygroup_id = secu.securitygroup_id and secu.deleted = 0\n                and secu.user_id = '1'\n            where sec.deleted = 0\n        ) securitygroup_join on securitygroup_join.id = users.id ";
     $actual = $securityGroup->getGroupUsersJoin(1);
     $this->assertSame($expected, $actual);
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:7,代码来源:SecurityGroupTest.php

示例2: create_new_list_query


//.........这里部分代码省略.........
                             $search_expression = $matches[0];
                             //Create three search conditions - first + last, first, last
                             $first_name_search = str_replace($data['name'], $params['join_table_alias'] . '.first_name', $search_expression);
                             $last_name_search = str_replace($data['name'], $params['join_table_alias'] . '.last_name', $search_expression);
                             $full_name_search = str_replace($data['name'], db_concat($params['join_table_alias'], $data['db_concat_fields']), $search_expression);
                             $buildWhere = true;
                             $where = str_replace($search_expression, '(' . $full_name_search . ' OR ' . $first_name_search . ' OR ' . $last_name_search . ')', $where);
                         }
                     }
                     if (!$buildWhere) {
                         $db_field = db_concat($params['join_table_alias'], $data['db_concat_fields']);
                         $where = preg_replace('/' . $data['name'] . '/', $db_field, $where);
                     }
                 } else {
                     $where = preg_replace('/(^|[\\s(])' . $data['name'] . '/', '${1}' . $params['join_table_alias'] . '.' . $data['rname'], $where);
                 }
                 if (!$table_joined) {
                     $joined_tables[$params['join_table_alias']] = 1;
                     $joined_tables[$params['join_table_link_alias']] = 1;
                 }
                 $jtcount++;
             }
         }
     }
     if (!empty($filter)) {
         if (isset($this->field_defs['assigned_user_id']) && empty($selectedFields[$this->table_name . '.assigned_user_id'])) {
             $ret_array['select'] .= ", {$this->table_name}.assigned_user_id ";
         } else {
             if (isset($this->field_defs['created_by']) && empty($selectedFields[$this->table_name . '.created_by'])) {
                 $ret_array['select'] .= ", {$this->table_name}.created_by ";
             }
         }
         if (isset($this->field_defs['system_id']) && empty($selectedFields[$this->table_name . '.system_id'])) {
             $ret_array['select'] .= ", {$this->table_name}.system_id ";
         }
     }
     /* BEGIN - SECURITY GROUPS */
     global $current_user, $sugar_config;
     if ($this->module_dir == 'Users' && !is_admin($current_user) && isset($sugar_config['securitysuite_filter_user_list']) && $sugar_config['securitysuite_filter_user_list'] == true) {
         require_once 'modules/SecurityGroups/SecurityGroup.php';
         $owner_where = $this->getOwnerWhere($current_user->id);
         $group_where = 'securitygroup_join.id is not null';
         if (empty($where)) {
             $where = " (" . $owner_where . " or " . $group_where . ") ";
         } else {
             $where .= " AND (" . $owner_where . " or " . $group_where . ") ";
         }
         $securitygroup_join .= SecurityGroup::getGroupUsersJoin($current_user->id);
         $ret_array['from'] .= $securitygroup_join;
         $ret_array['from_min'] .= $securitygroup_join;
         if (!$singleSelect) {
             $ret_array['secondary_from'] .= $securitygroup_join;
         }
     } else {
         if ($this->bean_implements('ACL') && ACLController::requireSecurityGroup($this->module_dir, 'list')) {
             require_once 'modules/SecurityGroups/SecurityGroup.php';
             global $current_user;
             $owner_where = $this->getOwnerWhere($current_user->id);
             $group_where = 'securitygroup_join.id is not null';
             if (empty($where)) {
                 $where = " (" . $owner_where . " or " . $group_where . ") ";
             } else {
                 $where .= " AND (" . $owner_where . " or " . $group_where . ") ";
             }
             $securitygroup_join = SecurityGroup::getGroupJoin($this->table_name, $this->module_dir, $current_user->id);
             $ret_array['from'] .= $securitygroup_join;
             $ret_array['from_min'] .= $securitygroup_join;
             if (!$singleSelect) {
                 $ret_array['secondary_from'] .= $securitygroup_join;
             }
         }
     }
     /* END - SECURITY GROUPS */
     $where_auto = '1=1';
     if ($show_deleted == 0) {
         $where_auto = "{$this->table_name}.deleted=0";
     } else {
         if ($show_deleted == 1) {
             $where_auto = "{$this->table_name}.deleted=1";
         }
     }
     if ($where != "") {
         $ret_array['where'] = " where ({$where}) AND {$where_auto}";
     } else {
         $ret_array['where'] = " where {$where_auto}";
     }
     if (!empty($order_by)) {
         //make call to process the order by clause
         $ret_array['order_by'] = " ORDER BY " . $this->process_order_by($order_by, null);
     }
     if ($singleSelect) {
         unset($ret_array['secondary_where']);
         unset($ret_array['secondary_from']);
         unset($ret_array['secondary_select']);
     }
     if ($return_array) {
         return $ret_array;
     }
     return $ret_array['select'] . $ret_array['from'] . $ret_array['where'] . $ret_array['order_by'];
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:101,代码来源:SugarBean.php


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