<?php
include "scrinit.php";
include "logo.php";
date_default_timezone_set("Europe/Athens");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

</head>
<style type="text/css">
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>
<body>
<?php 
require "dbconnect.php"; 
$usr=$_SESSION['usr'];

$sql2 = mysqli_query($con,"SELECT v.Class_id,t.Name FROM voithos as v,teachers as t where v.yt='$usr' and v.yt=t.PMP");
if (mysqli_num_rows($sql2) == 0)
{
	echo "ΔΕΝ ΕΧΕΤΕ ΥΠΕΥΘΥΝΟΤΗΤΑ ΤΜΗΜΑΤΟΣ!"."<br>";
}
else
{	

$row=mysqli_fetch_array($sql2);
$tmima=$row['Class_id'];
$ytname=$row['Name'];
echo '<p style="color: blue; text-align: left; font-weight: bold;"> ΒΑΘΜΟΛΟΓΙΑ ΔΔΚ ΤΜΗΜΑΤΟΣ  </p>';
echo '<p style="font-size: 14pt">' ."ΤΜΗΜΑ:"."<b>".$tmima."</b>".'</p>';
echo "<table class='myTable' >
<tr style='border:1px solid black' bgcolor='#d6ff73'  >
<th>No.</th>
<th>A/M</th>
<th>ΜΑΘΗΤΗΣ/ΤΡΙΑ</th>
<th>ΧΑΡΑΚΤΗΡΙΣΜΟΣ ΔΔΚ</th>
<th>ΒΑΘΜΟΣ</th>";
$mitr=array();
$sql = mysqli_query($con,"SELECT mitroo,onoma,eponimo FROM allstudentinfo where tmima='$tmima' order by eponimo,onoma");
$i=1;
while ($row=mysqli_fetch_array($sql))	
{
  $mitr[$i]=$row['mitroo'];
  $mit=$mitr[$i];
  $name[$i]=$row['eponimo']." ".$row['onoma'];
  $result = mysqli_query($con,"SELECT * FROM ddk WHERE mitroo='$mit'");
  $n=mysqli_num_fields($result)-1;
  $row1=mysqli_fetch_array($result);
  $sum=0;
  //if (mysqli_num_rows($result) > 0)
  //{
    for ($m=1;$m<=$n;$m++)
	{	
	    $field="f".$m;
		$sum=$sum+$row1["$field"];
	}
  //}
  
  if ($sum > 19 ) {$xr="ΕΞΑΙΡΕΤΙΚΗ";}
  elseif ($sum >= 14) {$xr="ΠΑΡΑ ΠΟΛΥ ΚΑΛΗ";}
  elseif ($sum >=10 ) {$xr="ΠΟΛΥ ΚΑΛΗ";}
   elseif ($sum >=7 ) {$xr="ΚΑΛΗ";}
  elseif ($sum >=4 ) {$xr="ΙΚΑΝΟΠΟΙΗΤΙΚΗ";}
  else {$xr="ΜΕΤΡΙΑ";}
  
  echo "<tr>";
  echo "<td>".$i."</td>";
  echo "<td>".$mitr[$i]."</td>";
  echo "<td>".$name[$i]."</td>";
  echo "<td>".$xr."</td>"; 
  echo "<td>".$sum."</td>";
  echo "</tr>";
  $i++;
}
echo "</table>";
echo "<br>"."<br>"."<br>";

echo "..............................."."<br>";
echo $ytname;
}

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