<?php
session_start();
ob_start();
if ($_SESSION['islogin']=='' ) { 
  echo "ΠΡΕΠΕΙ ΝΑ ΕΓΓΡΑΦΕΙΤΕ ΓΙΑ ΝΑ ΧΡΗΣΙΜΟΠΟΙΗΣΕΤΕ ΤΟ ΣΥΣΤΗΜΑ"."<BR>";
  sleep(3);
  header("Location: loginall.php"); /* Redirect browser */
  exit();
  }
$menu = $_SESSION['menu'];
require("dbconnect.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: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 
   
$sql=mysqli_query($con,"SELECT  tmima,eponimo,onoma,mitroo,omp from allstudentinfo  
where tmima LIKE 'Β%' order by tmima,eponimo,onoma");

echo "<br>";
echo "ΕΠΙΛΟΓΕΣ ΜΑΘΗΜΑΤΩΝ B ΠΡΟΣ Γ ΛΥΚΕΙΟΥ";
echo "<br>";
echo "<table class='myTable' >
<tr style='border:1px solid black;font-size:16px'  >
<tr>
<th>A/A</th>
<th>ΤΜΗΜΑ</th>
<th>ΜΗΤΡΩΟ</th>
<th>ΟΝΟΜΑ</th>
<th>ΟΜΠ</th>
<th>ΚΑΤ/ΣΗ</th>
<th>ΜΑΘΗΜΑ 1</th>
<th>ΜΑΘΗΜΑ 2</th>
</tr>";	
$k=1;
while ($row=mysqli_fetch_array($sql))
{
   $mitroo=$row['mitroo'];
   $tmima=ltrim(rtrim($row['tmima']));
   $name=$row['eponimo']." ".$row['onoma'];
   $omp=$row['omp'];
   echo "<tr>";
   echo "<td>". $k. "</td>";
   echo "<td>".$tmima. "</td>";
   
   $sqle=mysqli_query($con,"SELECT  * from epiloges where mitroo='$mitroo' and class='Γ' ");
   if (mysqli_num_rows($sqle) > 0)
   {
	  $i=1; $j=1; $ep="";$met=""; $math=array();
     while ($rowe=mysqli_fetch_array($sqle))
     {
       $omp=$rowe['omp'];
	   $kat=$rowe['kat'];
	   $ep=$rowe['epilogi'];
	   if ($ep <> "")
	    {	 $math[$i]=$ep;$i++;}
	   else
	    {   $math[$i]="";} 
     }
   }
   else
   {
	 $kat=" ";
     $math[1]=" ";$math[2]=" ";
   }
   $mo=$mitroo."/".$omp."/".$name;
   
   ?>
     <td>
     <a href="#" onClick="popupCenter('diloBsimv.php?mo=<?php echo $mo; ?>')"><?php echo $mitroo; ?></a>
     </td>
   <?php
   echo "<td>".$name. "</td>";
   
   echo "<td>". $omp. "</td>";
   echo "<td>". $kat. "</td>";
   echo "<td>". $math[1]. "</td>";
   echo "<td>". $math[2]. "</td>";   
   echo "</tr>";
   $k++;


}
echo "</table>"	;

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

</body>
</html>