<?php
/**
 * @author Lukas Havlicek
 * @version 1.0
 */

$this->headTitle($this->projectName);
$this->placeholder('title')->set($this->t('kategorie-f'));
?>

<h1 class="page_title"><?=$this->t('kategorie-f')?></h1>
        <h1 class="group_title"><?=$this->t('prehled-f')?></h1>
            <div class="main_inner2">
    			<div class="main_inner">
    			
    				 <div class="left_column">
    	                <div class="left_column_item">
    	                    <?=$this->action('left-menu', 'layout', 'admin', array('leftmenu' => $this->leftmenu)); ?>
    	                </div>
    	            </div>
    	            
    				<div class="main_text_right">
                        <h2 class="section_heading"><?=$this->t('kategorie-f')?></h2>
                        <div class="button_line">
                            <a href="<?=$this->baseUrl()?>/admin/categoryies/add"><?=$this->t('pridat-kategorii-AF')?></a>
<!--                            <a href="<?=$this->baseUrl()?>/admin/categoryies/sort">USPOŘÁDAT KATEGORIE</a>-->
                        </div>
                        <table class="categoryies_table">
                        
                        	<?php 
								$tree = $this->data->getMenuTree();
								$info = $this->data->getCellInfo();
								
								$rows = $this->treeToRows($tree, 1);
                        	?>
                        	<?php foreach ($rows as $i) : ?>
		                    <tr class="lvl<?=($i['deep'] > 4) ? 4 : $i['deep']?>">
		                    	<td class="td_first"><?=$info[$i['id']]['name']?></td>
		                    	<td class="<?=($info[$i['id']]['category_active']) ? 'active' : 'inactive';?>">
                                	<?php if ($info[$i['id']]['category_active']) : ?>
                                		<a href="<?=$this->baseUrl()?>/admin/categoryies/deactivate/id/<?=$i['id']?>"><?=$this->t('aktivni-AF')?></a>
                                	<?php else : ?>
                                		<a href="<?=$this->baseUrl()?>/admin/categoryies/activate/id/<?=$i['id']?>"><?=$this->t('neaktivni-AF')?></a>
                                	<?php endif; ?>    
                                </td>
                                <td class="actions">
                                	<?php if ($info[$i['id']]['position'] != 1) : ?>
                                	<a class="action_read" href="<?=$this->baseUrl()?>/admin/categoryies/up/id/<?=$i['id']?>"><?=$this->t('nahoru-AF')?></a> |
                                	<?php else : ?>
                                	<?=$this->t('nahoru-AF')?> |
                                	<?php endif; ?>
                                	<?php if ($info[$i['id']]['position'] != $info[$i['id']]['positionMax']) : ?>
                                	<a class="action_read" href="<?=$this->baseUrl()?>/admin/categoryies/down/id/<?=$i['id']?>"><?=$this->t('dolu-AF')?></a>
                                	<?php else : ?>
                                	<?=$this->t('dolu-AF')?>
                                	<?php endif; ?>
                                </td>
		                    	<td class="actions">
                                    <a class="action_read" href="<?=$this->baseUrl()?>/admin/categoryies/edit/id/<?=$i['id']?>"><?=$this->t('editovat-AF')?></a> 
                                </td>
                            </tr>
		                    <?php endforeach; ?>

		                </table>
                        
                    </div>
    			
    			</div>
			</div>