<?php
include "scrinit.php";
include $menu;
require "dbconnect.php";
?><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; }
.fieldset
{
    width:600px;
	background: #F5F9F0;
	border:2px solid green;
    -moz-border-radius:8px;
    -webkit-border-radius:8px;	
    border-radius:8px;	
}
<p style="font-size:09px;"></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,w,h);
}
</script>
<body>

<?php

$dt=$_SESSION['dt'];
$dta=$dt;
$gym=$_SESSION['gym'];

$sqt=mysqli_query($con,"select PMP,Name from teachers where access < 4 order by Name ASC");
?>
<br>
<form method="POST" name="st" >
<fieldset fieldset class="fieldset" >
<legend> <?php echo "<b>"."ΣΤΟΙΧΕΙΑ ΔΙΑΓΩΝΙΣΜΑΤΩΝ"."</b>"; ?> </legend>  
ΚΑΘΗΓΗΤΗΣ : <select name='kathig'>
<?php 
  $i=1;$k=array();
  
  while($rowt=mysqli_fetch_array($sqt))
  {    
	$k[$i]=$rowt['Name'];
	$pmp1[$i]=$rowt['PMP'];
	$gk=$k[$i]."/".$pmp1[$i];
	echo "<option value ='".$gk."'>".$k[$i]."</option>";
	$i++;
  }
  echo "</select>"; 
  ?>
  <br><br>
  
  ΑΠΟ ΗΜΕΡΟΜΗΝΙΑ: <input type="date" name="dta" value=<?php echo $dta; ?> />
  &nbsp&nbsp&nbspΜΕΧΡΙ: <input type="date" name="dtm" value=<?php echo $dt; ?> /> 
  <br><br>
<input type="Submit" name="Submitk" value="Επιλογή"	/>
</fieldset>
</form>
<?php  
if (isset($_POST['Submitk']))
{
	$outp=$_POST['kathig'];
	$ar=explode("/",$outp);
	$name=$ar[0];
	$pmp=$ar[1];
	
echo "<br>"."<br>";

$dta=$_POST['dta'];
$dtm=$_POST['dtm'];

$sql1 = "SELECT * FROM declarations WHERE testdate >='$dta' AND testdate <='$dtm' AND teacher='$pmp'" ;
if (!mysqli_query($con,$sql1)) {die('Error: ' . mysqli_error($con));   }
$res=mysqli_query($con,$sql1);
$c=mysqli_num_rows($res);

if ($c==0){echo " ΔΕΝ ΥΠΑΡΧΟΥΝ ΔΗΛΩΜΕΝΑ ΔΙΑΓΩΝΙΣΜΑΤΑ";}
else
{
echo "ΥΠΑΡΧΟΥΝ "."<b>".$c."</b>"." ΔΗΛΩΜΕΝΑ ΔΙΑΓΩΝΙΣΜΑΤΑ ΑΠΟ : "."<b>".date('d-m-Y', strtotime($dta))."</b>";	
echo " ΜΕΧΡΙ : "."<b>".date('d-m-Y', strtotime($dtm))."</b>"."<br>";

echo "<table class='myTable' >
<tr style='border:1px solid black;font-size:12px'  >
<tr>
<th>Α/Α</th>
<th>ΗΜΕΡ. ΔΗΛΩΣΗΣ</th>
<th>ΗΜΕΡ. ΔΙΑΓ.</th>
<th>ΜΑΘΗΜΑ</th>
<th>ΤΜΗΜΑ/ΣΥΝΔ.</th>
<th>ΠΕΡΙΟΔ.</th>
<th>ΔΙΑΡΚ.</th>
</tr>";	

while ($row = mysqli_fetch_array($res)) 
{
	$id=$row['id'];
	$teacher=$row['teacher'];
	$perapo=$row['perapo'];
	$permexri=$row['permexri'];
	$decladate=$row['decladate'];
	$testdate=$row['testdate'];
	$subject=$row['subject'];
	$duration=$row['duration'];
	$class=$row['class'];


echo "<tr>";
echo "<td>" .  "<a href=\"diagoedit.php?data=".$id."\">"."<b>".$id."</b>". "</a>". "</td>";
echo "<td>" . $decladate. "</td>";
echo "<td>" . $testdate. "</td>";
echo "<td>" . $subject. "</td>";
echo "<td>" . $class. "</td>";
echo "<td>" . $perapo.' - '.$permexri. "</td>";
echo "<td>" . $duration. "</td>";
echo "</tr>"; 
	
	//.............................................
}
echo "</table>";
echo "<br>";
}
//**************************************

$sq=mysqli_query($con,"select * from aksinfo where pmpteacher='$pmp' order by date");
if (mysqli_num_rows($sq) > 0)
{
echo "<br>";
echo "ΚΑΤΑΧΩΡΗΜΕΝΕΣ ΒΑΘΜΟΛΟΓΙΕΣ";	
$i=1;$subj=array();$math=array();
while ($row=mysqli_fetch_array($sq))
{
	$subj[$i]=rtrim(ltrim($row['subject']));
	$math[$i]=rtrim(ltrim($row['tmima']));
	$all[$i]=$math[$i]."/".$subj[$i];
	$code[$i]=rtrim(ltrim($row['code']));
	$i++;
}
$k=$i-1;

echo "<table class='myTable' >
<tr style='border:1px solid black' >
<tr>
<th>Α/Α</th>
<th>ΤΜΗΜΑ</th>
<th>ΜΑΘΗΜΑ</th>
<th>CODE</th>
</tr>";
$j=1;$i=1;
while($j<=$k) 
{ 
    echo "<td>" .$i. "</td>";
	echo "<td>" .$math[$j]."</td>";
	echo "<td>" .$subj[$j]."</td>";
	echo "<td>";
	?>
	<a href="#" onClick="window.open('bathmoedit.php?data=<?php echo $code[$j]; ?>','ΒΑΘΜΟΛΟΓΙΑ','width=500,height=500')"><?php echo $code[$j]; ?></a>
	<?php
	echo "</td>";
	$j++;	 
	echo "</tr>";
 $i++; 
}
echo "</Table>";

echo "<br>"."<br>";
echo "<b>"."ΣΥΝΟΠΤΙΚΗ ΒΑΘΜΟΛΟΓΙΑ ΜΑΘΗΜΑΤΟΣ"."</b>";
echo "<br>"."<br>";
$usr=$pmp;
include "selectsubj.php";
}
else
{
	echo "ΔΕΝ ΕΧΟΥΝ ΚΑΤΑΧΩΡΗΘΕΙ ΒΑΘΜΟΛΟΓΙΕΣ";
}
}
echo "<br>"."<br>";
?>
<a  href=<?php echo $menu;?> style="color:blue "  > <button> Επιστροφή στο Μενού  </a>
</body>
</html>
