Files
2025-10-17 13:38:25 +07:00

137 lines
10 KiB
PHP

<section class="content-header">
<h1>
<small></small>
</h1>
<ol class="breadcrumb">
<li><a href="<?php echo base_url()?>index.php/home"><i class="fa fa-dashboard"></i> Dashboard</a></li>
<li>Setting</li>
<li><a href="<?php echo base_url()?>index.php/hakakses">Hak Akses</a></li>
<li class="active"><?php echo $title ?></li>
</ol>
</section>
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title"><?php echo $title ?> | <?php echo $tu->row('mt_nama');?> </h3>
</div><!-- /.box-header -->
<div class="box-body">
<!-- form start -->
<?php if(validation_errors()){ ?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<h4><i class="icon fa fa-ban"></i> Alert!</h4>
<?php echo validation_errors() ?>
</div>
<?php } ?>
<form class="form-horizontal" id="form" action="<?php echo(base_url()); ?>index.php/ps_hakakses/prosesedithakakses" method="post">
<?php //echo form_open_multipart('index.php/user/prosesedit');?>
<div class="box-body form-horizontal">
<div class="box-body">
<div class="box">
<div class="box-body no-padding">
<input type="hidden" name="id" value="<?php echo $tu->row('mt_id');?>"/>
<table class="table table-striped">
<tr>
<th width="5%">No</th>
<th width="55%">Menu</th>
<th width="10%">Akses</th>
<th width="10%">View</th>
<th width="10%">Tambah</th>
<th width="10%">Edit</th>
<th width="10%">Delete</th>
</tr>
<?php
$no=0;
//$id_input="";
foreach ($mn as $menu) {
$parentmenu="";
//----cek parent menu----------------------------//
$this->db->where('mm_id', $menu->mm_parent);
$cekParent = $this->db->get('master_menu');
foreach ($cekParent->result() as $par)
{
$parentmenu="<code>".$par->mm_nama." /</code> ";
}
//----cek parent menu----------------------------//
$no++;
echo("
<tr>
<td>".$no."</td>
<td><input type='hidden' name='id_menu' value='".$menu->mm_id."'>".$parentmenu.$menu->mm_nama."</td>
");
$cekakses="";
$cekview="";
$cektambah="";
$cekedit="";
$cekdelete="";
$idusermenu="";
$setdisabled="";
foreach($um as $usermenu){
if($usermenu->mum_menu_id==$menu->mm_id){
$cekakses="checked";
$this->db->where('mum_id', $usermenu->mum_id);
$query1 = $this->db->get('master_user_menu');
foreach ($query1->result() as $row1)
{
if($row1->mum_lihat=="lihat"){
$cekview="checked";
}
if($row1->mum_tambah=="tambah"){
$cektambah="checked";
}
if($row1->mum_ubah=="ubah"){
$cekedit="checked";
}
if($row1->mum_hapus=="hapus"){
$cekdelete="checked";
}
}
}
}
if ($actionform=="prosesview"){
$setdisabled="disabled=''";
}
if($menu->mm_action=='true'){
echo ("
<td><input type='checkbox'".$setdisabled." id='action".$no."' name='akses[]' class='flat-red'".$cekakses." value='".$tu->row('mt_id')."-".$menu->mm_id."'></td>
<td><input type='checkbox'".$setdisabled." id='view".$no."' name='view[]' class='flat-red'".$cekview." value='".$menu->mm_id."' ></td>
<td><input type='checkbox'".$setdisabled." id='tambah".$no."' name='tambah[]' class='flat-red'".$cektambah." value='".$menu->mm_id."' ></td>
<td><input type='checkbox'".$setdisabled." id='edit".$no."' name='edit[]' class='flat-red'".$cekedit." value='".$menu->mm_id."'></td>
<td><input type='checkbox'".$setdisabled." id='delete".$no."' name='delete[]' class='flat-red'".$cekdelete." value='".$menu->mm_id."'></td>
</tr>
");
}else{
echo ("
<td><input type='checkbox'".$setdisabled." id='action".$no."' name='akses[]' class='flat-red'".$cekakses." value='".$tu->row('mt_id')."-".$menu->mm_id."'></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
");
}
}
?>
</table>
</div><!-- /.box-body -->
</div>
</div><!-- /.box-body -->
<div class="box-footer">
<a href="<?php echo base_url();?>index.php/ps_hakakses" class="btn btn-default">Cancel</a>
<?php if ($actionform!="prosesview"){ ?>
<button type="submit" class="btn btn-warning">Submit</button>
<?php } ?>
</div><!-- /.box-footer -->
</form>
<!-- form end -->
</div><!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div><!-- /.row -->
</section>