<?php
include "scrinit.php";
include "logo.php";
date_default_timezone_set("Europe/Athens");
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:2px solid black;padding:5px;font-size:14px; }
.dw{
    width:80px;
    word-wrap:break-word;
 
}
.dw1{
    width:600px;
    word-wrap:break-word;
 
}
<p style="font-size:14px;"></p>
</style>

<h2>ΚΑΤΑΣΤΑΣΗ ΑΝΑΚΟΙΝΩΣΕΩΝ</h2>
<?php
require "dbconnect.php";
$usr=$_SESSION['usr'];

$sql = mysqli_query($con,"SELECT * FROM anakoinosi WHERE parents = 0 AND teacher=0 order by datein DESC  " );
$c=mysqli_num_rows($sql);

if ($c==0)
{ 
  echo "<tr>";
  echo " ΔΕΝ ΥΠΑΡΧΟΥΝ Ανακοινώσεις ";
  echo "</tr>";
}
else
{
?>
<div style="overflow:scroll; border:1px solid black;background:#F5F9F0;width:1150px; height: 550px">
<?php
echo "<table style='width:1130px' class='myTable' >
<tr style='border:2px solid black' bgcolor='#adcd82'  >
<th>ΑΡΙΘΜΟΣ</th>
<th class='dw'>ΗΜΕΡΟΜΗΝΙΑ</th>
<th class='dw1'>ΠΕΡΙΕΧΟΜΕΝΟ ΑΝΑΚΟΙΝΩΣΗΣ</th>
<th colspan='2'>ΑΡΧΕΙΟ</th>
</tr>";	
   while ($row = mysqli_fetch_array($sql)) 
	{
		$code=$row['id'];
		$datein= $row['datein'];
		$per=trim($row['keimeno']);
		$fname=$row['arxeio'];
		echo "<tr>";
		echo "<td>" .$code."</td>";
		echo "<td class='dw'>". $datein . "</td>";
		echo "<td class='dw1'>". $per. "</td>";
		echo "<td>". $fname. "</td>";
		echo "<td align='center'>";
	if (!empty($fname))
	{
	$arr=explode(".",$fname);
	$extns=$arr[1];
	switch ($extns)
	{
	case "pdf":
        $imgx="files/imgpdf.jpg";
        break;
	case "docx":
        $imgx="files/imgdocx.jpg";
        break;
	case "txt":
        $imgx="files/imgtxt.jpg";
        break;	
	}
	
	$lnk="files/".$fname;
	
	?>
	<a href="<?php echo $lnk;?>" target="_blank"><img src="<?php echo $imgx;?>" width="40" height="40" /></a>
	<?php
	}
	echo "</td>";
		echo "</tr>";
	}
	echo "</table>";
}

?>
</div>
<br/><br /><br>
<a  href=<?php echo $menu;?> style="color:blue" > <button style="color:blue"> Επιστροφή στο Μενού </button></a>
</body>
</html>