<?php 
	$tree = $this->data->getMenuTree();
	$info = $this->data->getCellInfo();
	
	$baseUrl = $this->baseUrl();
	$active  = $this->leftmenu;
	$rights  = $this->rights;
	
	
	function recursive($array, $info, $baseUrl, $active, $rights) {?>
		<?php if (is_array($array)) : ?>
			<?php foreach ($array as $k => $v) : ?>
				<li <?php if ($k == $active) :?>class="active"<?endif;?>>
				
					<?php if (isset($rights[$k]['read']) && $rights[$k]['read']) : ?>
						<a href="<?=$baseUrl?>/documents/index/section/<?=$k?>"><?=$info[$k]['name']?></a>
					<?php else: ?>
						<a><span><?=$info[$k]['name']?></span></a>
					<?php endif; ?>
					
					<?php if (count($v)) : ?>
						<ul>
						<?php recursive($v, $info, $baseUrl, $active, $rights); ?>
						</ul>
					<?php endif; ?>
				</li>			
			<?php endforeach; ?>
		<?php endif; ?>
	<?php }?>
                       	
    <ul class="category_menu">
    	<li><a <?php if (!$active):?>class="active"<?endif;?> href="<?=$baseUrl?>/documents/index/section/0"><?=$this->t('vsechny-dokumenty-AF')?></a></li>
    	
    	<?php if (count($rights)) : ?>
			<?php recursive($tree, $info, $baseUrl, $active, $rights);?>
		<?php endif; ?>
	</ul>