<?php
include "scrinit.php";
include "logo.php";
?>


<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<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=1000, height=700, top='+top+', left='+left);
}
</script>
<style type="text/css">
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:1px solid black;padding:5px;font-size:14px; }
<p style="font-size:14px;"></p>
</style>


</head>

<body>
<?php
require("dbconnect.php");
$gym=$_SESSION['gym'];
$tmath=$_GET['tm'];
//$ar=explode("/",$syndx);
//$synd=$ar[0];
//$syndid=$ar[1];
echo "<br>";
echo "<font face='arial' size='4pt'> ΚΑΘΗΓΗΤΕΣ ΠΟΥ ΔΙΔΑΣΚΟΥΝ ΣΗΜΕΡΑ ΣΤΟ TMHMA : $tmath </font> "; 
echo "<br>";
echo "<table style='width:900px' class='myTable' >
<tr style='border:1px solid black' bgcolor='#FFAF80'  >
<th>Α/Α</th>
<th>Εκπαιδευτικός</th>";
for ($i=1;$i<=$gym;$i++)
{
	$titep="Περ".$i;
	echo "<th>".$titep."</th>";
}
$ta="";
$all="id,pmp,Teacher,";
for ($i=1;$i<=$gym;$i++){$ta.="day".$i.',';}
$all=$all.$ta;
$all = rtrim($all, ',');
$fd="";
for ($i=1;$i<$gym;$i++)
{
	$fd=$fd."day".$i."="." '$tmath' "."OR ";
}
$fd=$fd."day".$i."="." '$tmath' ";

$result = mysqli_query($con,"SELECT ".$all." FROM dailytab WHERE ".$fd. "");
$i=1;
while($row=mysqli_fetch_array($result))
	{	
      $kath[$i]=$row['Teacher']; 
      $idteach[$i]=$row['id'];
      echo "<tr>";
      echo "<td>".$idteach[$i]. "</td>";
      echo "<td>".$kath[$i]."</td>";
      for($k=1;$k<=$gym;$k++)
      {
	     $in="day".$k;
         $l1=$row["$in"];
		 ?>
		 <td><b>
         <a href="#" onClick="popupCenter('findallages1.php?tm=<?php echo $l1; ?>')" style="text-decoration:none;"><?php echo $l1;?></a>
		 </b></td>
         <?php	 
  	  } 
      echo "</tr>";
	  $i++;
}

echo "</table>";
?>
<br><br>
<button onClick="window.print()">	Εκτύπωση Σελίδας</button>
<input type="button" name="epistrofi" value="Επιστροφή" onClick="self.close()"> 		
</body>
</html>