[ 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 ('data/Tracker.php'); 12 13 global $mod_strings; 14 global $app_list_strings; 15 global $app_strings; 16 global $current_user; 17 $focus = 0; 18 global $theme; 19 global $log; 20 21 //<<<<<>>>>>> 22 global $oCustomView; 23 //<<<<<>>>>>> 24 25 $error_msg = ''; 26 $theme_path="themes/".$theme."/"; 27 $image_path=$theme_path."images/"; 28 require_once ($theme_path.'layout_utils.php'); 29 require_once ('modules/CustomView/CustomView.php'); 30 31 $cv_module = $_REQUEST['module']; 32 33 $recordid = $_REQUEST['record']; 34 35 $smarty->assign("MOD", $mod_strings); 36 $smarty->assign("CATEGORY", $_REQUEST['parenttab']); 37 $smarty->assign("APP", $app_strings); 38 $smarty->assign("IMAGE_PATH", $image_path); 39 $smarty->assign("MODULE",$cv_module); 40 $smarty->assign("CVMODULE", $cv_module); 41 $smarty->assign("CUSTOMVIEWID",$recordid); 42 $smarty->assign("DATAFORMAT",$current_user->date_format); 43 if($recordid == "") 44 { 45 $oCustomView = new CustomView(); 46 $modulecollist = $oCustomView->getModuleColumnsList($cv_module); 47 $log->info('CustomView :: Successfully got ColumnsList for the module'.$cv_module); 48 if(isset($modulecollist)) 49 { 50 $choosecolhtml = getByModule_ColumnsHTML($cv_module,$modulecollist); 51 } 52 //step2 53 $stdfilterhtml = $oCustomView->getStdFilterCriteria(); 54 $log->info('CustomView :: Successfully got StandardFilter for the module'.$cv_module); 55 $stdfiltercolhtml = getStdFilterHTML($cv_module); 56 $stdfilterjs = $oCustomView->getCriteriaJS(); 57 58 //step4 59 $advfilterhtml = getAdvCriteriaHTML(); 60 for($i=1;$i<10;$i++) 61 { 62 $smarty->assign("CHOOSECOLUMN".$i,$choosecolhtml); 63 } 64 $log->info('CustomView :: Successfully got AdvancedFilter for the module'.$cv_module); 65 for($i=1;$i<6;$i++) 66 { 67 $smarty->assign("FOPTION".$i,$advfilterhtml); 68 $smarty->assign("BLOCK".$i,$choosecolhtml); 69 } 70 71 $smarty->assign("STDFILTERCOLUMNS",$stdfiltercolhtml); 72 $smarty->assign("STDFILTERCRITERIA",$stdfilterhtml); 73 $smarty->assign("STDFILTER_JAVASCRIPT",$stdfilterjs); 74 75 $smarty->assign("MANDATORYCHECK",implode(",",$oCustomView->mandatoryvalues)); 76 $smarty->assign("SHOWVALUES",implode(",",$oCustomView->showvalues)); 77 } 78 else 79 { 80 $oCustomView = new CustomView(); 81 82 $customviewdtls = $oCustomView->getCustomViewByCvid($recordid); 83 $log->info('CustomView :: Successfully got ViewDetails for the Viewid'.$recordid); 84 $modulecollist = $oCustomView->getModuleColumnsList($cv_module); 85 $selectedcolumnslist = $oCustomView->getColumnsListByCvid($recordid); 86 $log->info('CustomView :: Successfully got ColumnsList for the Viewid'.$recordid); 87 88 $smarty->assign("VIEWNAME",$customviewdtls["viewname"]); 89 90 if($customviewdtls["setdefault"] == 1) 91 { 92 $smarty->assign("CHECKED","checked"); 93 } 94 if($customviewdtls["setmetrics"] == 1) 95 { 96 $smarty->assign("MCHECKED","checked"); 97 } 98 for($i=1;$i<10;$i++) 99 { 100 $choosecolhtml = getByModule_ColumnsHTML($cv_module,$modulecollist,$selectedcolumnslist[$i-1]); 101 $smarty->assign("CHOOSECOLUMN".$i,$choosecolhtml); 102 } 103 104 $stdfilterlist = $oCustomView->getStdFilterByCvid($recordid); 105 $log->info('CustomView :: Successfully got Standard Filter for the Viewid'.$recordid); 106 $stdfilterhtml = $oCustomView->getStdFilterCriteria($stdfilterlist["stdfilter"]); 107 $stdfiltercolhtml = getStdFilterHTML($cv_module,$stdfilterlist["columnname"]); 108 $stdfilterjs = $oCustomView->getCriteriaJS(); 109 110 if(isset($stdfilterlist["startdate"]) && isset($stdfilterlist["enddate"])) 111 { 112 $smarty->assign("STARTDATE",$stdfilterlist["startdate"]); 113 $smarty->assign("ENDDATE",$stdfilterlist["enddate"]); 114 } 115 116 $advfilterlist = $oCustomView->getAdvFilterByCvid($recordid); 117 $log->info('CustomView :: Successfully got Advanced Filter for the Viewid'.$recordid,'info'); 118 for($i=1;$i<6;$i++) 119 { 120 $advfilterhtml = getAdvCriteriaHTML($advfilterlist[$i-1]["comparator"]); 121 $advcolumnhtml = getByModule_ColumnsHTML($cv_module,$modulecollist,$advfilterlist[$i-1]["columnname"]); 122 $smarty->assign("FOPTION".$i,$advfilterhtml); 123 $smarty->assign("BLOCK".$i,$advcolumnhtml); 124 $smarty->assign("VALUE".$i,$advfilterlist[$i-1]["value"]); 125 } 126 127 $smarty->assign("STDFILTERCOLUMNS",$stdfiltercolhtml); 128 $smarty->assign("STDFILTERCRITERIA",$stdfilterhtml); 129 $smarty->assign("STDFILTER_JAVASCRIPT",$stdfilterjs); 130 131 $smarty->assign("MANDATORYCHECK",implode(",",$oCustomView->mandatoryvalues)); 132 $smarty->assign("SHOWVALUES",implode(",",$oCustomView->showvalues)); 133 134 $cactionhtml = "<input name='customaction' class='button' type='button' value='Create Custom Action' onclick=goto_CustomAction('".$cv_module."');>"; 135 136 if($cv_module == "Leads" || $cv_module == "Accounts" || $cv_module == "Contacts") 137 { 138 $smarty->assign("CUSTOMACTIONBUTTON",$cactionhtml); 139 } 140 } 141 142 $smarty->assign("RETURN_MODULE", $cv_module); 143 if($cv_module == "Calendar") 144 $return_action = "ListView"; 145 else 146 $return_action = "index"; 147 148 $smarty->assign("RETURN_ACTION", $return_action); 149 150 $smarty->display("CustomView.tpl"); 151 152 /** to get the custom columns for the given module and columnlist 153 * @param $module (modulename):: type String 154 * @param $columnslist (Module columns list):: type Array 155 * @param $selected (selected or not):: type String (Optional) 156 * @returns $advfilter_out array in the following format 157 * $advfilter_out = Array ('BLOCK1 NAME'=> 158 * Array(0=> 159 * Array('value'=>$tablename:$colname:$fieldname:$fieldlabel:$typeofdata, 160 * 'text'=>$fieldlabel, 161 * 'selected'=><selected or ''>), 162 * 1=> 163 * Array('value'=>$tablename1:$colname1:$fieldname1:$fieldlabel1:$typeofdata1, 164 * 'text'=>$fieldlabel1, 165 * 'selected'=><selected or ''>) 166 * ), 167 * | 168 * | 169 * n=> 170 * Array('value'=>$tablenamen:$colnamen:$fieldnamen:$fieldlabeln:$typeofdatan, 171 * 'text'=>$fieldlabeln, 172 * 'selected'=><selected or ''>) 173 * ), 174 * 'BLOCK2 NAME'=> 175 * Array(0=> 176 * Array('value'=>$tablename:$colname:$fieldname:$fieldlabel:$typeofdata, 177 * 'text'=>$fieldlabel, 178 * 'selected'=><selected or ''>), 179 * 1=> 180 * Array('value'=>$tablename1:$colname1:$fieldname1:$fieldlabel1:$typeofdata1, 181 * 'text'=>$fieldlabel1, 182 * 'selected'=><selected or ''>) 183 * ) 184 * | 185 * | 186 * n=> 187 * Array('value'=>$tablenamen:$colnamen:$fieldnamen:$fieldlabeln:$typeofdatan, 188 * 'text'=>$fieldlabeln, 189 * 'selected'=><selected or ''>) 190 * ), 191 * 192 * || 193 * || 194 * 'BLOCK_N NAME'=> 195 * Array(0=> 196 * Array('value'=>$tablename:$colname:$fieldname:$fieldlabel:$typeofdata, 197 * 'text'=>$fieldlabel, 198 * 'selected'=><selected or ''>), 199 * 1=> 200 * Array('value'=>$tablename1:$colname1:$fieldname1:$fieldlabel1:$typeofdata1, 201 * 'text'=>$fieldlabel1, 202 * 'selected'=><selected or ''>) 203 * ) 204 * | 205 * | 206 * n=> 207 * Array('value'=>$tablenamen:$colnamen:$fieldnamen:$fieldlabeln:$typeofdatan, 208 * 'text'=>$fieldlabeln, 209 * 'selected'=><selected or ''>) 210 * ), 211 * 212 */ 213 214 function getByModule_ColumnsHTML($module,$columnslist,$selected="") 215 { 216 global $oCustomView; 217 global $app_list_strings; 218 $advfilter = array(); 219 $mod_strings = return_module_language($current_language,$module); 220 221 foreach($oCustomView->module_list[$module] as $key=>$value) 222 { 223 $advfilter = array(); 224 $label = $key; 225 if(isset($columnslist[$module][$key])) 226 { 227 foreach($columnslist[$module][$key] as $field=>$fieldlabel) 228 { 229 if(isset($mod_strings[$fieldlabel])) 230 { 231 if($selected == $field) 232 { 233 $advfilter_option['value'] = $field; 234 $advfilter_option['text'] = $mod_strings[$fieldlabel]; 235 $advfilter_option['selected'] = "selected"; 236 }else 237 { 238 $advfilter_option['value'] = $field; 239 $advfilter_option['text'] = $mod_strings[$fieldlabel]; 240 $advfilter_option['selected'] = ""; 241 } 242 }else 243 { 244 if($selected == $field) 245 { 246 $advfilter_option['value'] = $field; 247 $advfilter_option['text'] = $fieldlabel; 248 $advfilter_option['selected'] = "selected"; 249 }else 250 { 251 $advfilter_option['value'] = $field; 252 $advfilter_option['text'] = $fieldlabel; 253 $advfilter_option['selected'] = ""; 254 } 255 } 256 $advfilter[] = $advfilter_option; 257 } 258 $advfilter_out[$label]= $advfilter; 259 } 260 } 261 return $advfilter_out; 262 } 263 264 /** to get the standard filter criteria 265 * @param $module(module name) :: Type String 266 * @param $elected (selection status) :: Type String (optional) 267 * @returns $filter Array in the following format 268 * $filter = Array( 0 => array('value'=>$tablename:$colname:$fieldname:$fieldlabel,'text'=>$mod_strings[$field label],'selected'=>$selected), 269 * 1 => array('value'=>$$tablename1:$colname1:$fieldname1:$fieldlabel1,'text'=>$mod_strings[$field label1],'selected'=>$selected), 270 */ 271 function getStdFilterHTML($module,$selected="") 272 { 273 global $app_list_strings; 274 global $oCustomView; 275 $stdfilter = array(); 276 $result = $oCustomView->getStdCriteriaByModule($module); 277 $mod_strings = return_module_language($current_language,$module); 278 279 if(isset($result)) 280 { 281 foreach($result as $key=>$value) 282 { 283 if(isset($mod_strings[$value])) 284 { 285 if($key == $selected) 286 { 287 $filter['value'] = $key; 288 $filter['text'] = $app_list_strings['moduleList'][$module]." - ".$mod_strings[$value]; 289 $filter['selected'] = "selected"; 290 }else 291 { 292 $filter['value'] = $key; 293 $filter['text'] = $app_list_strings['moduleList'][$module]." - ".$mod_strings[$value]; 294 $filter['selected'] =""; 295 } 296 }else 297 { 298 if($key == $selected) 299 { 300 $filter['value'] = $key; 301 $filter['text'] = $app_list_strings['moduleList'][$module]." - ".$value; 302 $filter['selected'] = 'selected'; 303 }else 304 { 305 $filter['value'] = $key; 306 $filter['text'] = $app_list_strings['moduleList'][$module]." - ".$value; 307 $filter['selected'] =''; 308 } 309 } 310 $stdfilter[]=$filter; 311 } 312 } 313 314 return $stdfilter; 315 } 316 317 /** to get the Advanced filter criteria 318 * @param $selected :: Type String (optional) 319 * @returns $AdvCriteria Array in the following format 320 * $AdvCriteria = Array( 0 => array('value'=>$tablename:$colname:$fieldname:$fieldlabel,'text'=>$mod_strings[$field label],'selected'=>$selected), 321 * 1 => array('value'=>$$tablename1:$colname1:$fieldname1:$fieldlabel1,'text'=>$mod_strings[$field label1],'selected'=>$selected), 322 * | 323 * n => array('value'=>$$tablenamen:$colnamen:$fieldnamen:$fieldlabeln,'text'=>$mod_strings[$field labeln],'selected'=>$selected)) 324 */ 325 function getAdvCriteriaHTML($selected="") 326 { 327 global $adv_filter_options; 328 global $app_list_strings; 329 $AdvCriteria = array(); 330 foreach($adv_filter_options as $key=>$value) 331 { 332 if($selected == $key) 333 { 334 $advfilter_criteria['value'] = $key; 335 $advfilter_criteria['text'] = $value; 336 $advfilter_criteria['selected'] = "selected"; 337 }else 338 { 339 $advfilter_criteria['value'] = $key; 340 $advfilter_criteria['text'] = $value; 341 $advfilter_criteria['selected'] = ""; 342 } 343 $AdvCriteria[] = $advfilter_criteria; 344 } 345 346 return $AdvCriteria; 347 } 348 //step4 349 350 ?>
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 |