<?php 
session_start();
$menu=$_SESSION['menu'];
include $menu;
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Kathisteriseis</title>
<style type="text/css">
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:1px solid black;padding:2px;font-size:10pt; }
<p style="font-size:10px;"></p>
</style>

</script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
$(function() {
 $("#tmimaid").bind("change", function() {
     $.ajax({
         url: "change.php",
         data: "tmimaid="+$("#tmimaid").val(),
         success: function(html) {
             $("#nameid").html(html);
         }
     });
 }); 
});

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=800, height=900, top='+top+', left='+left);
}
</script>
</head>
<body>
<h3> ΚΑΘΥΣΤΕΡΗΣΕΙΣ ΚΑΤΑ ΚΑΘΗΓΗΤΗ-ΠΕΡΙΟΔΟ</h3>
<?php 

require("dbconnect.php");
$usr=$_SESSION['usr'];
$name=$_SESSION['n'];
$acess=$_SESSION['access'];

$sql = mysqli_query($con,"SELECT ap.teacher,ap.period,ap.kath,t.Name FROM apousies as ap,teachers as t  
   WHERE  ap.teacher=t.PMP AND ap.apousia=0 AND ap.kath>0  ORDER BY ap.teacher,ap.period" );

$kteach=array();
$row = mysqli_fetch_array($sql);
while (!empty($row))
{
  $katht=array();
  $pmpt=$row['teacher'];
  $name=$row['Name'];
  
  while($pmpt==$row['teacher'])
  {
	  $per=$row['period'];
	  $kteach[$name][$per]=$kteach[$name][$per]+1; 
	  $row = mysqli_fetch_array($sql);
  }
}


echo "<table class='myTable' >
<tr style='border:1px solid black' >
</tr>";
echo "<th>Α/Α</th>
<th>ΚΑΘΗΓΗΤΗΣ</th>
<th>ΠΕΡ1</th>
<th>ΠΕΡ2</th>
<th>ΠΕΡ3</th>
<th>ΠΕΡ4</th>
<th>ΠΕΡ5</th>
<th>ΠΕΡ6</th>
<th>ΠΕΡ7</th>
</tr>";

$j=1;
foreach($kteach as $key => $tt){
     echo "<tr>";
	 echo "<td>".$j."</td>";
	 echo "<td>".$key."</td>";
     
    for ($i=1;$i<=7;$i++)
	{
		echo "<td>".$tt[$i]."</td>";	
	}
    
	echo "</tr>";
	$j++;
}

echo "</table>";	



?>


<br /><br />

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