<?php
include "scrinit.php";
include $menu;
?>
<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:11pt; }
<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=700, height=600, top='+top+', left='+left);
}
</script>
</head>

<body>

<?php
require "dbconnect.php";
$dt=$_SESSION['dt'];
$usr=$_SESSION['usr'];
$gym=$_SESSION['gym'];
$access=$_SESSION['access'];


$sql = $dbcon->prepare("select Class_id from voithos where yt=? ");
$sql->execute([$usr]);
if ($sql->rowCount()>0)
{
    $row=$sql->fetch(PDO::FETCH_ASSOC);
    $tmima=$row['Class_id'];

?>
<h3> ΒΑΘΜΟΛΟΓΙΕΣ ΜΗ ΕΞΕΤΑΖΟΜΕΝΩΝ ΓΙΑ ΤΟ ΤΜΗΜΑ: <?php echo $tmima; ?> </h3>
<?php
$result = mysqli_query($con,"SELECT mitroo,eponimo,onoma FROM allstudentinfo WHERE tmima='$tmima' ORDER BY eponimo,onoma  ");
$cr=0;$m=1;$i=0;
while($row = mysqli_fetch_array($result))
{
	$cr++;
	$mt[$cr]=$row['mitroo'];
	$epo[$cr]=$row['eponimo']." ".$row['onoma'];
	$result1 = mysqli_query($con,"SELECT  * FROM bathmoiab where mitroo='$mt[$cr]' and tetramino='$tetramino'");
	while ($row1=mysqli_fetch_array($result1))
	{
		$math1=$row1['mathima'];
		$ar=explode("/",$math1);
		$matx=trim($ar[1]); 
		$mat[$matx]=$matx;
		if ($tetramino=='Α')
		{
			$b[$mt[$cr]][$matx]=$row1['ba'];
		}
		else
		{
			$b[$mt[$cr]][$matx]=$row1['bb'];
		}
	}
}

$m=count($mat);

echo "<table class='myTable' >
<tr style='border:1px solid black' bgcolor='#d6ff73'  >
<th>Α/Α</th>
<th>Μητρώο</th>
<th>Όνομα Μαθητή/τριας</th>";
$k=0;
foreach ($mat as $math)
{	
	$k++;
	echo "<th>".$math."</th>";
	$ar1[$k]=$math;
	echo "<th></th>";
	
} 
$m=$k; 
echo "<tr>"; 
for ($j=1;$j<=$cr;$j++) 
{
	echo "<tr>";
	echo "<td align='center'>".$j."</td>";
	echo "<td align='center'>".$mt[$j]."</td>";
	echo "<td align='left'>".$epo[$j]."</td>";
	for ($k=1;$k<=$m;$k++)
	{	
	   echo "<td align='right'>".$b[$mt[$j]][$ar1[$k]]."</td>";
	   echo "<td></td>"; 
	}
	
	echo "</tr>";
}    

echo "</table>";
}
else
{
	echo "ΔΕΝ ΕΧΕΤΕ ΥΠΕΥΘΥΝΟΤΗΤΑ ΤΜΗΜΑΤΟΣ";
}
//<a  href="apmath.php" style="color:blue "  > <button> Επανάληψη Αναφοράς  </a>
 ?>
<br /><br />

<a  href=<?php echo $menu; ?>  style="color:blue "  > <button>  Επιστροφή στο Μενού  </a>
</body>
</html>