93 lines
5.5 KiB
PHP
93 lines
5.5 KiB
PHP
<aside class="main-sidebar">
|
|
<section class="sidebar">
|
|
|
|
<ul class="sidebar-menu">
|
|
<li class="header">MENU</li>
|
|
<!-- MENU -->
|
|
<?php
|
|
$linknow=$this->uri->segment(1, 0);
|
|
$linkseg1=$this->uri->segment(1);
|
|
$linkseg2=$this->uri->segment(2);
|
|
$linkseg3=$linkseg1."/".$linkseg2;
|
|
//echo $linkseg3;
|
|
$TU = $this->session->userdata('s_FK_TipeUser');
|
|
//$UM = $this->db->query("select * from master_user_menu INNER JOIN master_menu ON mm_id = mum_menu_id where mum_tipeuser_id='$TU' order by 'mm_urutan' asc")->result();
|
|
|
|
$this->db->join('master_menu', 'mm_id = mum_menu_id');
|
|
$this->db->order_by('mm_urutan', 'asc');
|
|
$this->db->where('mum_tipeuser_id', $TU);
|
|
$this->db->where('mm_aktif', "1");
|
|
$UM = $this->db->get('master_user_menu');
|
|
//return $UM->result();
|
|
|
|
foreach($UM->result() as $usermenu){
|
|
$menudata1 = $this->db->query("select * from master_menu where mm_id=$usermenu->mum_menu_id and mm_level=1 and mm_aktif=1 order by mm_urutan asc")->result();
|
|
foreach($menudata1 as $menuD){
|
|
if($menuD->mm_link!='#'){
|
|
|
|
//--------------------------start cek posisi tidak memiliki parent-----------------//
|
|
$aktifBig="";
|
|
if($linknow===$menuD->mm_link){
|
|
$aktifBig="class='active'";
|
|
}
|
|
//--------------------------end cek posisi tidak memiliki parent-------------------//
|
|
|
|
?>
|
|
<li <?php echo $aktifBig;?> >
|
|
<a href="<?php echo base_url();?>index.php/<?php echo $menuD->mm_link;?>">
|
|
<i class="<?php echo $menuD->mm_icon;?>"></i> <span><?php echo $menuD->mm_nama;?>
|
|
</a>
|
|
</li>
|
|
<?php
|
|
}else{
|
|
|
|
//--------------------------start cek posisi jika memiliki parent-----------------//
|
|
$aktifTreeView="";
|
|
$linkcekParent=$this->db->query("SELECT * FROM master_menu WHERE mm_link='$linknow' order by mm_urutan asc")->result();
|
|
foreach($linkcekParent as $cekthis){
|
|
$linkcekParent2=$this->db->query("SELECT * FROM master_menu WHERE mm_id='$cekthis->mm_parent' order by mm_urutan asc")->result();
|
|
foreach($linkcekParent2 as $cekthis2){
|
|
if($cekthis2->mm_nama==$menuD->mm_nama){
|
|
$aktifTreeView="active";
|
|
}
|
|
}
|
|
}
|
|
//--------------------------end cek posisi jika memiliki parent-------------------//
|
|
|
|
?>
|
|
<li class="treeview <?php echo $aktifTreeView;?>">
|
|
<a href="#">
|
|
<i class="<?php echo $menuD->mm_icon;?>"></i> <span><?php echo $menuD->mm_nama;?></span> <i class="fa fa-angle-left pull-right"></i>
|
|
</a>
|
|
<ul class="treeview-menu">
|
|
<?php
|
|
$menudata2 = $this->db->query("SELECT * FROM master_user_menu INNER JOIN master_menu ON master_user_menu.mum_menu_id = master_menu.mm_id WHERE mm_parent=$menuD->mm_id AND mum_tipeuser_id=$TU and mm_aktif=1 order by mm_urutan asc")->result();
|
|
foreach($menudata2 as $menuParent){
|
|
|
|
//--------------------------start cek posisi pada parent-----------------//
|
|
$aktifParent="";
|
|
if($linknow===$menuParent->mm_link){
|
|
if($linkseg2){}else{$aktifParent="class='active'";}
|
|
}
|
|
if($linkseg3===$menuParent->mm_link){
|
|
$aktifParent="class='active'";
|
|
}
|
|
//--------------------------end cek posisi pada parent-------------------//
|
|
|
|
?>
|
|
<li <?php echo $aktifParent;?>><a href="<?php echo base_url();?>index.php/<?php echo $menuParent->mm_link;?>"><i class="fa fa-caret-right"></i><?php echo $menuParent->mm_nama;?></a></li>
|
|
<?php
|
|
}
|
|
?>
|
|
|
|
</ul>
|
|
</li>
|
|
<?php
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
<!-- MENU -->
|
|
</ul>
|
|
</section>
|
|
</aside>
|