[ 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 require_once ('include/utils/utils.php'); 12 require_once ('include/utils/UserInfoUtil.php'); 13 global $mod_strings; 14 global $app_strings; 15 global $app_list_strings; 16 17 global $theme; 18 $theme_path="themes/".$theme."/"; 19 $image_path=$theme_path."images/"; 20 require_once ($theme_path.'layout_utils.php'); 21 22 $smarty = new vtigerCRM_Smarty; 23 24 $defSharingPermissionData = getDefaultSharingAction(); 25 $access_privileges = array(); 26 $row=1; 27 foreach($defSharingPermissionData as $tab_id => $def_perr) 28 { 29 30 $entity_name = getTabname($tab_id); 31 if($tab_id == 6) 32 { 33 $cont_name = getTabname(4); 34 $entity_name .= ' & '.$cont_name; 35 } 36 37 $entity_perr = getDefOrgShareActionName($def_perr); 38 39 $access_privileges[] = $entity_name; 40 $access_privileges[] = $entity_perr; 41 if($entity_perr != 'Private') 42 $access_privileges[] = $mod_strings['LBL_USR_CAN_ACCESS'] .str_replace('Public:','',$mod_strings[$entity_perr]). $mod_strings['LBL_USR_OTHERS'] . $app_strings[$entity_name]; 43 else 44 $access_privileges[] = $mod_strings['LBL_USR_CANNOT_ACCESS'] . $app_strings[$entity_name]; 45 $row++; 46 } 47 $access_privileges=array_chunk($access_privileges,3); 48 $smarty->assign("DEFAULT_SHARING", $access_privileges); 49 50 $custom_access = array(); 51 //Lead Sharing 52 $custom_access['Leads'] = getSharingRuleList('Leads'); 53 54 //Account Sharing 55 $custom_access['Accounts'] = getSharingRuleList('Accounts'); 56 57 //Potential Sharing 58 $custom_access['Potentials'] = getSharingRuleList('Potentials'); 59 60 //HelpDesk Sharing 61 $custom_access['HelpDesk'] = getSharingRuleList('HelpDesk'); 62 63 //Email Sharing 64 //$custom_access['Emails'] = getSharingRuleList('Emails'); 65 66 //Campaign Sharing 67 $custom_access['Campaigns'] = getSharingRuleList('Campaigns'); 68 69 //Quotes Sharing 70 $custom_access['Quotes'] = getSharingRuleList('Quotes'); 71 72 //Purchase Order Sharing 73 $custom_access['PurchaseOrder'] = getSharingRuleList('PurchaseOrder'); 74 75 //Sales Order Sharing 76 $custom_access['SalesOrder'] = getSharingRuleList('SalesOrder'); 77 78 //Invoice Sharing 79 $custom_access['Invoice'] = getSharingRuleList('Invoice'); 80 81 82 83 $smarty->assign("MODSHARING", $custom_access); 84 85 /** returns the list of sharing rules for the specified module 86 * @param $module -- Module Name:: Type varchar 87 * @returns $access_permission -- sharing rules list info array:: Type array 88 * 89 */ 90 function getSharingRuleList($module) 91 { 92 global $adb; 93 94 $tabid=getTabid($module); 95 $dataShareTableArray=getDataShareTableandColumnArray(); 96 97 $i=1; 98 $access_permission = array(); 99 foreach($dataShareTableArray as $table_name => $colName) 100 { 101 102 $colNameArr=explode("::",$colName); 103 $query = "select ".$table_name.".* from ".$table_name." inner join vtiger_datashare_module_rel on ".$table_name.".shareid=vtiger_datashare_module_rel.shareid where vtiger_datashare_module_rel.tabid=".$tabid; 104 $result=$adb->query($query); 105 $num_rows=$adb->num_rows($result); 106 107 $share_colName=$colNameArr[0]; 108 $share_modType=getEntityTypeFromCol($share_colName); 109 110 $to_colName=$colNameArr[1]; 111 $to_modType=getEntityTypeFromCol($to_colName); 112 113 for($j=0;$j<$num_rows;$j++) 114 { 115 $shareid=$adb->query_result($result,$j,"shareid"); 116 $share_id=$adb->query_result($result,$j,$share_colName); 117 $to_id=$adb->query_result($result,$j,$to_colName); 118 $permission = $adb->query_result($result,$j,'permission'); 119 120 $share_ent_disp = getEntityDisplayLink($share_modType,$share_id); 121 $to_ent_disp = getEntityDisplayLink($to_modType,$to_id); 122 123 if($permission == 0) 124 { 125 $perr_out = 'Read Only'; 126 } 127 elseif($permission == 1) 128 { 129 $perr_out = 'Read / Write'; 130 } 131 132 $access_permission [] = $shareid; 133 $access_permission [] = $share_ent_disp; 134 $access_permission [] = $to_ent_disp; 135 $access_permission [] = $perr_out; 136 137 $i++; 138 } 139 140 } 141 if(is_array($access_permission)) 142 $access_permission = array_chunk($access_permission,4); 143 return $access_permission; 144 } 145 146 $smarty->assign("IMAGE_PATH",$image_path); 147 $smarty->assign("APP", $app_strings); 148 $smarty->assign("CMOD", $mod_strings); 149 $smarty->assign("MOD", return_module_language($current_language,'Settings')); 150 151 $smarty->display("OrgSharingDetailView.tpl"); 152 ?>
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 |