ore<?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
$usr=$_SESSION['usr'];
$dt=$_SESSION['dt'];
$dta= date("Y-m-d", strtotime('2020-01-13'));
$gym=$_SESSION['gym'];
$tetr=$_SESSION['tetramino'];

?>
<br>
<form method="POST" name="st" >
<fieldset fieldset class="fieldset" >
<legend> <?php echo "<b>"."ΕΠΕΛΕΞΕ ΤΕΤΡΑΜΗΝΟ"."</b>"; ?> </legend>  
<br>
TETRAMHNO:
<input type="radio" name="tetr"
<?php if ($tetr=="Α") echo "checked";?> value="Α">Α 
<input type="radio" name="tetr"
<?php if ($tetr=="Β") echo "checked";?> value="Β">Β 
&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp<input type="Submit" name="Submitk" value="Επιλογή"	/>
</fieldset>
</form>
<?php  
if (isset($_POST['Submitk']))
{
$tetr=$_POST['tetr'];
$sql1 = $dbcon->prepare("SELECT * FROM parameters " );
	$sql1->execute();
	$row1=$sql1->fetch(PDO::FETCH_ASSOC);
	$atetrs=$row1['atetrs'];
	$atetre=$row1['atetre'];
	$btetrs=$row1['btetrs'];
	$btetre=$row1['btetre'];
if ($tetr=="Α")
{	
	$dta=$atetrs;
	$dtm=$atetre;
}
else
{
	$dta=$btetrs;
	$dtm=$btetre;	
}

$sql1 = "SELECT * FROM declarations WHERE testdate >='$dta' AND testdate <='$dtm' AND teacher='$usr'" ;
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='$usr' and tetramino='$tetr' order by date");
if (mysqli_num_rows($sq) > 0)
{
echo "<br>";
echo "ΚΑΤΑΧΩΡΗΜΕΝΕΣ ΒΑΘΜΟΛΟΓΙΕΣ ". $tetr. "ΤΕΤΡΑΜΗΝΟΥ" ;	
$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>";
include "selectsubj.php";
}
else
{
	echo "ΔΕΝ ΕΧΟΥΝ ΚΑΤΑΧΩΡΗΘΕΙ ΒΑΘΜΟΛΟΓΙΕΣ";
}

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

?>

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