<?php
session_start();

?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Απουσίες Μαθήματος</title>
<style type="text/css">
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:1px solid black;padding:1px;font-size:10pt; }
<p style="font-size:10px;"></p>
</style>

</head>

<body>
<h4> ΑΝΑΠΛΗΡΩΣΕΙΣ </h4>

<?php
require "dbconnect.php"; 
$dt=$_SESSION['dt'];
echo "ΗΜΕΡΟΜΗΝΙΑ:".$dt;

$day = date('D', strtotime($dt));
echo $day."<br>";
 
$strenc2= $_GET['data'];
$arr = unserialize(urldecode($strenc2));
$apon=$arr[1]  ;
$period =$arr[2] ;

$sql= mysqli_query($con,"SELECT * FROM timetable  " );
$c=mysqli_num_rows($sql); 

$i=1;
while($row = mysqli_fetch_array($sql))
{
	$teachr=$row['Teacher'];
	$flg=0;
	for ($j=1;$j<=7;$j++) {
	    $d=$day.$j;	
	    if ($row["$d"] <> NULL ) {
		   $flg=1;
	       $lesson[$i][$j]=$row["$d"];}
		 else
		{ $lesson[$i][$j]=" ";}
	}
	if ($flg == 1) {
		$teach[$i]=$teachr;
		$i++;
	}
	$row = mysqli_fetch_array($sql);
}
$limit=$i;


echo "<table class='myTable' >
<tr style='border:1px solid black' >
<tr>
<th>Teacher</th>
<th>ΠΕΡΙΟΔΟΣ 1</th>
<th>ΠΕΡΙΟΔΟΣ 2</th>
<th>ΠΕΡΙΟΔΟΣ 3</th>
<th>ΠΕΡΙΟΔΟΣ 4</th>
<th>ΠΕΡΙΟΔΟΣ 5</th>
<th>ΠΕΡΙΟΔΟΣ 6</th>
<th>ΠΕΡΙΟΔΟΣ 7</th>
</tr>";


for ($j=1; $j<=$limit; $j++)
    { 
	if ($lesson[$j][$period] == " "){
	 echo "<tr>";
	 echo "<td>".$teach[$j]."</td>";
	 
	  for ($k=1; $k<=7; $k++) 
	  { 
	    	$ls=$lesson[$j][$k];
			
			echo "<td>".$ls."</td>";
			/*echo "<td bgcolor='#330099'> ";
			echo "<font color='#FFFFFF''> $ls </font>";
	        echo "</td>"; */ 
	   }

	 echo "</tr>";
	}
	}
echo "</table>";


//<br />
//<a  href="index.php" style="color:blue "  >  Επιστροφή στο Μενού  </a>


?>


</body>
</html>