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

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

<h1 class="page_title"><?=$this->t('skupiny-f')?></h1>
        <<h1 class="group_title"><?=($this->edit) ? $this->t('editovat-f') : $this->t('pridat-f')?> <?$this->t('zaznam')?></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('skupiny-f')?> - <?=($this->edit) ? $this->val($this->form, 'group_name') : $this->t('nova-skupina-f')?></h2>
                        
                        <div class="button_line">
                            <a href="<?=$this->baseUrl()?>/admin/groups"><?=$this->t('zpet-AF')?></a>
                            <a href="#rights"><?=$this->t('nastaveni-prav-skupiny-AF')?></a>
                            <a href="#members"><?=$this->t('uzivatele-ve-skupine-AF')?></a>
                        </div>
                        
                        <div class="form_errors">
                        	<?php if (isset($this->errors)) : ?>
                        		<?php foreach ($this->errors as $k => $v) : ?>
                        		 		<?=$this->t('polozka-f')?> "<?=$this->t($k)?>": <?=$this->t($v)?>.<br />
                        		<?php endforeach; ?>
                        	<?php endif; ?>
                        </div>
                        
                        <form action="<?=$this->baseUrl()?>/admin/groups/<?=($this->edit) ? 'edit' : 'add'?>" method="post">
                        
	                        <label><?=$this->t('nazev-skupiny-f')?>:</label>
			                <input class="short" type="text" name="group_name" value="<?=$this->val($this->form, 'group_name')?>" />
			        
			                <br />
			                
			                <label><?=$this->t('poznamka-f')?>:</label>
			                <textarea class="medium" rows="10" name="group_note"><?=$this->val($this->form, 'group_note')?></textarea>
	                        
			                <br />
			                <?php if ($this->edit) : ?>
			                	<input type="hidden" name="id_group" value="<?=$this->val($this->form, 'id_group')?>" />
			                <?php endif; ?>
			                <div class="submit_line">
		                  		<button class="inline_button"><?=$this->t('ulozit-f')?></button>
	                        	
		                  		<?php if ($this->edit) : ?>
		                        	<a class="grey" id="delete_button" href="<?=$this->baseUrl()?>/admin/groups/delete/id/<?=$this->val($this->form, 'id_group')?>"><?=$this->t('smazat-AF')?></a>
		                        	<script type="text/javascript">
			                        	$(document).ready(function(){
			                        		$('#delete_button').attr('href', $('#delete_button').attr('href') + '/thru/1');
										   	$('#delete_button').click(function(){
										   		if (confirm("<?=$this->t('delete_confirm')?>"))
												{
													return true;	
												} else {
													return false;
												}
										   });
										 });
									 </script>
	                        	<?php endif; ?>
                        	</div>
                        </form>
                        
                        <?php if ($this->edit) : ?>
			            	<?php echo $this->render('groups/detail.phtml');?>
			            <?php endif; ?>
                        
                        <div class="button_line">
                            <a href="<?=$this->baseUrl()?>/admin/groups"><?=$this->t('zpet-AF')?></a>
                        </div>
                        
                    </div>
    			
    			</div>
			</div>