<?php
session_start();
$menu=$_SESSION['menu'];
?>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">

table.myTable { border-collapse:collapse; width:600}
table.myTable td, table.myTable th { border:1px solid black;padding:4px;font-size:11pt; }

<p style="font-size:11px;"></p>

</style>

<body>

<h2> ΠΡΟΓΡΑΜΜΑ  ΕΚΠΑΙΔΕΥΤΙΚΟΥ </h2>
<?php
  require "dbconnect.php"; 
  
  $dt=$_SESSION['dt'];
  $name = $_SESSION['n'];
  if ($_SESSION['anapl']==1) { $teach=$_SESSION['kathigitis'];} else {
  $teach = $_SESSION['n'];}

   $day = date('D', strtotime($dt));
   echo "ΗΜΕΡΟΜΗΝΙΑ:".$dt ;
   echo "<br>"."<br>";  
   mysqli_set_charset($con, "utf8");
  
   
   
   
   $result = mysqli_query($con,"SELECT * FROM timetable WHERE Teacher='$teach'  " ); 
   $row = mysqli_fetch_array($result);
   
   $i=1;
   while ($i<=7) {
   $in=$day.$i;
   $l=$row["$in"];
   $lesson[$i]= rtrim(ltrim($l));
   $i++;
   }
  $_SESSION['less1']=$lesson;
echo "<br>"."<br>";  
echo "<table style='width:600px' class='myTable' >
<tr style='border:1px solid black' bgcolor='#FFFF80' >
<th>Εκπαιδευτικός</th>
<th>Περίοδος 1</th>
<th>Περίοδος 2</th>
<th>Περίοδος 3</th>
<th>Περίοδος 4</th>
<th>Περίοδος 5</th>
<th>Περίοδος 6</th>
<th>Περίοδος 7</th>
</tr>";
 $i=1;
 echo "<tr>";
 echo "<td>". $teach . "</td>";
 while($i<=7)
     {
	  if ($_SESSION['anapl']==1) 
	  {
		 echo "<td>" . "<a href=\"anaplirosi2.php?per=".$i."\">".$lesson[$i]. "</a>". "</td>";	 
	  }
	  else
	  {
	 echo "<td>" . "<a href=\"newmath2.php?per=".$i."\">".$lesson[$i]. "</a>". "</td>";	
	  }
	 $i++;
	 }
 echo "</tr>"; 	 
echo "</table>";
echo "<br>"."<br>"."<br>"."<br>";
//..........................................

$q=mysqli_query($con, "SELECT * FROM anakoinosi WHERE dateout >= '$dt' ");
$c=mysqli_num_rows($q);

if ($c > 0) {
echo "<table style='width:700px' class='myTable' >
<tr style='border:3px solid black' bgcolor='#FF0000' padding='4px'>
<th>Αρ.</th>
<th <blink>ΑΝΑΚΟΙΝΩΣΕΙΣ ΗΜΕΡΑΣ </blink></th>
</tr>";
$i=1;
while ($row = mysqli_fetch_array($q)){

	$keimeno=$row['keimeno'];
    echo "<tr>";
    echo "<td>".$i."</td>";
    echo "<td>".$keimeno."</td>";
    echo "</tr>";

$i++;
}
echo "</table>";
}
?>

</body>
</html>