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


PHP SecurityGroup::getGroupJoin方法代码示例

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


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

示例1: testgetGroupJoin

 public function testgetGroupJoin()
 {
     $securityGroup = new SecurityGroup();
     //test with securitygroups module
     $expected = " LEFT JOIN (select distinct secg.id from securitygroups secg\n    inner join securitygroups_users secu on secg.id = secu.securitygroup_id and secu.deleted = 0\n            and secu.user_id = '1'\n    where secg.deleted = 0\n) securitygroup_join on securitygroup_join.id = securitygroups.id ";
     $actual = $securityGroup->getGroupJoin('securitygroups', 'SecurityGroups', 1);
     $this->assertSame($expected, $actual);
     //test with //test with securitygroups module
     $expected = " LEFT JOIN (select distinct secr.record_id as id from securitygroups secg\n    inner join securitygroups_users secu on secg.id = secu.securitygroup_id and secu.deleted = 0\n            and secu.user_id = '1'\n    inner join securitygroups_records secr on secg.id = secr.securitygroup_id and secr.deleted = 0\n             and secr.module = 'Users'\n    where secg.deleted = 0\n) securitygroup_join on securitygroup_join.id = users.id ";
     $actual = $securityGroup->getGroupJoin('users', 'Users', 1);
     $this->assertSame($expected, $actual);
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:12,代码来源:SecurityGroupTest.php

示例2: findEmailFromBeanIds

 function findEmailFromBeanIds($beanIds, $beanType, $whereArr)
 {
     global $current_user;
     $q = '';
     $whereAdd = "";
     $relatedIDs = '';
     if ($beanIds != '') {
         foreach ($beanIds as $key => $value) {
             $beanIds[$key] = '\'' . $value . '\'';
         }
         $relatedIDs = implode(',', $beanIds);
     }
     if ($beanType == 'accounts') {
         if (isset($whereArr['first_name'])) {
             $whereArr['name'] = $whereArr['first_name'];
         }
         unset($whereArr['last_name']);
         unset($whereArr['first_name']);
     }
     foreach ($whereArr as $column => $clause) {
         if (!empty($whereAdd)) {
             $whereAdd .= " OR ";
         }
         $clause = $current_user->db->helper->escape_quote($clause);
         $whereAdd .= "{$column} LIKE '{$clause}%'";
     }
     $table = $beanType;
     $module = ucfirst($table);
     $class = substr($module, 0, strlen($module) - 1);
     require_once "modules/{$module}/{$class}.php";
     $person = new $class();
     if ($person->ACLAccess('list')) {
         if ($relatedIDs != '') {
             $where = "({$table}.deleted = 0 AND eabr.primary_address = 1 AND {$table}.id in ({$relatedIDs}))";
         } else {
             $where = "({$table}.deleted = 0 AND eabr.primary_address = 1)";
         }
         if (ACLController::requireOwner($module, 'list')) {
             $where = $where . " AND ({$table}.assigned_user_id = '{$current_user->id}')";
         }
         // if
         if (!empty($whereAdd)) {
             $where .= " AND ({$whereAdd})";
         }
         if ($beanType === 'accounts') {
             $t = "SELECT {$table}.id, '' first_name, {$table}.name last_name, eabr.primary_address, ea.email_address, '{$module}' module ";
         } else {
             $t = "SELECT {$table}.id, {$table}.first_name, {$table}.last_name, eabr.primary_address, ea.email_address, '{$module}' module ";
         }
         $t .= "FROM {$table} ";
         $t .= "JOIN email_addr_bean_rel eabr ON ({$table}.id = eabr.bean_id and eabr.deleted=0) ";
         $t .= "JOIN email_addresses ea ON (eabr.email_address_id = ea.id) ";
         /* BEGIN - SECURITY GROUPS */
         if ($person->bean_implements('ACL') && ACLController::requireSecurityGroup($module, 'list')) {
             require_once 'modules/SecurityGroups/SecurityGroup.php';
             global $current_user;
             $t .= SecurityGroup::getGroupJoin($table, $module, $current_user->id);
         }
         /* END - SECURITY GROUPS */
         $t .= " WHERE {$where}";
         /* BEGIN - SECURITY GROUPS */
         if ($person->bean_implements('ACL') && ACLController::requireSecurityGroup($module, 'list')) {
             require_once 'modules/SecurityGroups/SecurityGroup.php';
             global $current_user;
             $owner_where = $person->getOwnerWhere($current_user->id);
             $group_where = 'securitygroup_join.id is not null';
             $t .= " AND (" . $owner_where . " or " . $group_where . ") ";
         }
         /* END - SECURITY GROUPS */
     }
     // if
     return $t;
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:73,代码来源:EmailUI.php

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