<?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">
td.right1{text-align: right;}
input.right{  text-align:right;  }
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:1px solid black;padding:2px;font-size:14px; }
<p style="font-size:14px;"></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=800, height=900, top='+top+', left='+left);
}
</script>
</head>
<body>
<h2> ΒΑΘΜΟΛΟΓΙΕΣ Α' ΤΕΤΡΑΜΗΝΟΥ</h2>
<?php
require "dbconnect.php";
$usr=$_SESSION['usr'];


if (isset($_POST['nameid'])) {$mitr=$_POST['nameid'];}
else
$mitr=$_SESSION['studentid'];
  
echo "<table style='width:500px' class='myTable' >
<tr style='border:1px solid black' bgcolor=#81DAF5 >
<th>ΣΤΟΙΧΕΙΑ ΜΑΘΗΤΗ/ΜΑΘΗΤΡΙΑΣ</th>
<th>ΤΜΗΜΑ</th>
<th>ΒΟΗΘΟΣ ΔΙΕΥΘ.</th>
<th>ΥΠΕΥΘΥΝΟΣ ΚΑΘ.</th>
</tr>";

$sql = mysqli_query($con,"SELECT * FROM allstudentinfo WHERE mitroo='$mitr'  " );
$row = mysqli_fetch_array($sql);
$stname=$row['eponimo']." ".$row['onoma'];
$tmimaid=$row['tmima'];
 echo "<tr>";
 echo "<td>".$stname. "</td>";
 echo "<td>".$tmimaid. "</td>";
 $sql = mysqli_query($con,"SELECT voithos.voi_id,vd.voi_name,voithos.yt FROM voithos,vd WHERE voithos.Class_id='$tmimaid' AND voithos.voi_id=vd.voi_id  " );
 $row = mysqli_fetch_array($sql);
 $vdname=$row['voi_name'];
 $yt=$row['yt'];
 echo "<td>".$vdname. "</td>";
 $sql = mysqli_query($con,"SELECT Name FROM teachers WHERE PMP='$yt' " );
 $row = mysqli_fetch_array($sql);
 $ytname=$row['Name'];
 echo "<td>".$ytname. "</td>";
 echo "</tr>";
 echo "</table>";
 echo "<br>";

?>
<h4>ΑΝΑΦΟΡΑ ΒΑΘΜΟΛΟΓΙΑΣ</h4>
<?php
$sql = mysqli_query($con,"SELECT * FROM bathmologio WHERE mitroo='$mitr' " );

echo "<table style='width:900px' class='myTable' >
<tr style='border:1px solid black' bgcolor='#d6ff73'  >
<th>a/a</th>
<th>Τμήμα/Συνδιδ.</th>
<th>Μάθημα</th>
<th>Τετράμηνο</th>
<th>Αξιολ1</th>
<th>Αξιολ2</th>
<th>Αξιολ3</th>
<th>Αξιολ4</th>
<th>Αξιολ5</th>
<th>Αξιολ6</th>
<th>Αξιολ7</th>
<th>Αξιολ8</th>
<th>Αξιολ9</th>
<th>Αξιολ10</th>
</tr>";	
$i=1;
while($row = mysqli_fetch_array($sql)) 
{
echo "<tr>";
echo "<td>". $i . "</td>";
echo "<td>". $row['mathima'] . "</td>";
echo "<td>". $row['subject'] . "</td>";
echo "<td>". $row['tetramino']. "</td>";
$lesson=$row['mathima'];$subject=$row['subject'];$tetramino=$row['tetramino'];
$sql1 = mysqli_query($con,"SELECT * FROM baros  WHERE mathima='$lesson' AND subject='$subject' AND tetramino='$tetramino'");
$row1 = mysqli_fetch_array($sql1);
for ($k=1;$k<=10;$k++)
{
  $aks='aks'.$k;$apo='apo'.$k;
  $p=$row1["$apo"];
  if ($p==0){$p=20;}
  $x=$row["$aks"]*20/$p;
  
  echo "<td class='right1'>".number_format((float)$x, 2, '.', '')."</td>";
}
echo "</tr>"; 
$i++;	
}
echo "</table>";

 ?>

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