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

<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:11px; }
<p style="font-size:11px;"></p>
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
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=1000, height=900, top='+top+', left='+left);
}
</script>

</head>
<body  style="width:995px; margin:0 auto; ">

<?php 
require("dbconnect.php");
echo "<br>"."<br>";
$_SESSION['tax']='Β';
$sql=  mysqli_query($con,"SELECT  a.kat,COUNT(a.kat) as ckat,k.name from (select distinct(mitroo),kat from epiloges where class='Β') as a,kats as k 
WHERE a.kat=k.kat group by a.kat order by a.kat ASC");

echo "ΕΠΙΛΟΓΕΣ ΚΑΤΕΥΘΥΝΣΗΣ Α ΠΡΟΣ Β";
echo "<br>";
echo "<table class='myTable' >
<tr style='border:1px solid black;font-size:16px'  >
<tr>
<th>Κατεύθυνση</th>
<th>Αριθμός</th>
</tr>";	
while($row = mysqli_fetch_array($sql))
{
   echo "<tr>";
   ?>
     <td>
   <a href="#" onClick="popupCenter('mathiteskat.php?kat=<?php echo $row['kat']; ?>')"><?php echo $row['name']; ?></a>
    </td>
	<?php
   echo "<td>". $row['ckat'] . "</td>";
   echo "</tr>";
}
echo "</table>"; 

$result = mysqli_query($con,"SELECT  count(DISTINCT(mitroo)) as stus FROM epiloges where class='Β'" );
$row=mysqli_fetch_array($result);

echo "<br>"."ΣΥΝΟΛΟ ΜΑΘΗΤΩΝ : ".$row['stus'];
//***********************
echo "<br>"."<br>";echo "<br>"."<br>";
$sql=  mysqli_query($con,"SELECT  epilogi,COUNT(epilogi) as cepi from epiloges where epilogi <>'' and class='Β' group by epilogi ");

echo "ΕΠΙΛΟΓΕΣ ΜΑΘΗΜΑΤΩΝ Α ΠΡΟΣ Β";
echo "<br>";
echo "<table class='myTable' >
<tr style='border:1px solid black;font-size:16px'  >
<tr>
<th>ΜΑΘΗΜΑ</th>
<th>Αριθμός</th>
</tr>";	
while($row = mysqli_fetch_array($sql))
{
   echo "<tr>";
   //echo "<td>". $row['epilogi']." . ".$row['name']. "</td>";
   ?>
     <td>
   <a href="#" onClick="popupCenter('mathitesepilogi.php?less=<?php echo $row['epilogi']; ?>')"><?php echo $row['epilogi']; ?></a>
    </td>
<?php
   echo "<td>". $row['cepi'] . "</td>";
   echo "</tr>";
}
echo "</table>"; 
echo "<br>";echo "<br>";
echo "ΔΕΝ ΔΗΛΩΣΑΝ ΜΑΘΗΜΑΤΑ"."<br>";
$result = mysqli_query($con,"SELECT  DISTINCT mitroo FROM epiloges where class='Β'" );
$i=1;
while($row=mysqli_fetch_array($result)) {$d[$i]=$row['mitroo'];$i++;}

$result = mysqli_query($con,"SELECT  mitroo,onoma,eponimo,tmima,identity FROM allstudentinfo where tmima like 'Α%' order by tmima" );
$i=1;
while($row=mysqli_fetch_array($result)) 
{
	$dal[$i]=$row['mitroo'];
	$name[$dal[$i]]=$row['eponimo']." ".$row['onoma'];
	$tmima[$dal[$i]]=$row['tmima'];
	$idt[$dal[$i]]=$row['identity'];
	$i++;}

$dif=array_diff($dal,$d);
$n=count($dif);
echo "<br>";
echo "<table style='width:500px' class='myTable' >
	<tr style='border:1px solid black' bgcolor=#81DAF5 >
	<th>A/A</th>
	<th>ΜΗΤΡΩΟ</th>
	<th>ΤΜΗΜΑ</th>
	<th>ΜΑΘΗΤΗΣ / ΜΑΘΗΤΡΙΑ</th>
	<th>ΤΑΥΤΟΤΗΤΑ</th>
	
	</tr>";
$i=1;
foreach($dif as $x)
{  
	echo "<tr>";
    echo "<td>". $i;
	echo "<td>". $x;
	echo "<td>". $tmima[$x];
	echo "<td>". $name[$x];
	echo "<td>". $idt[$x];
	echo "</tr>";
	$i++;
}
echo "</table>";
?>	
<br /><br />
<a  href=<?php echo $menu;?> style="color:blue "  > <button> Επιστροφή στο Μενού   </a>

</body>
</html>