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

<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:2px;font-size:10pt; }
<p style="font-size:10px;"></p>
</style>

</head>

<body>



<?php
require "dbconnect.php"; 

$dt=$_SESSION['dt'];
$usr=$_SESSION['usr'];
$name = $_SESSION['n'];
$teachapon = $_SESSION['pmpapon'];
$sxolano7=$_SESSION['sxolano7'];

if (isset ($_POST['submit1'])) {
	$per=$_POST['per'];
	$lesson=$_POST['tmima1'];
	$pas=$lesson."/".$per;
    echo "ΗΜΕΡΟΜΗΝΙΑ:".$dt."<br>";
}
else
{
 	
 echo "<br>";
 echo "ΗΜΕΡΟΜΗΝΙΑ:".$dt."<br>";
 $pas=$_GET['pas'];
 $arr = explode("/", $pas);
 $lesson = $arr[0];
 $per = $arr[1];

}

$_SESSION['per']=$per;
$day=date('D').$per;
   
$less=$lesson;
$result = mysqli_query($con,"SELECT mitroo,eponimo,onoma FROM allstudentinfo WHERE tmima='$lesson' ORDER BY eponimo,onoma");
$crow1=mysqli_num_rows($result);
if ($crow1 > 0) {
$i=1;
 while($row = mysqli_fetch_array($result))
     {
	  $mt[$i]=$row['mitroo'];
	  $epo[$i]=$row['eponimo']." ".$row['onoma'];
	  $tmim[$i]=$lesson;
	  $i++;}
}
else
{

$result = mysqli_query($con,"SELECT sy.pmp,allstudentinfo.eponimo,allstudentinfo.onoma,allstudentinfo.tmima FROM 
syndidaskalies as sy,allstudentinfo WHERE sy.synd = '$lesson' AND sy.pmp=allstudentinfo.mitroo 
ORDER BY allstudentinfo.eponimo,allstudentinfo.onoma");
$crow1=mysqli_num_rows($result);
$crow1=mysqli_num_rows($result);
if ($crow1 > 0) {
	$cr=1;
	while($row=mysqli_fetch_array($result)){	
		$mt[$cr]=$row['pmp'];
	    $epo[$cr]=$row['eponimo']." ".$row['onoma'];	
		$tmim[$cr]=$row['tmima'];
		$cr++;}
}
else
{
    	$pos=strpos($lesson,"Α");
		$les=substr($lesson,$pos,2);
		$pos=$pos+2;
		$les1=substr($lesson,$pos,1);	
		$les=trim($les)."0".trim($les1);
		$les=ltrim(rtrim($les));
		$_SESSION['less']=$lesson;
       $result = mysqli_query($con,"SELECT mitroo,eponimo,onoma FROM allstudentinfo WHERE tmima='$les' ORDER BY eponimo,onoma  ");
     $crow1=mysqli_num_rows($result);
    $i=1;
    while($row = mysqli_fetch_array($result))
     {
	 $mt[$i]=$row['mitroo'];
	 $epo[$i]=$row['eponimo']." ".$row['onoma'];
	 $tmim[$i]=$les;
	 $i++;
	 }
}		
}

echo " Περίοδος :<input type='number' name='per' value='$per' /> ";
echo " Τμήμα/Συνδ.:<input type='text' name='lesson' value='$lesson' /> <br /><br />  ";

if ($sxolano7<>1) { $lesson="ΑΝΑΠΛΗΡΩΣΗ";}	else {$lesson="ΣΧΟΛΑΝΟΥΝ 7η";}

$_SESSION['less']=$lesson;

//..............................................


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

</body>
</html>