[ 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 require_once ('include/database/PearDatabase.php'); 13 global $adb; 14 15 $groupName = trim($_REQUEST['groupName']); 16 $description = $_REQUEST['description']; 17 $mode = $_REQUEST['mode']; 18 19 if(isset($_REQUEST['dup_check']) && $_REQUEST['dup_check']!='') 20 { 21 if($mode != 'edit') 22 { 23 $query = 'select groupname from vtiger_groups where groupname="'.$groupName.'"'; 24 } 25 else 26 { 27 $groupid = $_REQUEST['groupid']; 28 $query = 'select groupname from vtiger_groups where groupname="'.$groupName.'" and groupid !='.$groupid; 29 30 } 31 $result = $adb->query($query); 32 if($adb->num_rows($result) > 0) 33 { 34 echo 'A Group in the specified name "'.$groupName.'" already exists'; 35 die; 36 }else 37 { 38 echo 'SUCESS'; 39 die; 40 } 41 42 } 43 44 45 46 47 /** returns the group members in an formatted array 48 * @param $member_array -- member_array:: Type varchar 49 * @returns $groupMemberArray:: Type varchar 50 51 $groupMemberArray['groups'] -- gives the array of sub groups members ; 52 $groupMemberArray['roles'] -- gives the array of roles present in the group ; 53 $groupMemberArray['rs'] -- gives the array of roles & subordinates present in the group ; 54 $groupMemberArray['users'] -- gives the array of roles & subordinates present in the group; 55 * 56 */ 57 function constructGroupMemberArray($member_array) 58 { 59 global $adb; 60 61 $groupMemberArray=Array(); 62 $roleArray=Array(); 63 $roleSubordinateArray=Array(); 64 $groupArray=Array(); 65 $userArray=Array(); 66 67 foreach($member_array as $member) 68 { 69 $memSubArray=explode('::',$member); 70 if($memSubArray[0] == 'groups') 71 { 72 $groupArray[]=$memSubArray[1]; 73 } 74 if($memSubArray[0] == 'roles') 75 { 76 $roleArray[]=$memSubArray[1]; 77 } 78 if($memSubArray[0] == 'rs') 79 { 80 $roleSubordinateArray[]=$memSubArray[1]; 81 } 82 if($memSubArray[0] == 'users') 83 { 84 $userArray[]=$memSubArray[1]; 85 } 86 } 87 88 $groupMemberArray['groups']=$groupArray; 89 $groupMemberArray['roles']=$roleArray; 90 $groupMemberArray['rs']=$roleSubordinateArray; 91 $groupMemberArray['users']=$userArray; 92 93 return $groupMemberArray; 94 95 } 96 97 if(isset($_REQUEST['returnaction']) && $_REQUEST['returnaction'] != '') 98 { 99 $returnaction=$_REQUEST['returnaction'].'&roleid='.$_REQUEST['roleid']; 100 } 101 else 102 { 103 $returnaction='GroupDetailView'; 104 } 105 106 //Inserting values into Role Table 107 if(isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'edit') 108 { 109 $groupId = $_REQUEST['groupId']; 110 $selected_col_string = $_REQUEST['selectedColumnsString']; 111 $member_array = explode(';',$selected_col_string); 112 $groupMemberArray=constructGroupMemberArray($member_array); 113 updateGroup($groupId,$groupName,$groupMemberArray,$description); 114 115 $loc = "Location: index.php?action=".$returnaction."&module=Users&parenttab=Settings&groupId=".$groupId; 116 } 117 elseif(isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'create') 118 { 119 $selected_col_string = $_REQUEST['selectedColumnsString']; 120 $member_array = explode(';',$selected_col_string); 121 $groupMemberArray=constructGroupMemberArray($member_array); 122 $groupId=createGroup($groupName,$groupMemberArray,$description); 123 $loc = "Location: index.php?action=".$returnaction."&parenttab=Settings&module=Users&groupId=".$groupId; 124 125 } 126 127 header($loc); 128 ?>
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 |