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

$this->headTitle($this->projectName);
$this->placeholder('title')->set($this->t('dokumenty-f'));
?>
<h1 class="page_title"><?=$this->t('dokumenty-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('documents-menu', 'layout', 'default', array('leftmenu' => $this->leftmenu)); ?>
    	                </div>
    	            </div>
    	            
    				<div class="main_text_right">
                        <h2 class="section_heading"><?=$this->t('dokumenty-f')?><?=($this->item) ? ' - ' . $this->t('sekce') . $this->item->category_name : ''?></h2>

                        <div class="button_line">
                            <a href="<?=$this->baseUrl()?>/documents/add/section/<?=$this->item->id_category?>"><?=$this->t('pridat-dokument-AF')?></a>
                        </div>
                        
                                              
  						<?php if ($this->data->count()) : ?>
		                <table>
		                	<?php foreach ($this->data as $i) : ?>
		                	
		                    <tr class="<?=$this->evod('odd', 'even');?>">
		                    	<td><a class="action_read" href="<?=$this->baseUrl()?>/documents/detail/id/<?=$i->id_document?>/section/<?=$this->item->id_category?>"><?=$i->doc_name?></a></td>
		                    	<td><?=$i->cat_name?></td>
		                    	<?php if ($this->isLoggedAdmin) :?>
		                    		<td class="<?=($i->doc_active) ? 'active' : 'inactive';?>">
                                	<?php if ($i->doc_active) : ?>
                                		<a href="<?=$this->baseUrl()?>/documents/deactivate/id/<?=$i->id_document?>/section/<?=$this->item->id_category?>/page/<?=$this->page?>"><?=$this->t('aktivni-AF')?></a>
                                	<?php else : ?>
                                		<a href="<?=$this->baseUrl()?>/documents/activate/id/<?=$i->id_document?>/section/<?=$this->item->id_category?>/page/<?=$this->page?>"><?=$this->t('neaktivni-AF')?></a>
                                	<?php endif; ?>    
                                	</td>
		                    	<?php endif; ?>
		                        <td class="actions">
	                            	<a class="action_read" href="<?=$this->baseUrl()?>/documents/detail/id/<?=$i->id_document?>/section/<?=$this->item->id_category?>"><?=$this->t('detail-AF')?></a>
		                        </td>
		                    </tr>
		                    <?php endforeach; ?>
		                    <?php $this->evod('','', 1);?>
		                </table>
                        
                        <div class="paging">
                            <?=$this->paginationControl($this->data, 'Sliding', 'documents/paging.phtml', array('category' => $this->item->id_category)); ?>
                        </div>
                        <?php else : ?>
                        	<div class="info_box"><?=$this->t('zadne-dokumenty-f')?>.</div>
                        <?php endif; ?>
                        
                    </div>
    			
    			</div>
			</div>