	
	<head>
	<link rel="stylesheet" href="<?php echo $this->baseUrl ?>assets/thema/2016/css/jquery.treeview.css" />
	<script src="<?php echo $this->baseUrl ?>assets/thema/2016/js/jquery.cookie.js" type="text/javascript"></script>
	<script src="<?php echo $this->baseUrl ?>assets/thema/2016/js/jquery.treeview.js" type="text/javascript"></script>
	
	<script type="text/javascript" src="<?php echo $this->baseUrl ?>assets/thema/2016/js/demo.js"></script>
	
	
	</head>

<?php 

function actMenu($acl, $menu)
{
	if(count($menu['subUrl']) > 0){
		foreach($menu['subUrl'] as $r2){
			$res = actMenu($acl, $r2);
			if($res == true){
				return true;
			}
		}
	}else{
		$id = strtolower($menu['url']);
		if(!empty($acl[$id])){
			return true;
		}
	}
	return false;
}

function displayMenu($menu)
{
	$ex = explode(" ", $menu);
	
	$res = '';
	foreach($ex as $row){
		if(!empty($res)){
			$res.= ' ';
		}
		$res.= ucfirst($row);
	}
	
	return $res;
}

function setMenu($menu, $res = '', $url, $acl, $modul, $kd2 = '')
{
	foreach($menu as $k => $row){
		$row['menu'] = str_ireplace("-", " ", $row['menu']);
		$idAct = actMenu($acl, $row);
		if($idAct == true){
			$kd = $kd2.'_'.$k;
			if(count($row['subUrl']) > 0){
				$res.= '<li class="closed" id="_treeLiFolder'.$kd.'"><span class="folder">'.ucfirst($row['menu']).'</span>';
				$res.= '<ul id="_treeUlFolder'.$kd.'">';
				$res = setMenu($row['subUrl'], $res, $url, $acl, $modul, $kd);
				$res.= '</ul>';
				$res.= '</li>';
			}else{
				$res.= '<li><span class="file"><a id="_treeUlList'.$kd.'" class="_ajakMenuLoading" id="url_'.$row['url'].'" href="'.$url.$row['url'].'/index/'.$modul.'" link="'.$row['url'].'">'.displayMenu($row['menu']).'</a></span></li>';
			}
		}
	}
	return $res;
}

$menu = new Menu;			
$ctrl = strtolower($this->getParameter['asliGetCotroller']);
$path = $menu->setPathMenu($this->getParameter['modul'], $ctrl); 

$menu = setMenu($this->menu, '', $this->baseUrl, $this->acl, $this->getParameter['modul']);

?>
	
<ul id="browser" class="filetree">
	<?php echo $menu ?>

	<li><span class="file"><a href="<?php echo $this->baseUrl.'index' ?>">Dashboard</a></span></li>
	<li><span class="file"><a href="<?php echo $this->baseUrl.'login/logout' ?>">Log Out</a></span></li>
</ul>

<script type="text/javascript">
$(document).ready(function(){
	makeSetTreeMenu = function(){
		$('.closed').removeAttr("class").addClass("closed expandable");
		$('.filetree ul').removeAttr("style").css("display", 'none');
		
		<?php 
		$id = '';
		$jum = count($path) - 1;
		foreach($path as $k => $r){ 
			$id.= '_'.$r;
			$id = str_ireplace("__", "_", $id);
		?>
			$('#_treeLiFolder<?php echo $id ?>').removeAttr("class").addClass("closed collapsable");
			$('#_treeUlFolder<?php echo $id ?>').removeAttr("style").css("display", 'block');
			$('#url_<?php echo $ctrl ?>').focus();
		<?php 
			if($jum == $k){
				?>
				$("#_treeUlList<?php echo $id ?>").css("background-color", "yellow");
		<?php
			}
		} 
		?>
		
		
	}
	function showDiv() {
		makeSetTreeMenu();
		clearInterval(timer);
	}
	var timer = setInterval( showDiv, 100);
	
})
</script>