<?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:12pt; }
<p style="font-size:11px;"></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=900, height=300, top='+top+', left='+left);
}
</script>




</head>
<body>
<h3>Καθηγητές ανα περίοδο</h3>

<?php 
require("dbconnect.php");
$dt=$_SESSION['dt'];
$gym=$_SESSION['gym'];
?>

<form method="post" name = "form1">
ΗΜΕΡΟΜΗΝΙΑ: <input type="date"  name = 'dt' value= <?php echo $dt; ?> > 

ΠΕΡΙΟΔΟΣ:<select name="ora">
 <?php
 for ($i=1;$i<=$gym;$i++)
 {
	 echo "<option value=".$i.">".$i."</option>";
 }
 ?>
</select>
&nbsp;&nbsp;&nbsp
<input type="submit" name="submit1" value="Επιβεβαίωση Επιλογής" >
</form>

<?php

if(isset($_POST['ora']))
{
$dt=$_POST['dt'];
$_SESSION['dt']=$dt;
$per=$_POST['ora'];

require "allagiprog.php";

echo "<br>";
echo "ΚΑΤΑΛΟΓΟΣ ΔΙΔΑΣΚΟΝΤΩΝ"."<br>";
echo "<table class='myTable' >
<tr style='border:1px solid black' bgcolor='#d6ff73'  >
<th>ΑΑ</th>
<th>ΚΑΘΗΓΗΤΗΣ</th>
<th>ΤΜΗΜΑ-ΣΥΝΔ</th>
<th>ΑΙΘΟΥΣΑ</th>
</tr>";

$d="day".$per;

$sqly = mysqli_query($con,"SELECT id,Teacher,".$d." FROM dailytab 
where id % 2 =1 AND (".$d." !='' OR ".$d." > ' ')  ");

$k=1;
while($rowy = mysqli_fetch_array($sqly))
{
	 $id=$rowy['id'];
	 $nid=$id+1;
	 $name=$rowy['Teacher'];
	 $tmima=$rowy["$d"];
	 $sqly1 = mysqli_query($con,"SELECT ".$d." FROM dailytab where id='$nid' ");
	 $rowy1 = mysqli_fetch_array($sqly1);
	 $room= $rowy1["$d"];
	 $arr = explode("/", $room);
	 $subject=$arr[1];
	 $rm = $arr[0];
	 echo "<tr>";
	 echo "<td>".$k."</td>";
	 echo "<td>".$name."</td>";
	 echo "<td>".$tmima." /".$subject."</td>";
	 echo "<td>".$rm."</td>";
	 echo "</tr>";
	 $k++;
 }
echo "</table>";	 
}

?>

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