?
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/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) { 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> <div style="overflow: auto"></div> <?php $modname=""; $modcheck=""; $cntr=1; $i=1; echo '<br/><br/><label>Permissions </label><br/><br/>'; echo '<div>'; $modulelist=$this->mastermodel->getmoduledata(); $j=0; $txtname=""; foreach ($modulelist as $menulst) { 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:5px;float:left;width:100%;border:1px #badcdc solid;"> <div style="height:25px;border:#badcdc 1px solid;background-color:#e8f3f3;margin:0px;padding-top:0px;"> <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="padding:5px 0 0 8px; margin-left:15px;display:block" id=div_'. $menulst['module_name'].'>'; echo '<div id=div_'. $menulst['menu_id'].' style="height:55px;width:170px; float:left;margin:2px 0 2px 0;" >';?> <input name="Chk_Permission[]" type="checkbox" id="<?php echo $txtname.$j ?>" onchange="checkreadwrite('<?php echo $txtname.$j ?>',this,<?=$j?>)" value="<?php echo $menulst['menu_id'] ?>"/> <?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"></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"></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"></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 } 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 } else{ ?> <input type="checkbox" name="public[]" onchange="checkprivate('<?=$txtname.$j?>',this.checked)" id="public_<?=$txtname.$j?>"> <?php } ?> </td></tr></table> <input type="hidden" name="combine[]" value="0" id="combineresult_<?php echo $txtname.$j?>" /> <input type="hidden" name="private[]" id="private_<?=$txtname.$j?>" value="0"/> <?php echo '</div>'; $i++; $j++; } else { echo '<div style="height:55px;width:170px; float:left; margin:2px 0 2px 0;" >';?> <input name="Chk_Permission[]" type="checkbox" id="<?php echo $txtname.$j ?>" onchange="checkreadwrite('<?php echo $txtname.$j ?>',this,<?=$j?>)" value="<?php echo $menulst['menu_id'] ?>"/> <?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"></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"></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"></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 } 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 } else{ ?> <input type="checkbox" name="public[]" onchange="checkprivate('<?=$txtname.$j?>',this.checked)" id="public_<?=$txtname.$j?>"> <?php } ?> </td></tr></table> <input type="hidden" name="combine[]" value="0" id="combineresult_<?php echo $txtname.$j ;?>" /> <input type="hidden" name="private[]" id="private_<?=$txtname.$j?>" value="0"/> <?php echo '</div>'; $i++; $j++; } } echo '<input type="hidden" id="'. $txtname . '_5" type="text" value="'. $j.'"/></div>'; echo '</div>'; ?>