[ 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 require_once ('Smarty_setup.php'); 14 require_once ('include/utils/utils.php'); 15 global $mod_strings, $app_strings; 16 global $theme; 17 $theme_path="themes/".$theme."/"; 18 $image_path=$theme_path."images/"; 19 20 $module_array = getModuleNameList(); 21 if($_REQUEST['list_module_mode'] != '' && $_REQUEST['list_module_mode'] == 'save') 22 { 23 foreach($module_array as $val) 24 { 25 $req_name = 'user_'.strtolower($val); 26 $userid = $_REQUEST[$req_name]; 27 $tabid = getTabid($val); 28 if($tabid != '' && $userid != '') 29 { 30 $sql = 'update vtiger_moduleowners set user_id = '.$userid.' where tabid = '.$tabid; 31 $adb->query($sql); 32 } 33 } 34 35 } 36 elseif($_REQUEST['list_module_mode'] != '' && $_REQUEST['list_module_mode'] == 'edit') 37 { 38 $user_array = get_user_array(false); 39 foreach($module_array as $val) 40 { 41 $user_combo = getUserCombo($user_array,$val); 42 43 $user_list []= $val; 44 $user_list []= $user_combo; 45 46 } 47 $user_list = array_chunk($user_list,2); 48 } 49 50 $smarty = new vtigerCRM_Smarty; 51 if($_REQUEST['list_module_mode'] != 'edit') 52 { 53 foreach($module_array as $val) 54 { 55 $user_list []= $val; 56 57 //get the user array as a combo list 58 $user_id = getModuleOwner(getTabid($val)); 59 $user_name = getUserName($user_id); 60 61 $user_list []= $user_id; 62 $user_list []= $user_name; 63 } 64 65 $user_list = array_chunk($user_list,3); 66 } 67 $log->info("Settings Module Owners view"); 68 69 $smarty->assign("MODULE_MODE",$_REQUEST['list_module_mode']); 70 $smarty->assign("USER_LIST", $user_list); 71 $smarty->assign("MOD", return_module_language($current_language,'Settings')); 72 $smarty->assign("IMAGE_PATH",$image_path); 73 $smarty->assign("APP", $app_strings); 74 $smarty->assign("CMOD", $mod_strings); 75 76 if($_REQUEST['file_mode'] != 'ajax') 77 $smarty->display("Settings/ModuleOwners.tpl"); 78 else 79 $smarty->display("Settings/ModuleOwnersContents.tpl"); 80 81 /** Function to get the module owner for the tabid 82 * @ param $tabid 83 * It gets the module owner for the given tabid from vtiger_moduleowners table 84 * returns the userid of the module owner for the given tabid 85 */ 86 function getModuleOwner($tabid) 87 { 88 global $adb; 89 $sql = "select * from vtiger_moduleowners where tabid=".$tabid; 90 $res = $adb->query($sql); 91 $userid = $adb->query_result($res,0,'user_id'); 92 93 return $userid; 94 } 95 /** Function to get the module List to which the owners can be assigned 96 * It gets the module list and returns in an array 97 */ 98 function getModuleNameList() 99 { 100 global $adb; 101 102 $sql = "select vtiger_moduleowners.*, vtiger_tab.name from vtiger_moduleowners inner join vtiger_tab on vtiger_moduleowners.tabid = vtiger_tab.tabid order by vtiger_tab.tabsequence"; 103 $res = $adb->query($sql); 104 $mod_array = Array(); 105 while($row = $adb->fetchByAssoc($res)) 106 { 107 array_push($mod_array,$row['name']); 108 } 109 return $mod_array; 110 } 111 /** Function to get combostrings of users 112 * @ $user_array : type Array 113 * @ $modulename : Type String 114 * returns the html string for module owners for the given module owners 115 */ 116 117 function getUserCombo($user_array,$name) 118 { 119 global $adb; 120 121 $tabid = getTabid($name); 122 $sql = "select * from vtiger_moduleowners where tabid=".$tabid; 123 $res = $adb->query($sql); 124 $db_userid = $adb->query_result($res,0,'user_id'); 125 126 //Form the user combo list for each module 127 $combo_name = "user_".strtolower($name); 128 $user_combo = '<select name="'.$combo_name.'">'; 129 foreach($user_array as $user_id => $user_name) 130 { 131 $selected = ''; 132 if($user_id == $db_userid) 133 { 134 $selected = 'selected'; 135 } 136 $user_combo .= '<OPTION value="'.$user_id.'" '.$selected.'>'.$user_name.'</OPTION>'; 137 } 138 $user_combo .= '</select>'; 139 140 return $user_combo; 141 } 142 ?>
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 |