| [ 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/utils/UserInfoUtil.php'); 13 require_once ('include/utils/utils.php'); 14 15 global $app_strings; 16 global $mod_strings; 17 global $current_user; 18 global $adb; 19 global $theme; 20 $theme_path="themes/".$theme."/"; 21 $image_path=$theme_path."images/"; 22 $profileId=$_REQUEST['profileid']; 23 $profileName=''; 24 $parentProfileId=$_REQUEST['parentprofile']; 25 if($_REQUEST['mode'] =='create' && $_REQUEST['radiobutton'] != 'baseprofile') 26 $parentProfileId = ''; 27 28 29 $smarty = new vtigerCRM_Smarty; 30 if(isset($_REQUEST['selected_tab']) && $_REQUEST['selected_tab']!='') 31 $smarty->assign("SELECTED_TAB", $_REQUEST['selected_tab']); 32 else 33 $smarty->assign("SELECTED_TAB", "global_privileges"); 34 35 if(isset($_REQUEST['selected_module']) && $_REQUEST['selected_module']!='') 36 $smarty->assign("SELECTED_MODULE", $_REQUEST['selected_module']); 37 else 38 $smarty->assign("SELECTED_MODULE", "field_Leads"); 39 40 $smarty->assign("PARENTPROFILEID", $parentProfileId); 41 $smarty->assign("RADIOBUTTON", $_REQUEST['radiobutton']); 42 43 $secondaryModule=''; 44 $mode=''; 45 $output =''; 46 $output1 =''; 47 $smarty->assign("PROFILEID", $profileId); 48 $smarty->assign("MOD", return_module_language($current_language,'Settings')); 49 $smarty->assign("APP", $app_strings); 50 $smarty->assign("CMOD", $mod_strings); 51 if(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != '') 52 $smarty->assign("RETURN_ACTION", $_REQUEST['return_action']); 53 54 55 if(isset($_REQUEST['profile_name']) && $_REQUEST['profile_name'] != '' && $_REQUEST['mode'] == 'create') 56 { 57 $profileName=$_REQUEST['profile_name']; 58 } 59 else 60 { 61 $profileName=getProfileName($profileId); 62 63 } 64 65 $smarty->assign("PROFILE_NAME", $profileName); 66 67 if(isset($_REQUEST['profile_description']) && $_REQUEST['profile_description'] != '' && $_REQUEST['mode'] == 'create') 68 69 $smarty->assign("PROFILE_DESCRIPTION",$_REQUEST['profile_description']); 70 else 71 { 72 $profileDescription = getProfileDescription($profileId); 73 } 74 75 $smarty->assign("Profile_Name", $profileName); 76 $smarty->assign("Profile_Description", $profileDescription); 77 78 if(isset($_REQUEST['mode']) && $_REQUEST['mode'] != '') 79 $smarty->assign("MODE",$_REQUEST['mode']); 80 81 82 //Initially setting the secondary selected vtiger_tab 83 $mode=$_REQUEST['mode']; 84 if($mode == 'create') 85 { 86 $smarty->assign("ACTION",'SaveProfile'); 87 } 88 elseif($mode == 'edit') 89 { 90 $smarty->assign("ACTION",'UpdateProfileChanges'); 91 } 92 93 94 //Global Privileges 95 96 if($mode == 'view') 97 { 98 $global_per_arry = getProfileGlobalPermission($profileId); 99 $view_all_per = $global_per_arry[1]; 100 $edit_all_per = $global_per_arry[2]; 101 $privileges_global[]=getGlobalDisplayValue($view_all_per,1); 102 $privileges_global[]=getGlobalDisplayValue($edit_all_per,2); 103 } 104 elseif($mode == 'edit') 105 { 106 $global_per_arry = getProfileGlobalPermission($profileId); 107 $view_all_per = $global_per_arry[1]; 108 $edit_all_per = $global_per_arry[2]; 109 $privileges_global[]=getGlobalDisplayOutput($view_all_per,1); 110 $privileges_global[]=getGlobalDisplayOutput($edit_all_per,2); 111 } 112 elseif($mode == 'create') 113 { 114 if($parentProfileId != '') 115 { 116 $global_per_arry = getProfileGlobalPermission($parentProfileId); 117 $view_all_per = $global_per_arry[1]; 118 $edit_all_per = $global_per_arry[2]; 119 $privileges_global[]=getGlobalDisplayOutput($view_all_per,1); 120 $privileges_global[]=getGlobalDisplayOutput($edit_all_per,2); 121 } 122 else 123 { 124 $privileges_global[]=getGlobalDisplayOutput(0,1); 125 $privileges_global[]=getGlobalDisplayOutput(0,2); 126 } 127 128 } 129 130 $smarty->assign("GLOBAL_PRIV",$privileges_global); 131 132 //standard privileges 133 if($mode == 'view') 134 { 135 $act_perr_arry = getTabsActionPermission($profileId); 136 foreach($act_perr_arry as $tabid=>$action_array) 137 { 138 $stand = array(); 139 $entity_name = getTabname($tabid); 140 //Create/Edit Permission 141 $tab_create_per_id = $action_array['1']; 142 $tab_create_per = getDisplayValue($tab_create_per_id,$tabid,'1'); 143 //Delete Permission 144 $tab_delete_per_id = $action_array['2']; 145 $tab_delete_per = getDisplayValue($tab_delete_per_id,$tabid,'2'); 146 //View Permission 147 $tab_view_per_id = $action_array['4']; 148 $tab_view_per = getDisplayValue($tab_view_per_id,$tabid,'4'); 149 150 $stand[]=$entity_name; 151 $stand[]=$tab_create_per; 152 $stand[]=$tab_delete_per; 153 $stand[]=$tab_view_per; 154 $privileges_stand[$tabid]=$stand; 155 } 156 } 157 if($mode == 'edit') 158 { 159 $act_perr_arry = getTabsActionPermission($profileId); 160 foreach($act_perr_arry as $tabid=>$action_array) 161 { 162 $stand = array(); 163 $entity_name = getTabname($tabid); 164 //Create/Edit Permission 165 $tab_create_per_id = $action_array['1']; 166 $tab_create_per = getDisplayOutput($tab_create_per_id,$tabid,'1'); 167 //Delete Permission 168 $tab_delete_per_id = $action_array['2']; 169 $tab_delete_per = getDisplayOutput($tab_delete_per_id,$tabid,'2'); 170 //View Permission 171 $tab_view_per_id = $action_array['4']; 172 $tab_view_per = getDisplayOutput($tab_view_per_id,$tabid,'4'); 173 174 $stand[]=$entity_name; 175 $stand[]=$tab_create_per; 176 $stand[]=$tab_delete_per; 177 $stand[]=$tab_view_per; 178 $privileges_stand[$tabid]=$stand; 179 } 180 } 181 if($mode == 'create') 182 { 183 if($parentProfileId != '') 184 { 185 $act_perr_arry = getTabsActionPermission($parentProfileId); 186 foreach($act_perr_arry as $tabid=>$action_array) 187 { 188 $stand = array(); 189 $entity_name = getTabname($tabid); 190 //Create/Edit Permission 191 $tab_create_per_id = $action_array['1']; 192 $tab_create_per = getDisplayOutput($tab_create_per_id,$tabid,'1'); 193 //Delete Permission 194 $tab_delete_per_id = $action_array['2']; 195 $tab_delete_per = getDisplayOutput($tab_delete_per_id,$tabid,'2'); 196 //View Permission 197 $tab_view_per_id = $action_array['4']; 198 $tab_view_per = getDisplayOutput($tab_view_per_id,$tabid,'4'); 199 200 $stand[]=$entity_name; 201 $stand[]=$tab_create_per; 202 $stand[]=$tab_delete_per; 203 $stand[]=$tab_view_per; 204 $privileges_stand[$tabid]=$stand; 205 } 206 } 207 else 208 { 209 $act_perr_arry = getTabsActionPermission(1); 210 foreach($act_perr_arry as $tabid=>$action_array) 211 { 212 $stand = array(); 213 $entity_name = getTabname($tabid); 214 //Create/Edit Permission 215 $tab_create_per_id = $action_array['1']; 216 $tab_create_per = getDisplayOutput(0,$tabid,'1'); 217 //Delete Permission 218 $tab_delete_per_id = $action_array['2']; 219 $tab_delete_per = getDisplayOutput(0,$tabid,'2'); 220 //View Permission 221 $tab_view_per_id = $action_array['4']; 222 $tab_view_per = getDisplayOutput(0,$tabid,'4'); 223 224 $stand[]=$entity_name; 225 $stand[]=$tab_create_per; 226 $stand[]=$tab_delete_per; 227 $stand[]=$tab_view_per; 228 $privileges_stand[$tabid]=$stand; 229 } 230 } 231 232 } 233 $smarty->assign("STANDARD_PRIV",$privileges_stand); 234 235 //tab Privileges 236 237 if($mode == 'view') 238 { 239 $tab_perr_array = getTabsPermission($profileId); 240 $no_of_tabs = sizeof($tab_perr_array); 241 foreach($tab_perr_array as $tabid=>$tab_perr) 242 { 243 $tab=array(); 244 $entity_name = getTabname($tabid); 245 $tab_allow_per_id = $tab_perr_array[$tabid]; 246 $tab_allow_per = getDisplayValue($tab_allow_per_id,$tabid,''); 247 $tab[]=$entity_name; 248 $tab[]=$tab_allow_per; 249 $privileges_tab[$tabid]=$tab; 250 } 251 } 252 if($mode == 'edit') 253 { 254 $tab_perr_array = getTabsPermission($profileId); 255 $no_of_tabs = sizeof($tab_perr_array); 256 foreach($tab_perr_array as $tabid=>$tab_perr) 257 { 258 $tab=array(); 259 $entity_name = getTabname($tabid); 260 $tab_allow_per_id = $tab_perr_array[$tabid]; 261 $tab_allow_per = getDisplayOutput($tab_allow_per_id,$tabid,''); 262 $tab[]=$entity_name; 263 $tab[]=$tab_allow_per; 264 $privileges_tab[$tabid]=$tab; 265 } 266 } 267 if($mode == 'create') 268 { 269 if($parentProfileId != '') 270 { 271 $tab_perr_array = getTabsPermission($parentProfileId); 272 $no_of_tabs = sizeof($tab_perr_array); 273 foreach($tab_perr_array as $tabid=>$tab_perr) 274 { 275 $tab=array(); 276 $entity_name = getTabname($tabid); 277 $tab_allow_per_id = $tab_perr_array[$tabid]; 278 $tab_allow_per = getDisplayOutput($tab_allow_per_id,$tabid,''); 279 $tab[]=$entity_name; 280 $tab[]=$tab_allow_per; 281 $privileges_tab[$tabid]=$tab; 282 } 283 } 284 else 285 { 286 $tab_perr_array = getTabsPermission(1); 287 $no_of_tabs = sizeof($tab_perr_array); 288 foreach($tab_perr_array as $tabid=>$tab_perr) 289 { 290 $tab=array(); 291 $entity_name = getTabname($tabid); 292 $tab_allow_per_id = $tab_perr_array[$tabid]; 293 $tab_allow_per = getDisplayOutput(0,$tabid,''); 294 $tab[]=$entity_name; 295 $tab[]=$tab_allow_per; 296 $privileges_tab[$tabid]=$tab; 297 } 298 } 299 300 } 301 $smarty->assign("TAB_PRIV",$privileges_tab); 302 303 //utilities privileges 304 305 if($mode == 'view') 306 { 307 $act_utility_arry = getTabsUtilityActionPermission($profileId); 308 foreach($act_utility_arry as $tabid=>$action_array) 309 { 310 $util=array(); 311 $entity_name = getTabname($tabid); 312 $no_of_actions=sizeof($action_array); 313 foreach($action_array as $action_id=>$act_per) 314 { 315 $action_name = getActionname($action_id); 316 $tab_util_act_per = $action_array[$action_id]; 317 $tab_util_per = getDisplayValue($tab_util_act_per,$tabid,$action_id); 318 $util[]=$action_name; 319 $util[]=$tab_util_per; 320 } 321 $util=array_chunk($util,2); 322 $util=array_chunk($util,3); 323 $privilege_util[$tabid] = $util; 324 } 325 } 326 elseif($mode == 'edit') 327 { 328 $act_utility_arry = getTabsUtilityActionPermission($profileId); 329 foreach($act_utility_arry as $tabid=>$action_array) 330 { 331 $util=array(); 332 $entity_name = getTabname($tabid); 333 $no_of_actions=sizeof($action_array); 334 foreach($action_array as $action_id=>$act_per) 335 { 336 $action_name = getActionname($action_id); 337 $tab_util_act_per = $action_array[$action_id]; 338 $tab_util_per = getDisplayOutput($tab_util_act_per,$tabid,$action_id); 339 $util[]=$action_name; 340 $util[]=$tab_util_per; 341 } 342 $util=array_chunk($util,2); 343 $util=array_chunk($util,3); 344 $privilege_util[$tabid] = $util; 345 } 346 } 347 elseif($mode == 'create') 348 { 349 if($parentProfileId != '') 350 { 351 $act_utility_arry = getTabsUtilityActionPermission($parentProfileId); 352 foreach($act_utility_arry as $tabid=>$action_array) 353 { 354 $util=array(); 355 $entity_name = getTabname($tabid); 356 $no_of_actions=sizeof($action_array); 357 foreach($action_array as $action_id=>$act_per) 358 { 359 $action_name = getActionname($action_id); 360 $tab_util_act_per = $action_array[$action_id]; 361 $tab_util_per = getDisplayOutput($tab_util_act_per,$tabid,$action_id); 362 $util[]=$action_name; 363 $util[]=$tab_util_per; 364 } 365 $util=array_chunk($util,2); 366 $util=array_chunk($util,3); 367 $privilege_util[$tabid] = $util; 368 } 369 } 370 else 371 { 372 $act_utility_arry = getTabsUtilityActionPermission(1); 373 foreach($act_utility_arry as $tabid=>$action_array) 374 { 375 $util=array(); 376 $entity_name = getTabname($tabid); 377 $no_of_actions=sizeof($action_array); 378 foreach($action_array as $action_id=>$act_per) 379 { 380 $action_name = getActionname($action_id); 381 $tab_util_act_per = $action_array[$action_id]; 382 $tab_util_per = getDisplayOutput(0,$tabid,$action_id); 383 $util[]=$action_name; 384 $util[]=$tab_util_per; 385 } 386 $util=array_chunk($util,2); 387 $util=array_chunk($util,3); 388 $privilege_util[$tabid] = $util; 389 } 390 391 } 392 393 } 394 $smarty->assign("UTILITIES_PRIV",$privilege_util); 395 396 //Field privileges 397 $modArr=getFieldModuleAccessArray(); 398 399 400 $no_of_mod=sizeof($modArr); 401 for($i=0;$i<$no_of_mod; $i++) 402 { 403 $fldModule=key($modArr); 404 $lang_str=$modArr[$fldModule]; 405 $privilege_fld[]=$fldModule; 406 next($modArr); 407 } 408 $smarty->assign("PRI_FIELD_LIST",$privilege_fld); 409 $smarty->assign("MODE",$mode); 410 411 $disable_field_array = Array(); 412 $sql_disablefield = "select * from vtiger_def_org_field"; 413 $result = $adb->query($sql_disablefield); 414 $noofrows=$adb->num_rows($result); 415 for($i=0; $i<$noofrows; $i++) 416 { 417 $FieldId = $adb->query_result($result,$i,'fieldid'); 418 $Visible = $adb->query_result($result,$i,'visible'); 419 420 $disable_field_array[$FieldId] = $Visible; 421 } 422 423 if($mode=='view') 424 { 425 $fieldListResult = getProfile2AllFieldList($modArr,$profileId); 426 for($i=0; $i<count($fieldListResult);$i++) 427 { 428 $field_module=array(); 429 $module_name=key($fieldListResult); 430 $module_id = getTabid($module_name); 431 $language_strings = return_module_language($current_language,$module_name); 432 for($j=0; $j<count($fieldListResult[$module_name]); $j++) 433 { 434 $field=array(); 435 if($fieldListResult[$module_name][$j][1] == 0) 436 { 437 $visible = "<img src=".$image_path."/prvPrfSelectedTick.gif>"; 438 } 439 else 440 { 441 $visible = "<img src=".$image_path."/no.gif>"; 442 } 443 if($language_strings[$fieldListResult[$module_name][$j][0]] != '') 444 $field[]=$language_strings[$fieldListResult[$module_name][$j][0]]; 445 else 446 $field[]=$fieldListResult[$module_name][$j][0]; 447 $field[]=$visible; 448 $field_module[]=$field; 449 } 450 $privilege_field[$module_id] = array_chunk($field_module,3); 451 next($fieldListResult); 452 } 453 } 454 elseif($mode=='edit') 455 { 456 $fieldListResult = getProfile2AllFieldList($modArr,$profileId); 457 for($i=0; $i<count($fieldListResult);$i++) 458 { 459 $field_module=array(); 460 $module_name=key($fieldListResult); 461 $module_id = getTabid($module_name); 462 $language_strings = return_module_language($current_language,$module_name); 463 for($j=0; $j<count($fieldListResult[$module_name]); $j++) 464 { 465 $fldLabel= $fieldListResult[$module_name][$j][0]; 466 $uitype = $fieldListResult[$module_name][$j][2]; 467 $mandatory = ''; 468 $readonly = ''; 469 $field=array(); 470 if($disable_field_array[$fieldListResult[$module_name][$j][4]] == 1) 471 { 472 $mandatory = '<font color="blue">*</font>'; 473 $readonly = 'disabled'; 474 } 475 if($uitype == 2 || $uitype == 6 || $uitype == 22 || $uitype == 73 || $uitype == 24 || $uitype == 81 || $uitype == 50 || $uitype == 23 || $uitype == 16) 476 { 477 $mandatory = '<font color="red">*</font>'; 478 $readonly = 'disabled'; 479 } 480 if($fieldListResult[$module_name][$j][3] == 0) 481 { 482 $visible = "checked"; 483 } 484 else 485 { 486 $visible = ""; 487 } 488 if($language_strings[$fldLabel] != '') 489 $field[]=$mandatory.' '.$language_strings[$fldLabel]; 490 else 491 $field[]=$mandatory.' '.$fldLabel; 492 493 $field[]='<input id="'.$module_id.'_field_'.$fieldListResult[$module_name][$j][4].'" onClick="selectUnselect(this);" type="checkbox" name="'.$fieldListResult[$module_name][$j][4].'" '.$visible.' '.$readonly.'>'; 494 $field_module[]=$field; 495 } 496 $privilege_field[$module_id] = array_chunk($field_module,3); 497 next($fieldListResult); 498 } 499 } 500 elseif($mode=='create') 501 { 502 if($parentProfileId != '') 503 { 504 $fieldListResult = getProfile2AllFieldList($modArr,$parentProfileId); 505 for($i=0; $i<count($fieldListResult);$i++) 506 { 507 $field_module=array(); 508 $module_name=key($fieldListResult); 509 $module_id = getTabid($module_name); 510 $language_strings = return_module_language($current_language,$module_name); 511 for($j=0; $j<count($fieldListResult[$module_name]); $j++) 512 { 513 $fldLabel= $fieldListResult[$module_name][$j][0]; 514 $uitype = $fieldListResult[$module_name][$j][2]; 515 $mandatory = ''; 516 $readonly = ''; 517 $field=array(); 518 519 if($disable_field_array[$fieldListResult[$module_name][$j][4]] == 1) 520 { 521 $mandatory = '<font color="blue">*</font>'; 522 $readonly = 'disabled'; 523 } 524 if($uitype == 2 || $uitype == 6 || $uitype == 22 || $uitype == 73 || $uitype == 24 || $uitype == 81 || $uitype == 50 || $uitype == 23 || $uitype == 16) 525 { 526 $mandatory = '<font color="red">*</font>'; 527 $readonly = 'disabled'; 528 } 529 if($fieldListResult[$module_name][$j][3] == 0) 530 { 531 $visible = "checked"; 532 } 533 else 534 { 535 $visible = ""; 536 } 537 if($language_strings[$fldLabel] != '') 538 $field[]=$mandatory.' '.$language_strings[$fldLabel]; 539 else 540 $field[]=$mandatory.' '.$fldLabel; 541 $field[]='<input type="checkbox" id="'.$module_id.'_field_'.$fieldListResult[$module_name][$j][4].'" onClick="selectUnselect(this);" name="'.$fieldListResult[$module_name][$j][4].'" '.$visible.' '.$readonly.'>'; 542 $field_module[]=$field; 543 } 544 $privilege_field[$module_id] = array_chunk($field_module,3); 545 next($fieldListResult); 546 } 547 } 548 else 549 { 550 $fieldListResult = getProfile2AllFieldList($modArr,1); 551 for($i=0; $i<count($fieldListResult);$i++) 552 { 553 $field_module=array(); 554 $module_name=key($fieldListResult); 555 $module_id = getTabid($module_name); 556 $language_strings = return_module_language($current_language,$module_name); 557 for($j=0; $j<count($fieldListResult[$module_name]); $j++) 558 { 559 $fldLabel= $fieldListResult[$module_name][$j][0]; 560 $uitype = $fieldListResult[$module_name][$j][2]; 561 $mandatory = ''; 562 $readonly = ''; 563 $field=array(); 564 565 if($disable_field_array[$fieldListResult[$module_name][$j][4]] == 1) 566 { 567 $mandatory = '<font color="blue">*</font>'; 568 $readonly = 'disabled'; 569 } 570 if($uitype == 2 || $uitype == 6 || $uitype == 22 || $uitype == 73 || $uitype == 24 || $uitype == 81 || $uitype == 50 || $uitype == 23 || $uitype == 16) 571 { 572 $mandatory = '<font color="red">*</font>'; 573 $readonly = 'disabled'; 574 } 575 $visible = "checked"; 576 if($language_strings[$fldLabel] != '') 577 $field[]=$mandatory.' '.$language_strings[$fldLabel]; 578 else 579 $field[]=$mandatory.' '.$fldLabel; 580 $field[]='<input type="checkbox" id="'.$module_id.'_field_'.$fieldListResult[$module_name][$j][4].'" onClick="selectUnselect(this);" name="'.$fieldListResult[$module_name][$j][4].'" '.$visible.' '.$readonly.'>'; 581 $field_module[]=$field; 582 } 583 $privilege_field[$module_id] = array_chunk($field_module,3); 584 next($fieldListResult); 585 } 586 } 587 } 588 589 $smarty->assign("FIELD_PRIVILEGES",$privilege_field); 590 $smarty->assign("THEME", $theme); 591 $smarty->assign("IMAGE_PATH", $image_path); 592 if($mode == 'view') 593 $smarty->display("ProfileDetailView.tpl"); 594 else 595 $smarty->display("EditProfile.tpl"); 596 597 /** returns html image code based on the input id 598 * @param $id -- Role Name:: Type varchar 599 * @returns $value -- html image code:: Type varcha:w 600 * 601 */ 602 function getGlobalDisplayValue($id,$actionid) 603 { 604 global $image_path; 605 if($id == '') 606 { 607 $value = ' '; 608 } 609 elseif($id == 0) 610 { 611 $value = '<img src="'.$image_path.'prvPrfSelectedTick.gif">'; 612 } 613 elseif($id == 1) 614 { 615 $value = '<img src="'.$image_path.'no.gif">'; 616 } 617 else 618 { 619 $value = ' '; 620 } 621 622 return $value; 623 624 } 625 626 627 /** returns html check box code based on the input id 628 * @param $id -- Role Name:: Type varchar 629 * @returns $value -- html check box code:: Type varcha:w 630 * 631 */ 632 function getGlobalDisplayOutput($id,$actionid) 633 { 634 if($actionid == '1') 635 { 636 $name = 'view_all'; 637 } 638 elseif($actionid == '2') 639 { 640 641 $name = 'edit_all'; 642 } 643 644 if($id == '' && $id != 0) 645 { 646 $value = ''; 647 } 648 elseif($id == 0) 649 { 650 $value = '<input type="checkbox" id="'.$name.'_chk" onClick="invoke'.$name.'();" name="'.$name.'" checked>'; 651 } 652 elseif($id == 1) 653 { 654 $value = '<input type="checkbox" id="'.$name.'_chk" onClick="invoke'.$name.'();" name="'.$name.'">'; 655 } 656 return $value; 657 658 } 659 660 661 /** returns html image code based on the input id 662 * @param $id -- Role Name:: Type varchar 663 * @returns $value -- html image code:: Type varcha:w 664 * 665 */ 666 function getDisplayValue($id) 667 { 668 global $image_path; 669 670 if($id == '') 671 { 672 $value = ' '; 673 } 674 elseif($id == 0) 675 { 676 $value = '<img src="'.$image_path.'prvPrfSelectedTick.gif">'; 677 } 678 elseif($id == 1) 679 { 680 $value = '<img src="'.$image_path.'no.gif">'; 681 } 682 else 683 { 684 $value = ' '; 685 } 686 return $value; 687 688 } 689 690 691 /** returns html check box code based on the input id 692 * @param $id -- Role Name:: Type varchar 693 * @returns $value -- html check box code:: Type varcha:w 694 * 695 */ 696 function getDisplayOutput($id,$tabid,$actionid) 697 { 698 if($actionid == '') 699 { 700 $name = $tabid.'_tab'; 701 $ckbox_id = 'tab_chk_com_'.$tabid; 702 $jsfn = 'hideTab('.$tabid.')'; 703 } 704 else 705 { 706 $temp_name = getActionname($actionid); 707 $name = $tabid.'_'.$temp_name; 708 $ckbox_id = 'tab_chk_'.$actionid.'_'.$tabid; 709 if($actionid == 1) 710 $jsfn = 'unSelectCreate('.$tabid.')'; 711 elseif($actionid == 4) 712 $jsfn = 'unSelectView('.$tabid.')'; 713 elseif($actionid == 2) 714 $jsfn = 'unSelectDelete('.$tabid.')'; 715 else 716 { 717 $ckbox_id = $tabid.'_field_util_'.$actionid; 718 $jsfn = 'javascript:'; 719 } 720 } 721 722 723 724 if($id == '' && $id != 0) 725 { 726 $value = ''; 727 } 728 elseif($id == 0) 729 { 730 $value = '<input type="checkbox" onClick="'.$jsfn.';" id="'.$ckbox_id.'" name="'.$name.'" checked>'; 731 } 732 elseif($id == 1) 733 { 734 $value = '<input type="checkbox" onClick="'.$jsfn.';" id="'.$ckbox_id.'" name="'.$name.'">'; 735 } 736 return $value; 737 738 } 739 740 ?>
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 |