[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 <?php 2 3 /********************************************************************************* 4 ** The contents of this file are subject to the vtiger CRM Public License Version 1.0 5 * ("License"); You may not use this file except in compliance with the License 6 * The Original Code is: vtiger CRM Open Source 7 * The Initial Developer of the Original Code is vtiger. 8 * Portions created by vtiger are Copyright (C) vtiger. 9 * All Rights Reserved. 10 * 11 ********************************************************************************/ 12 13 14 require_once ('include/utils/UserInfoUtil.php'); 15 require_once ('Smarty_setup.php'); 16 $smarty = new vtigerCRM_Smarty; 17 18 global $mod_strings; 19 global $app_strings; 20 global $app_list_strings; 21 22 23 24 global $adb; 25 global $theme; 26 $theme_path="themes/".$theme."/"; 27 $image_path=$theme_path."images/"; 28 29 30 //Retreiving the hierarchy 31 $hquery = "select * from vtiger_role order by parentrole asc"; 32 $hr_res = $adb->query($hquery); 33 $num_rows = $adb->num_rows($hr_res); 34 $hrarray= Array(); 35 36 for($l=0; $l<$num_rows; $l++) 37 { 38 $roleid = $adb->query_result($hr_res,$l,'roleid'); 39 $parent = $adb->query_result($hr_res,$l,'parentrole'); 40 $temp_list = explode('::',$parent); 41 $size = sizeof($temp_list); 42 $i=0; 43 $k= Array(); 44 $y=$hrarray; 45 if(sizeof($hrarray) == 0) 46 { 47 $hrarray[$temp_list[0]]= Array(); 48 } 49 else 50 { 51 while($i<$size-1) 52 { 53 $y=$y[$temp_list[$i]]; 54 $k[$temp_list[$i]] = $y; 55 $i++; 56 57 } 58 $y[$roleid] = Array(); 59 $k[$roleid] = Array(); 60 61 //Reversing the Array 62 $rev_temp_list=array_reverse($temp_list); 63 $j=0; 64 //Now adding this into the main array 65 foreach($rev_temp_list as $value) 66 { 67 if($j == $size-1) 68 { 69 $hrarray[$value]=$k[$value]; 70 } 71 else 72 { 73 $k[$rev_temp_list[$j+1]][$value]=$k[$value]; 74 } 75 $j++; 76 } 77 } 78 79 } 80 //Constructing the Roledetails array 81 $role_det = getAllRoleDetails(); 82 $query = "select * from vtiger_role"; 83 $result = $adb->query($query); 84 $num_rows=$adb->num_rows($result); 85 $mask_roleid=Array(); 86 $del_roleid=$_REQUEST['maskid']; 87 if($del_roleid != '' && strlen($del_roleid) >0) 88 { 89 $mask_roleid= getRoleAndSubordinatesRoleIds($del_roleid); 90 } 91 $roleout =''; 92 $roleout .= indent($hrarray,$roleout,$role_det,$mask_roleid); 93 94 /** recursive function to construct the role tree ui 95 * @param $hrarray -- Hierarchial role tree array with only the roleid:: Type array 96 * @param $roleout -- html string ouput of the constucted role tree ui:: Type varchar 97 * @param $role_det -- Roledetails array got from calling getAllRoleDetails():: Type array 98 * @param $mask_roleid -- role id to be masked from selecting in the tree:: Type integer 99 * @returns $role_out -- html string ouput of the constucted role tree ui:: Type string 100 * 101 */ 102 function indent($hrarray,$roleout,$role_det,$mask_roleid='') 103 { 104 global $theme; 105 $theme_path="themes/".$theme."/"; 106 $image_path=$theme_path."images/"; 107 foreach($hrarray as $roleid => $value) 108 { 109 110 //retreiving the vtiger_role details 111 $role_det_arr=$role_det[$roleid]; 112 $roleid_arr=$role_det_arr[2]; 113 $rolename = $role_det_arr[0]; 114 $roledepth = $role_det_arr[1]; 115 $roleout .= '<ul class="uil" id="'.$roleid.'" style="display:block;list-style-type:none;">'; 116 $roleout .= '<li >'; 117 if(sizeof($value) >0 && $roledepth != 0) 118 { 119 $roleout .= '<img src="'.$image_path.'/minus.gif" id="img_'.$roleid.'" border="0" alt="Expand/Collapse" title="Expand/Collapse" align="absmiddle" onClick="showhide(\''.$roleid_arr.'\',\'img_'.$roleid.'\')" style="cursor:pointer;">'; 120 } 121 else if($roledepth != 0){ 122 $roleout .= '<img src="'.$image_path.'/vtigerDevDocs.gif" id="img_'.$roleid.'" border="0" alt="Expand/Collapse" title="Expand/Collapse" align="absmiddle">'; 123 } 124 else 125 { 126 $roleout .= '<img src="'.$image_path.'/menu_root.gif" id="img_'.$roleid.'" border="0" alt="Root" title="Root" align="absmiddle">'; 127 } 128 if($roledepth == 0 || in_array($roleid,$mask_roleid)) 129 { 130 $roleout .= ' <b class="genHeaderGray">'.$rolename.'</b>'; 131 } 132 else 133 { 134 $roleout .= ' <a href="javascript:loadValue(\'user_'.$roleid.'\',\''.$roleid.'\');" class="x" id="user_'.$roleid.'">'.$rolename.'</a>'; 135 } 136 $roleout .= '</li>'; 137 if(sizeof($value) > 0 ) 138 { 139 $roleout = indent($value,$roleout,$role_det,$mask_roleid); 140 } 141 142 $roleout .= '</ul>'; 143 144 } 145 146 return $roleout; 147 } 148 $smarty->assign("THEME",$theme_path); 149 $smarty->assign("IMAGE_PATH",$image_path); 150 $smarty->assign("APP", $app_strings); 151 $smarty->assign("CMOD", $mod_strings); 152 $smarty->assign("ROLETREE", $roleout); 153 $smarty->display("RolePopup.tpl"); 154 ?>
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 |