<?php
session_start();
ob_start();
if ($_SESSION['islogin']=='' ) { 
  echo "ΠΡΕΠΕΙ ΝΑ ΕΓΓΡΑΦΕΙΤΕ ΓΙΑ ΝΑ ΧΡΗΣΙΜΟΠΟΙΗΣΕΤΕ ΤΟ ΣΥΣΤΗΜΑ"."<BR>";
  sleep(3);
  header("Location: loginall.php"); /* Redirect browser */
  exit();
  }
$menu = $_SESSION['menu'];
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:11pt; }
<p style="font-size:11px;"></p>
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">

function popupCenter(pageURL, title, w, h) {
    var left = (screen.width / 2)  - (w / 2);
    var top  = (screen.height / 2) - (h / 2);
    var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=700, height=600, top='+top+', left='+left);
}
</script>
</head>

<body>

<?php
require "dbconnect.php";
$dt=$_SESSION['dt'];
$usr=$_SESSION['usr'];
$gym=$_SESSION['gym'];
$tetramino=$_SESSION['tetramino'];

?>
<h3> ΑΠΟΥΣΙΕΣ ΣΤΟΛΗΣ ΓΥΜΝΑΣΤΙΚΗΣ </h3>
<?php
$sql1 = mysqli_query($con,"SELECT mitroo,dateout,mathima FROM apousies WHERE 
        teacher='$usr' and stoli=1 and tetramino='$tetramino' order by mitroo" );
if (mysqli_num_rows($sql1) > 0)
{
echo "<table class='myTable' >
<tr style='border:1px solid black' bgcolor='#d6ff73'  >
<th>A/A</th>
<th>ΜΗΤΡΩΟ</th>
<th>ΤΜΗΜΑ</th>
<th>ΟΝΟΜΑΤΕΠΩΝΥΜΟ ΜΑΘΗΤΗ</th>
<th>ΗΜΕΡΟΜΗΝΙΑ</th>
<th>ΣΥΝΟΛΟ</th> 
</tr>";
	
$sql1 = mysqli_query($con,"SELECT mitroo,dateout,mathima FROM apousies WHERE teacher='$usr' and stoli=1 and tetramino='$tetramino' order by mitroo" );

$k=1;
while ($rowall = mysqli_fetch_array($sql1))
{
  $ap=0;
  $mitr=$rowall['mitroo'];
  echo "<td>".$k. "</td>"; 
  echo "<td>".$mitr. "</td>";
  $sql = mysqli_query($con,"SELECT onoma,eponimo,tmima from allstudentinfo where mitroo='$mitr'");
  $row = mysqli_fetch_array($sql);
  $name=$row['eponimo']." ".$row['onoma'];
  $tmima=$row['tmima'];
  echo "<td>".$tmima."</td>";
  echo "<td>".$name."</td>"; 
  echo "<td>".$rowall['dateout']."</td>"; 
  echo "<td>".$rowall['mathima']."</td>";
  echo "</tr>";
  $k++;  
}
	 
echo "</table>";	
}
else
{
  echo "ΔΕΝ ΥΠΑΡΧΟΥΝ ΑΠΟΥΣΙΕΣ Η ΔΕΝ ΕΙΣΤΕ ΓΥΜΝΑΣΤΙΚΟΣ!";
}


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