?
Current Path : /home1/savoy/www/savoyglobal.net/drafthr/system/application/views/Settings/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : /home1/savoy/www/savoyglobal.net/drafthr/system/application/views/Settings/list_user_permission.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?> <script type="text/javascript"> function hidesho(val,val1) { if(val.style.display=="none") { val1.src="<?php echo base_url();?>assets/treeImgs/minus.gif"; $(val).show('slow'); } else { val1.src="<?php echo base_url();?>assets/treeImgs/plus.gif"; $(val).hide('slow'); } } function checkuncheck(module,maincheck,menid) { var length=document.getElementById(module + "_5").value; for(var i=0; i <length; i++) { document.getElementById(module+ "" + i).checked=maincheck.checked ; document.getElementById(module+ "" + i+'_1').checked=maincheck.checked ; document.getElementById(module+ "" + i+'_2').checked=maincheck.checked ; document.getElementById(module+ "" + i+'_3').checked=maincheck.checked ; if(maincheck.checked) { document.getElementById('private_'+module+ "" + i).value=1 ; document.getElementById('combineresult_'+module+i).value='0'; } else { document.getElementById('private_'+module+ "" + i).value=0 ; document.getElementById('combineresult_'+module+i).value='7'; } addvalue(module+i,maincheck.checked,'7',(module+ "" + i)); // addvalue((parseInt(i)+1),true,'2'); // addvalue((parseInt(i)+1),true,'1'); } } function checkuncheck(module,maincheck,menid) { var length=document.getElementById(module + "_5").value; for(var i=0; i <length; i++) { document.getElementById(module+ "" + i).checked=maincheck.checked ; document.getElementById(module+ "" + i+'_1').checked=maincheck.checked ; document.getElementById(module+ "" + i+'_2').checked=maincheck.checked ; document.getElementById(module+ "" + i+'_3').checked=maincheck.checked ; if(maincheck.checked) { if(document.getElementById('public_'+module+ "" + i).checked==true) { document.getElementById('private_'+module+ "" + i).value=2 ; } else { document.getElementById('private_'+module+ "" + i).value=1 ; } document.getElementById('combineresult_'+module+i).value='0'; } else { document.getElementById('private_'+module+ "" + i).value=0 ; document.getElementById('combineresult_'+module+i).value='7'; } addvalue(module+i,maincheck.checked,'7',(module+ "" + i)); // addvalue((parseInt(i)+1),true,'2'); // addvalue((parseInt(i)+1),true,'1'); } } function checkreadwrite(val,chk,count) { document.getElementById(val+'_1').checked=chk.checked; document.getElementById(val+'_2').checked=chk.checked; document.getElementById(val+'_3').checked=chk.checked; if(chk.checked) { if(document.getElementById('public_'+val).checked==true) { document.getElementById('private_'+val).value=2 ; } else { document.getElementById('private_'+val).value=1 ; } // document.getElementById('private_'+val).value=1 ; document.getElementById('combineresult_'+val).value='0'; } else { document.getElementById('private_'+val).value=0 ; document.getElementById('combineresult_'+val).value='7'; } addvalue(val,chk.checked,'7'); } function addvalue(id,isChecked,checkValue,ParentChkboxId) { if(isChecked) { var res= parseInt(document.getElementById('combineresult_'+id).value); document.getElementById('combineresult_'+id).value =(res + parseInt(checkValue)); } else { var res= parseInt(document.getElementById('combineresult_'+id).value); document.getElementById('combineresult_'+id).value =(res - parseInt(checkValue)); } if(document.getElementById('combineresult_'+id).value=='0') { document.getElementById(ParentChkboxId).checked=false; document.getElementById('private_'+id).value=0 ; } else { document.getElementById(ParentChkboxId).checked=true; if(document.getElementById('public_'+id).checked==true) { document.getElementById('private_'+id).value=2 ; } else { document.getElementById('private_'+id).value=1 ; } } } function checkprivate(mainid,id) { var main=document.getElementById(mainid).checked; if(main==true) { if(id==true) { document.getElementById('private_'+mainid).value=2; } else { document.getElementById('private_'+mainid).value=1; } } else { document.getElementById('private_'+mainid).value=0; } } </script> <input type="hidden" readonly name="role" id="role" value="<?=$roles?>"/> <?php $modname=""; $modcheck=""; $cntr=1; $i=1; echo '<div>'; $modulelist=$this->mastermodel->getmoduledata(); $allowed=explode(",",$userdetails->permission); $edit_del=explode(",",$userdetails->edit_del_permission); $private_details=explode(",",$userdetails->private); $j=0; $txtname=""; foreach ($modulelist as $menulst) { //echo $menulst['module_name']; $menuid=$menulst['menu_id']; $poss=''; for($i=1;$i<sizeof($allowed)+1;$i++) { if($allowed[$i-1]==$menuid) { $poss=$i; } } if($poss!='') { $val=$edit_del[$poss-1]; $val1=$private_details[$poss-1]; } else { $val=0; $val1=0; } $a=decbin($val); $d=sprintf('%03u',$a); $ar = str_split($d); if ($modname!=$menulst['module_name']) { if($modname!="") { echo '</div><input type="hidden" id="'. $txtname .'_5" type="text" value="'. $j.'"/> </div>'; $j=0; } $txtname=$menulst['module_name']; echo '<div style="margin:2px;float:left;width:100%"> <div style="height:20px;border:#badcdc 1px solid;background-color:#e8f3f3;margin:3px;padding-top:3px;"> <img style="margin-top:0px;" align="center" id='. $menulst['module_name'].'_1 onclick="hidesho(div_'. $menulst['module_name'] .','. $menulst['module_name'].'_1);" src="'. base_url() . 'assets/treeImgs/minus.gif" /> <input onclick="checkuncheck(\''.$txtname.'\','. $menulst['module_name'] .'_3,'.$menulst['menu_id'].')" id="'. $menulst['module_name'] .'_3" value="'. $menulst['module_name'] .'_3" type="checkbox" />'. $menulst['module_name'] . '</div>'; $modname=$menulst['module_name']; echo '<div style=" height:2px; border:0px green solid; display:block" id=div_'. $menulst['module_name'].'>'; echo '<div id=div_'. $menulst['menu_id'].' style="width:170px; height:50px; border:0px red solid;float:left; margin-left:1px;" > <div style="width:200px; height:50px; ">';?> <input name="Chk_Permission[]" type="checkbox" onchange="checkreadwrite('<?php echo $txtname.$j ?>',this,<?=$j?>)" id="<?php echo $txtname.$j ?>" value="<?php echo $menulst['menu_id'] ?>"<?php if(in_array($menulst['menu_id'], $allowed)){ echo 'checked="checked"'; } ?> /> <?php echo $menulst['caption'] .''; ?> <table style="margin-left:15px;"><tr style="font-size: 10px;"><td>R</td><td>W</td><td>D</td><td>Pvt.</td></tr><tr> <td> <input onchange="addvalue('<?php echo $txtname.$j;?>',this.checked,this.value,'<?=$txtname.$j?>')" name="read_permission[]" id="<?php echo $txtname.$j;?>_1" value="4" type="checkbox" <?php if($ar[0]=="1"){ echo 'checked="checked"'; } ?>></td> <td> <input onchange="addvalue('<?php echo $txtname.$j;?>',this.checked,this.value,'<?=$txtname.$j?>')" name="read_permission[]" id="<?php echo $txtname.$j ;?>_2" value="2" type="checkbox" <?php if($ar[1]=="1"){ echo 'checked="checked"'; } ?>></td> <td> <input onchange="addvalue('<?php echo $txtname.$j;?>',this.checked,this.value,'<?=$txtname.$j?>')" name="read_permission[]" id="<?php echo $txtname.$j;?>_3" value="1" type="checkbox" <?php if($ar[2]=="1"){ echo 'checked="checked"'; } ?>></td> <td> <?php if($txtname=='Master' || $txtname=='Settings' || $menulst['caption']=='Claim Forms'){ ?> <input type="checkbox" DISABLED name="public[]" onchange="checkprivate('<?=$txtname.$j?>',this.checked)" id="public_<?=$txtname.$j?>" <?php if($val1=="2"){ echo 'checked="checked"'; } ?>> <?php } elseif($txtname=='HR' && ($menulst['sort']>='4' && $menulst['sort']<='12')){ ?> <input type="checkbox" DISABLED name="public[]" onchange="checkprivate('<?=$txtname.$j?>',this.checked)" id="public_<?=$txtname.$j?>" <?php if($val1=="2"){ echo 'checked="checked"'; } ?>> <?php } else{ ?> <input type="checkbox" name="public[]" onchange="checkprivate('<?=$txtname.$j?>',this.checked)" id="public_<?=$txtname.$j?>" <?php if($val1=="2"){ echo 'checked="checked"'; } ?>> <?php } ?> </td></tr> </table> <input type="hidden" name="private[]" id="private_<?=$txtname.$j?>" value="<?=$val1?>"/> <input type="hidden" name="combine[]" value="<?=$val?>" id="combineresult_<?php echo $txtname.$j?>" /> <?php echo '</div></div>'; $i++; $j++; } else { echo '<div style="border:0px blue solid;width:170px; height:50px; float:left; " > <div style="width:200px; height:50px; ">';?> <input name="Chk_Permission[]" type="checkbox" onchange="checkreadwrite('<?php echo $txtname.$j ?>',this,<?=$j?>)" id="<?php echo $txtname.$j ?>" value="<?php echo $menulst['menu_id'] ?>"<?php if(in_array($menulst['menu_id'], $allowed)){ echo 'checked="checked"'; } ?> /> <?php echo $menulst['caption'] ; ?> <table style="margin-left:15px;"><tr style="font-size: 10px;"><td>R</td><td>W</td><td>D</td><td>Pvt.</td></tr><tr> <td> <input onchange="addvalue('<?php echo $txtname.$j;?>',this.checked,this.value,'<?=$txtname.$j?>')" name="read_permission[]" id="<?php echo $txtname.$j;?>_1" value="4" type="checkbox"<?php if($ar[0]=="1"){ echo 'checked="checked"'; } ?>></td> <td> <input onchange="addvalue('<?php echo $txtname.$j;?>',this.checked,this.value,'<?=$txtname.$j?>')" name="read_permission[]" id="<?php echo $txtname.$j ;?>_2" value="2" type="checkbox" <?php if($ar[1]=="1"){ echo 'checked="checked"'; } ?>></td> <td> <input onchange="addvalue('<?php echo $txtname.$j;?>',this.checked,this.value,'<?=$txtname.$j?>')" name="read_permission[]" id="<?php echo $txtname.$j;?>_3" value="1" type="checkbox" <?php if($ar[2]=="1"){ echo 'checked="checked"'; } ?>></td> <td> <?php if($txtname=='Master' || $txtname=='Settings' || $menulst['caption']=='Claim Forms'){ ?> <input type="checkbox" DISABLED name="public[]" onchange="checkprivate('<?=$txtname.$j?>',this.checked)" id="public_<?=$txtname.$j?>" <?php if($val1=="2"){ echo 'checked="checked"'; } ?>> <?php } elseif($txtname=='HR' && ($menulst['sort']>='4' && $menulst['sort']<='12')){ ?> <input type="checkbox" DISABLED name="public[]" onchange="checkprivate('<?=$txtname.$j?>',this.checked)" id="public_<?=$txtname.$j?>" <?php if($val1=="2"){ echo 'checked="checked"'; } ?>> <?php } else{ ?> <input type="checkbox" name="public[]" onchange="checkprivate('<?=$txtname.$j?>',this.checked)" id="public_<?=$txtname.$j?>" <?php if($val1=="2"){ echo 'checked="checked"'; } ?>> <?php } ?> </td></tr> </table> <input type="hidden" name="private[]" id="private_<?=$txtname.$j?>" value="<?=$val1?>"/> <input type="hidden" name="combine[]" value="<?=$val?>" id="combineresult_<?php echo $txtname.$j?>" /> <?php echo '</div></div>'; $i++; $j++; } } echo '<input type="hidden" id="'. $txtname . '_5" type="text" value="'. $j.'"/></div>'; echo '</div>'; echo ' <input id="menu_length" value='. $i.' name="menu_length" type="hidden" />'; ?>