[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 <?php 2 /********************************************************************************* 3 ** The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 * 10 ********************************************************************************/ 11 12 13 /** Class to retreive all the vtiger_users present in a group 14 * 15 */ 16 require_once ('include/utils/UserInfoUtil.php'); 17 require_once ('include/utils/GetParentGroups.php'); 18 19 class GetGroupUsers { 20 21 var $group_users=array(); 22 var $group_subgroups=array(); 23 24 /** to get all the vtiger_users and vtiger_groups of the specified group 25 * @params $groupId --> Group Id :: Type Integer 26 * @returns the vtiger_users present in the group in the variable $parent_groups of the class 27 * @returns the sub vtiger_groups present in the group in the variable $group_subgroups of the class 28 */ 29 function getAllUsersInGroup($groupid) 30 { 31 global $adb,$log; 32 $log->debug("Entering getAllUsersInGroup(".$groupid.") method..."); 33 //Retreiving from the user2grouptable 34 $query="select * from vtiger_users2group where groupid=".$groupid; 35 $result = $adb->query($query); 36 $num_rows=$adb->num_rows($result); 37 for($i=0;$i<$num_rows;$i++) 38 { 39 $now_user_id=$adb->query_result($result,$i,'userid'); 40 if(! in_array($now_user_id,$this->group_users)) 41 { 42 $this->group_users[]=$now_user_id; 43 44 } 45 } 46 47 48 //Retreiving from the vtiger_group2role 49 $query="select * from vtiger_group2role where groupid=".$groupid; 50 $result = $adb->query($query); 51 $num_rows=$adb->num_rows($result); 52 for($i=0;$i<$num_rows;$i++) 53 { 54 $now_role_id=$adb->query_result($result,$i,'roleid'); 55 $now_role_users=array(); 56 $now_role_users=getRoleUsers($now_role_id); 57 58 foreach($now_role_users as $now_role_userid => $now_role_username) 59 { 60 if(! in_array($now_role_userid,$this->group_users)) 61 { 62 $this->group_users[]=$now_role_userid; 63 64 } 65 } 66 67 } 68 69 //Retreiving from the vtiger_group2rs 70 $query="select * from vtiger_group2rs where groupid=".$groupid; 71 $result = $adb->query($query); 72 $num_rows=$adb->num_rows($result); 73 for($i=0;$i<$num_rows;$i++) 74 { 75 $now_rs_id=$adb->query_result($result,$i,'roleandsubid'); 76 $now_rs_users=getRoleAndSubordinateUsers($now_rs_id); 77 foreach($now_rs_users as $now_rs_userid => $now_rs_username) 78 { 79 if(! in_array($now_rs_userid,$this->group_users)) 80 { 81 $this->group_users[]=$now_rs_userid; 82 83 } 84 } 85 86 87 } 88 //Retreving from group2group 89 $query="select * from vtiger_group2grouprel where groupid=".$groupid; 90 $result = $adb->query($query); 91 $num_rows=$adb->num_rows($result); 92 for($i=0;$i<$num_rows;$i++) 93 { 94 $now_grp_id=$adb->query_result($result,$i,'containsgroupid'); 95 96 97 $focus = new GetGroupUsers(); 98 $focus->getAllUsersInGroup($now_grp_id); 99 $now_grp_users=$focus->group_users; 100 $now_grp_grps=$focus->group_subgroups; 101 if(! array_key_exists($now_grp_id,$this->group_subgroups)) 102 { 103 $this->group_subgroups[$now_grp_id]=$now_grp_users; 104 } 105 106 107 108 foreach($focus->group_users as $temp_user_id) 109 { 110 if(! in_array($temp_user_id,$this->group_users)) 111 { 112 $this->group_users[]=$temp_user_id; 113 } 114 } 115 116 117 foreach($focus->group_subgroups as $temp_grp_id => $users_array) 118 { 119 if(! array_key_exists($temp_grp_id,$this->group_subgroups)) 120 { 121 $this->group_subgroups[$temp_grp_id]=$focus->group_users; 122 } 123 } 124 125 } 126 $log->debug("Exiting getAllUsersInGroup method..."); 127 128 } 129 130 131 } 132 133 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |