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

$this->headTitle($this->projectName);
$this->placeholder('title')->set($this->t('kos-f'));
?>
<h1 class="page_title"><?=$this->t('kos-f')?></h1>
        <h1 class="group_title"><?=$this->t('kos-f')?> - <?=($this->recieved) ? $this->t('prijate-f') : $this->t('odeslane-f'); ?></h1>
            <div class="main_inner2">
    			<div class="main_inner">
    			
    				 <div class="left_column">
    	                <div class="left_column_item">
    	                    <?=$this->action('messages-menu', 'layout', 'default', array('leftmenu' => $this->leftmenu)); ?>
    	                </div>
    	            </div>
    	            
    				<div class="main_text_right">
    					<div class="inbox_outbox_select"><a class="<?=($this->recieved) ? 'active' : ''; ?>" href="<?=$this->baseUrl()?>/messages/bin"><?=$this->t('prijate')?></a> <a class="<?=($this->recieved) ? '' : 'active'; ?>" href="<?=$this->baseUrl()?>/messages/bin/recieved/0"><?=$this->t('odeslane')?></a></div>
                        <h2 class="section_heading"><?=$this->t('kos-f')?> - <?=($this->recieved) ? $this->t('prijate-f') : $this->t('odeslane-f'); ?></h2>
                        
                        <form action="<?=$this->baseUrl()?>/messages/multi" method="post">
                        
                        <div class="button_line">
                            <?=$this->t('oznacit-f')?>: <span onclick="checkAll()"><?=$this->t('vse-f')?></span> <span onclick="uncheckAll()"><?=$this->t('nic-f')?></span> <span onclick="switchAll()"><?=$this->t('prohodit-f')?></span>
                            <?=$this->t('oznacene-f')?>: <select class="button_line_select">
                            	<option value="4"><?=$this->t('obnovit')?></option>
                                <option value="5"><?=$this->t('uplne-vymazat')?></option>
                            </select>
                            <button>OK</button>
                        </div>
		                <table>
		                	<?php foreach ($this->data as $i) : ?>
		                    <tr class="<?=$this->evod('odd', 'even');?>">
		                    	<td><input class="selector" onclick="trHighlight(this);" type="checkbox" name="event[]" value="<?=$i->id_message?>" /></td>
		                        <td <? if (!$i->is_read) echo 'class="bold"'?>><a href="<?=$this->baseUrl()?>/messages/detail/id/<?=$i->id_message?>"><?=$this->date($i->datetime)?></a></td>
		                        <td <? if (!$i->is_read) echo 'class="bold"'?>><?=$this->time($i->datetime)?></td>
		                        <td <? if (!$i->is_read) echo 'class="bold"'?>><?=$this->escape($i->user_surname . ' ' . $i->user_firstname)?></td>
		                        <td <? if (!$i->is_read) echo 'class="bold"'?>><a href="<?=$this->baseUrl()?>/messages/detail/id/<?=$i->id_message?>"><?=$this->escape($i->subject);?></a></td>
		                        <td class="actions">
		                            <a class="action_read" href="<?=$this->baseUrl()?>/messages/detail/id/<?=$i->id_message?>"><?=$this->t('cist-AF')?></a> | 
		                            <a class="action_delete" href="<?=$this->baseUrl()?>/messages/delete/id/<?=$i->id_message?>"><?=$this->t('smazat-AF')?></a>
		                        </td>
		                    </tr>
		                    <?php endforeach; ?>
		                    <?php $this->evod('','', 1);?>
		                </table>
		                
		                <script type="text/javascript">
                        	$(document).ready(function(){
							   	$('.action_delete').click(function(){
						   		if (confirm("<?=$this->t('delete_confirm')?>"))
								{
								} else {
									return false;
								}
						 	});

			             });
						</script>
						</form>
                        
                        <div class="paging">
                            <?=$this->paginationControl($this->data, 'Sliding', 'messages/paging_bin.phtml', array('recieved' => $this->recieved)); ?>
                        </div>
                        
                    </div>
    			
    			</div>
			</div>