<?php
	if ($this->session->userdata('permisson')==1) {
		$CI =& get_instance();
		$CI->load->library('libraryprofile');
		$CI->libraryprofile->showMenuBarManager($this->session->userdata('meno'),$this->session->userdata('priezvisko'));
		echo '<div id="default_container">';
			echo "<h3>Hlásenia od zamestnancov: </h3>";
				
				foreach($posts as $post){
				echo "<table class='postTable'>"; 
					echo "<tr>";
						echo "<td rowspan='2' style='width:45px;'>";
							echo "&nbsp";
						echo '</td>';
						echo "<td rowspan='2' style='width:50px;'>";
							switch($post->Status){
								case 1:
									echo "<img src='http://martinbendik.studenthosting.sk/pictures/que.png' height='20' width='20' style='margin-top:3px'>";								 
								break;
								case 0:
									echo "<img src='http://martinbendik.studenthosting.sk/pictures/yes.png' height='20' width='20' style='margin-top:3px'>"; 
								break;
							}
						echo "</td>";
						echo "<td style='width:100px'>";
							if($post->Status==1){
							 echo "<b>";
						 	}
							echo "ID hlásenia:";
						echo "</td>";
						echo "<td style='width:160px'>";
							if($post->Status==1){
							 echo "<b>";
						 	}
							echo "Odosielateľ:";
						echo "</td>";
						echo "<td style='width:200px'>";
							if($post->Status==1){
							 echo "<b>";
						 	}
							echo "Predmet:";
						echo "</td>";
						echo "<td style='width:150px'>";
							if($post->Status==1){
							 echo "<b>";
						 	}
							echo "Podané:";
						echo "</td>";
						echo "<td style='width:280px'>";
							if($post->Status==1){
							 echo "<b>";
						 	}
							echo "Hlásenie:";
						echo "</td>";
						echo "<td rowspan='2'>";
							echo '<div class="button-group" style="margin-top:4px">';
								echo '<a class="button" href="'.base_url('manager/redirectPostDetail/'.$post->ID_HLA).'">Zobraziť</a>';
							echo '</div>';
						echo "</td>";
						echo "<td rowspan='2' style='width:82px;'>";
							echo "&nbsp";
						echo '</td>';
					echo "</tr>";
					echo "<tr>";
						echo "<td>";
							if($post->Status==1){
							 echo "<b>";
						 	}
							if (strlen($post->ID_HLA)==1) {
								echo "0000";
								echo $post->ID_HLA;
							} elseif (strlen($post->ID_HLA)==2) {
								echo "000";
								echo $post->ID_HLA;
							} elseif (strlen($post->ID_HLA)==3) {
								echo "00";
								echo $post->ID_HLA;
							} elseif (strlen($post->ID_HLA)==4) {
								echo "0";
								echo $post->ID_HLA;
							} else {
								echo $post->ID_HLA;
							}
						echo "</td>";
						echo "<td>";
							if($post->Status==1){
							 echo "<b>";
						 	}
							echo $post->Meno." ".$post->Priezvisko;
						echo "</td>";
						echo "<td>";
							if($post->Status==1){
							 echo "<b>";
						 	}
							if(strlen($post->Predmet)>26){
								$pre = explode(" ",substr($post->Predmet, 0, 26));
								unset($pre[(count($pre)-1)]);
								foreach ($pre as $p){
									echo $p." ";
								}
								echo "...";	
							}else{
								echo $post->Predmet;
							}							
						echo "</td>";
						echo "<td>";
							if($post->Status==1){
							 echo "<b>";
						 	}
							echo date('d.m.Y h:i', strtotime($post->Datum_podania));
						echo "</td>";
						echo "<td>";
							if($post->Status==1){
							 echo "<b>";
						 	}
							$mess = explode(" ",substr($post->Hlasenie, 0, 40));
							unset($mess[(count($mess)-1)]);
							foreach ($mess as $m){
								echo $m." ";
							}
							echo "...";
						echo "</td>";							
					echo "</tr>";
				echo "</table>";
		echo "<div class='vehicle_div' style='align:center;'></div>";		
				}	
		echo '<div style="margin-top:30px">';
		echo '</div>';		
		echo '</div>';	
		echo $this->pagination->create_links();
	} else {
		redirect(base_url('main/restricted'));
	}	
?>

	
	
	


