<?php
include "scrinit.php";
include "logo.php";
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</script>
<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=800, top='+top+', left='+left);
document.forms["carservice"].submit();	
}

function submitform()
{
    document.forms["carservice"].submit();
}

function pop_up(url){
window.open(url,'win2','status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=800,height=800,directories=no,location=no') 
}

</script>
<style type="text/css">
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:2px solid black;padding:2px;font-size:13px; }
<p style="font-size:14px;"></p>
</style>


</head>
<h4> ΑΞΙΟΛΟΓΗΣΗ ΤΗΣ ΕΠΙΔΟΣΗΣ ΜΑΘΗΤΗ/ΤΡΙΑΣ ΣΤΟ Δ.Δ.Κ</h4>
<body>
<?php

require("dbconnect.php");
$mitroo=$_SESSION['usr'];

if (isset($_GET['mitr'])){$mitroo=$_GET['mitr'];}

if (isset($_POST['nameid'])) {$mitroo=$_POST['nameid'];}
$_SESSION['mitroo']=$mitroo;

$result = $dbcon->prepare("SELECT tmima,eponimo,onoma FROM allstudentinfo WHERE mitroo=?");
$result->execute([$mitroo]);
$row=$result->fetch(PDO::FETCH_ASSOC);

echo "<table class='myTable' >
<tr style='border:1px solid black' bgcolor='#d6ff73'  >
<th>Μαθητής/τρια</th>
<th>Αρ. Μητρώου</th>
<th>Τμήμα</th>
</tr>";
echo "<tr>";
echo "<td>".$row['eponimo']."  ".$row['onoma']. "</td>";
echo "<td>".$mitroo . "</td>";
echo "<td>". $row['tmima'] . "</td>"; 
echo "</tr>";
echo "</table>"; 
echo "<br>";

$_SESSION['mitroo']=$mitroo;

$result = $dbcon->prepare("SELECT * FROM ddk where mitroo=? ");
$result->execute([$mitroo]);
$row=$result->fetch(PDO::FETCH_ASSOC);
$numf=$result->columnCount();

$resultstu = $dbcon->prepare("SELECT * FROM ddkstu where mitroo=? ");
$resultstu->execute([$mitroo]);
$rowstu=$resultstu->fetch(PDO::FETCH_ASSOC);
$bathmos=$bathmosstu=array();
for ($i=1;$i<$numf;$i++)
	{	
	    $field="f".$i;
		$val=$row["$field"];
		$valstu=$rowstu["$field"];
		if ($val== NULL )
		{$bathmos[$i]=0;}
		else {$bathmos[$i]=$val;}
		if ($valstu==NULL)	{$bathmosstu[$i]=0;}
		else {$bathmosstu[$i]=$valstu;}
	}
$resddk = mysqli_query($con,"SELECT * FROM ddkportfolio ");
$sum=0;
?>

<form action="eggrafiddkstu.php" method="post" target="DoSubmit" onSubmit="DoSubmit = window.open('about:blank','DoSubmit','width=600,height=500');"> 
<?php
echo "<table class='myTable' >
<tr style='border:2px  bordercolor='#999966'; font-size:14px'; bgcolor='#d6ff73'; >
<th>A/A</th>
<th>ΔΡΑΣΤΗΡΙΟΤΗΤΑ</th>
<th>ΜΕΓ.ΜΟΝΑΔΕΣ</th>
<th>ΠΑΡΑΤΗΡΗΣΕΙΣ</th>
<th>ΑΞΙΟΛ. ΜΑΘΗΤΗ </th>
<th>ΑΞΙΟΛ. ΥΤ</th>
</tr>";
$resddk = mysqli_query($con,"SELECT * FROM ddkportfolio ");
$sum=0;
$i=1;
$k='Α';
while($rowddk=mysqli_fetch_array($resddk))
{
	 $portfolio=$rowddk['portfolio'];
	 $paratirisi=$rowddk['paratirisi'];	
	 $mark=$rowddk['mark'];
	 $aa=$rowddk['aa']; 
	 if ($mark==0 )
	 {
	   echo "<tr >";
       echo "<td colspan='6' bgcolor='#F0F2EE'>"."<b>".$k.". ".$portfolio."</b>"."</td>";
	   $k++;
	   $j=0;
	 }
	 else
	 {
		 echo "<tr>";
		 echo "<td>". $j;
		 echo "<td>". $portfolio. "</td>";
		 echo "<td>". $mark  . "</td>";
		 echo "<td>". $paratirisi . "</td>"; 
		 echo "<td>". "<input type='number' name='bathm[]' value='$bathmos[$i]' size='6' min='0' max='$mark'  >" ."</td>";
		 echo "<td>". $bathmosstu[$i] ."</td>";
		 echo "</tr>";
		 $i++;
	}
	  //$sum=$sum+$bathmos[$i];
	  $j++;
	  
}
		$sum=array_sum($bathmos);
       echo "<tr >";
       echo "<td colspan='4' bgcolor='#F0F2EE' >"."<b>".'<p style="color: red;font-size: 14pt">ΣΥΝΟΛΟ  ΒΑΘΜΟΛΟΓΙΑΣ </p>'."</b>"."</td>";
	   echo "<td>".'<p style="color: red;font-size: 14pt">'.$sum.'</p>'."</td>";
	   echo "<td>". " " . "</td>"; 
	   echo "</tr>";	 
echo "</table>";
?>
<br>
<input type="Submit" name="Submitddk" value="Καταχώρηση Βαθμολογιών ">
</form>
<?php

?>
<br /><br />

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