<?php
include "scrinit.php";
include $menu;
?><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:1px solid black;padding:2px;font-size:12px; }
<p style="font-size:10px;"></p>
</style>

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

$sql = mysqli_query($con,"SELECT * FROM kataggelia WHERE kataggelon='$usr'  " );
$c=mysqli_num_rows($sql);

echo " ΠΡΟΗΓΟΥΜΕΝΕΣ ΚΑΤΑΓΓΕΛΙΕΣ "."<br>";
echo "<table class='myTable' >
<tr style='border:1px solid black;font-size:9px'  >
<tr>
<th>Αρ.</th>
<th>Ημερομ.</th>
<th>Μαθητής/τρια</th>
<th>Περιγραφή Παραπτώματος</th>
<th>Βοηθός</th>
<th>Ημερ. Ποινής</th>
<th>Ποινή</th>
<th>Τύπος</th>
</tr>";	
if ($c==0)
{ 
  echo "<tr>";
  echo " ΔΕΝ ΥΠΑΡΧΟΥΝ ΚΑΤΑΓΓΕΛΙΕΣ ";
  echo "</tr>";
}
else
{
while ($row = mysqli_fetch_array($sql)) {
$mitroo=$row['mitroo'];
$aranaforas= $row['aranaforas'];	
$vdid=   $row['bd'];
$kataggelon= $row['kataggelon'];
$datekata= $row['datekata'];
$perigrafi=$row['perigrafi'];
$arsim = $row['arsimperiforas'];
$datetimo = $row['datetimo'];
$etimo = $row['eidostimo'];
$periodoi = $row['periodoi'];
$timcode = $row['timoriacode'];


$sql5=mysqli_query($con,"SELECT onoma,eponimo  FROM allstudentinfo  WHERE  mitroo='$mitroo' " );
$row5 = mysqli_fetch_array($sql5);
$stname = $row5['eponimo']."  ".$row5['onoma'];

$sql1=mysqli_query($con,"SELECT Name  FROM teachers  WHERE  PMP='$vdid' " );
$row1 = mysqli_fetch_array($sql1);
$vname = $row1['Name'];

$sql2 = mysqli_query($con,"SELECT Name FROM teachers  WHERE  PMP='$kataggelon'" );
$row2 = mysqli_fetch_array($sql2);
$teacher = $row2['Name'];

$sql3 = mysqli_query($con,"SELECT perigrafi FROM eidostimorias  WHERE  code='$timcode'" );
$row3 = mysqli_fetch_array($sql3);
$eidostimo = $row3['perigrafi'];

echo "<tr>";
echo "<td>" . "<a href=\"paraptoma3.php?data=".$aranaforas."\">"."<b>".$aranaforas."</b>". "</a>". "</td>";
echo "<td>". $datekata . "</td>";
echo "<td>". $stname . "</td>";
echo "<td>". $perigrafi . "</td>";
echo "<td>". $vname  . "</td>";
echo "<td>". $datetimo . "</td>";
echo "<td>". $periodoi ." "."περ.". "</td>";
if($etimo == 0 and $periodoi > 0) echo "<td>". "ΜΕ ΑΝΑΣΤΟΛΗ" . "</td>"; 
if($etimo == 1 ) echo "<td>". "ΚΑΤ΄ ΟΙΚΟΝ" . "</td>";
if ($etimo ==0 and $periodoi==0) echo "<td>". "ΑΛΛH" . "</td>"; 

echo "</tr>"; 
}
}
$query = mysqli_query($con,"SELECT MAX(aranaforas) FROM kataggelia ");
$results = mysqli_fetch_array($query);
$aranaforas = $results['MAX(aranaforas)'] + 1;
echo "<tr>";
echo "<td colspan= '8' >" . "<a href=\"paraptomakath.php?data=".$aranaforas."\">"."<b>"."ΝΕΑ ΚΑΤΑΓΓΕΛΙΑ"."</b>". "</a>". "</td>";

echo "</tr>"; 
echo "</table>";
echo "<br>"."<br>";	

 ?>

<br /><br /><br /><br />

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