<?php
include "scrinit.php";
include $menu;
?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<style type="text/css">
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:1px solid green;padding:2px;font-size:10pt; }
<p style="font-size:10px;"></p>
</style>
<body>
<h2>ΑΝΑΠΛΗΡΩΣΕΙΣ</h2>

<?php
require "dbconnect.php"; 
$dt=$_SESSION['dt'];
echo "Ημερομηνία: ".$dt;
$name = $_SESSION['n'];
$name = stripslashes($name);
$gym=$_SESSION['gym'];
$day = date('D', strtotime($dt));
if ($day=="Sat" or $day=="Sun"){
	echo "<p>"."ΔΕΝ ΥΠΑΡΧΟΥΝ ΜΑΘΗΜΑΤΑ ΣΗΜΕΡΑ"."</p>";}
else 
{
include "amivallages1.php";

$sqanapl=$dbcon->prepare("SELECT a.pmp,a.datefrom,a.notr,t.id from apousieskath as a,dailytab as t where a.datefrom=? and a.pmp=t.pmp");
$sqanapl->execute([$dt]);
$anapl=$notapou=array();
$oldapou="";$stn="";$sta="";
$i=1;
while ($rowa=$sqanapl->fetch(PDO::FETCH_ASSOC))
{
 $pmpx=$rowa['pmp'];	
 $idn[$i]=$rowa['id'];
 
  if ($rowa['notr']==1)
  { 
	 $notapou[$i]=$rowa['pmp'];
	 $stn.= $idn[$i] . ",";
  }
  else
  {
	 $anapl[$i]=$rowa['pmp'];
     $sta.= $idn[$i] . ",";	 
  }
  $i++;	
}


?>
<h4> ΕΠΕΛΕΞΕ ΤΟΥΣ ΕΚΠΑΙΔΕΥΤΙΚΟΥΣ ΠΟΥ ΑΠΟΥΣΙΑΖΟΥΝ </h4>
<form  name='xx' method='post' action="allagesnew1.php">
<div style="overflow:scroll; border:1px solid black;background:#F5F9F0;width:320px; height: 450px">
<?php
echo "<table style='width:300px' class='myTable' >
<tr style='border:1px solid black' bgcolor='#adcd82'  >
<th>ΚΑΘΗΓΗΤΗΣ/ΚΑΘΗΓΗΤΡΙΑ</th>
<th> </th>
<th>ΑΠΩΝ</th>
<th> </th>
<th>ΑΔΕΙΑ</th>
</tr>";
$result = mysqli_query($con,"SELECT pmp,Teacher FROM dailytab where id % 2 = 1 ORDER BY Teacher ");
$i=1;
while ($row = mysqli_fetch_array($result)) 
  { 
    $namet[$i]=$row['Teacher'];
	$pmp[$i]=$row['pmp'];	
	if(in_array($pmp[$i],$anapl) )
	{
	   $checked = "checked";
	}
	else
	{
		$checked = "";
    }
	if(in_array($pmp[$i],$notapou))
	{
	   $chec = "checked";
	}
	else
	{
		$chec = "";
    }
	echo "<tr>";
	echo "<td>".$namet[$i]."</td>";
	echo "<td>"." "."</td>";
    echo "<td ALIGN=center>"."<input type='checkbox' name='apon[]' value='$pmp[$i]'  {$checked} >"."</td>";
	echo "<td>"." "."</td>";
    echo "<td ALIGN=center>"."<input type='checkbox' name='adeia[]' value='$pmp[$i]'  {$chec} >"."</td>";
	echo "</tr>";
    $i++;
}
echo "</table>";
?>
</div>
<br>
<input type="submit" name="anaplb" value="Επιβεβαίωση Επιλογών" >
</form>
<br />	<br />	
<?php } ?>
<br><br>
<a  href=<?php echo $menu;?> style="color:blue "  > <button> Επιστροφή στο Μενού   </a>
</body>
</html>