<?php if(!empty($info))
	//KOMUNIKAT
	echo '<p class="info_box">'.$info.'</p>';
?>
<script type="text/javascript">
	$(document).ready(function()
	{
		$('.tablesorter tbody tr').hover(
			function()
			{
				$(this).css('cursor','pointer');
			},
			function()
			{
				$(this).css('cursor','auto');
			}			
		);
		$('.tablesorter tbody tr').click(function()
		{
			  $.post('/tickets/ticket/'+this.id, function(data) {
			  $('#tickets').hide();
			  $('#ticket').html(data);
			});
		});		
	});
</script>
<div style="margin-top:5px;margin-right:10px;float:left;">
	Typ:
	<select name="typ" style="width:100px" onchange="location.href=this.options[this.selectedIndex].value">
		<?php
			foreach($list_types as $k=>$v)
				echo '<option value="'.base_url().$this->uri->segment(1).'/'.$this->uri->segment(2).'/'.$this->uri->segment(3).'/'.$k.$link_postfiks.'" '.((isset($list_type) && ($list_type==$v)) ? 'selected = \'selected\'' : '').'>'.$v.'</option>';
		?>										
	</select>
</div>
<br style="clear:both;"/>
<div id="tickets">
	<table  class="tablesorter" border="0" cellpadding="0" cellspacing="1">
	<thead>
		<tr>
			<th>ID</th>
			<th>Temat</th>
			<th>Priorytet</th>
			<th>Kategoria</th>
			<th>Nadawca</th>
			<th>Data wysłania</th>
		</tr>
	</thead>
	<tbody>
	<?php
		if(isset($tickets) && count($tickets)>0)
		{
			foreach($tickets as $key=>$ticket)
			{
				echo '<tr '.(($key%2 ==0) ? 'class="even"': 'class="odd"').' id="'.$ticket->id.'">';
					echo '<td>'.$ticket->id.'</td>';
					echo '<td>'.$ticket->temat.'</td>';
					echo '<td>'.$ticket->priorytet.'</td>';
					echo '<td>'.$ticket->kategoria.'</td>';
					
					if($list_type == 'odebrane')
						echo '<td>'.$ticket->nadawca.'</td>';	//odebrane
					else
						echo '<td>'.$ticket->odbiorca.'</td>';	//wyslane				
					echo '<td>'.$ticket->data_wyslania.'</td>';
				echo '</tr>';
			}		
		}
	?>	
	</tbody>
	</table>
	<?php
		echo '<br class="spacer"/><div class="pagination_links" style="margin-top:10px;margin-bottom:10px;">'.$paginacja.'</div>';
	?>
</div>
<br/>
<div id="ticket"></div>