<?php if (count($this->rights)) : ?>

	<form action="<?=$this->baseUrl()?>/admin/groups/edit-rights" method="post">
	<table class="categoryies_table">
	<tr class="header">
		<td><?=$this->t('kategorie-f')?></td>
		<td><?=$this->t('pristup-je-aktivni-f')?></td>
		<td><?=$this->t('cteni-f')?></td>
		<td><?=$this->t('pridavani-f')?></td>
		<td><?=$this->t('editace-f')?></td>
		<td><?=$this->t('mazani-f')?></td>
		<td class="right"><?=$this->t('moznosti-f')?></td>
	</tr>
	<?php
		$tree = $this->cats->getMenuTree();
		$info = $this->cats->getCellInfo();
		$rows = $this->treeToRows($tree, 1);
	?>
	
	<?php foreach ($rows as $i) : ?>
		<?php if (in_array($i['id'], array_keys($this->rights))) : ?>
	    <tr class="lvl<?=($i['deep'] > 4) ? 4 : $i['deep']?>">
	        <td class="td_first"><?=$this->escape($info[$i['id']]['name'])?></td>
	        <td class="<?=($this->rights[$i['id']]['rights_active']) ? 'active' : 'inactive';?>">
	        	<?php if ($this->rights[$i['id']]['rights_active']) : ?>
	        		<a href="<?=$this->baseUrl()?>/admin/groups/deactivate-rights-category/id/<?=$this->val($this->form, 'id_group')?>/rights/<?=$this->rights[$i['id']]['id_rights']?>"><?=$this->t('aktivni-AF')?></a>
	        	<?php else : ?>
	        		<a href="<?=$this->baseUrl()?>/admin/groups/activate-rights-category/id/<?=$this->val($this->form, 'id_group')?>/rights/<?=$this->rights[$i['id']]['id_rights']?>"><?=$this->t('neaktivni-AF')?></a>
	        	<?php endif; ?>    
	        </td>
	        
	        <td><?=$this->formCheckbox('read[' . $this->rights[$i['id']]['id_rights'] .']', $this->rights[$i['id']]['rights_read'], null, array("1", "0"))?></td>
	        <td><?=$this->formCheckbox('add[' . $this->rights[$i['id']]['id_rights'].']',  $this->rights[$i['id']]['rights_add'], null, array("1", "0"))?></td>
	        <td><?=$this->formCheckbox('edit[' . $this->rights[$i['id']]['id_rights'].']', $this->rights[$i['id']]['rights_edit'], null, array("1", "0"))?></td>
	        <td><?=$this->formCheckbox('del[' . $this->rights[$i['id']]['id_rights'].']', $this->rights[$i['id']]['rights_del'], null, array("1", "0"))?></td>
	        <td class="actions">
	            <a class="action_delete" id="rights_del_<?=$this->rights[$i['id']]['id_rights']?>"href="<?=$this->baseUrl()?>/admin/groups/delete-rights-category/rights/<?=$this->rights[$i['id']]['id_rights']?>/id/<?=$this->val($this->form, 'id_group')?>"><?=$this->t('vyradit-AF')?></a> 
	        </td>
	    </tr>
	    <script type="text/javascript">
				$(document).ready(function(){
					$('#rights_del_<?=$this->rights[$i['id']]['id_rights']?>').attr('href', $('#rights_del_<?=$this->rights[$i['id']]['id_rights']?>').attr('href') + '/thru/1');
						$('#rights_del_<?=$this->rights[$i['id']]['id_rights']?>').click(function(){
							if (confirm("<?=$this->t('delete_confirm')?>"))
							{
								return true;
							} else {
								return false;
							}
						});
					});
		</script>
		<?php endif; ?>
	<?php endforeach; ?>
	</table>
	<div class="submit_line">
		<input type="hidden" name="id_group" value="<?=$this->val($this->form, 'id_group')?>" />
		<button type="submit" name="submit"><?=$this->t('ulozit-f')?></button>
	</div>
	</form>
<?php else : ?>

<?php endif; ?>