<?php
include "scrinit.php";
include $menu;
 
?><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; }
<p style="font-size:09px;"></p>
</style>
<body>


<?php
require "dbconnect.php";
$usr=$_SESSION['usr'];
$dt=$_SESSION['dt']; 
$date=$dt;

$sql = mysqli_query($con,"SELECT PMP FROM teachers WHERE idikotita='ΠΛΗΡΟΦΟΡΙΚΗ'"); 
$i=1;
$pl=array();
while ($row = mysqli_fetch_array($sql)) 
{
		$pl[$i]=$row['PMP'];
		$i++;
}
if (in_array($usr, $pl))
{
	
$sql1 = "SELECT * FROM epidiorthosi WHERE problemwith=1 or problemwith=3 order by datein asc " ;

if (!mysqli_query($con,$sql1)) {die('Πρόβλημα: ' . mysqli_error($con));   }
$res=mysqli_query($con,$sql1);
$c=mysqli_num_rows($res);

if ($c <> 0 )
{
?>
<h3>ΕΠΙΣΚΟΠΗΣΗ ΑΝΑΦΟΡΩΝ ΓΙΑ ΠΡΟΒΛΗΜΑΤΑ </h3>	
<?php
echo "<table  class='myTable' >
<tr style='border:1px solid black' bgcolor='#ffcc00'  >
<th>Κωδ.</th>
<th>Ημερ.Κατ</th>
<th>Εκπαιδευτικός</th>
<th>Αίθουσα</th>
<th>Πρόβλημα</th>
<th>Ημερ.Επιδ</th>
<th>Υπεύθυνος/η</th>
<th>Ενέργειες</th>
<th>Κατάσταση</th>
</tr>";	

while ($row = mysqli_fetch_array($res)) 
{
	$code=$row['id'];
	$pmp=$row['pmp'];
	$perigrafi=$row['perigrafi'];
	$datein=$row['datein'];
	$datefixed=$row['datefixed'];
	$room=$row['room'];
	$ype=$row['pmpresp'];
	$ene=$row['energies'];
	if ($row['status']==1){$st='OK';} else {$st='ΕΚΚΡΕΜΕΙ';}
	$sqlx=mysqli_query($con,"SELECT Name  FROM teachers  WHERE  PMP='$pmp' " );
    $row2 = mysqli_fetch_array($sqlx);
    $tname=$row2['Name'];
	$sqlx=mysqli_query($con,"SELECT Name  FROM teachers  WHERE  PMP='$ype' " );
    $row2 = mysqli_fetch_array($sqlx);
    $ypename=$row2['Name'];
	
	
echo "<tr>";
echo "<td>" .  "<a href=\"fixsubmit2.php?data=".$code."\">"."<b>".$code."</b>". "</a>". "</td>";
echo "<td>" . $datein. "</td>";
echo "<td>" . $tname. "</td>";
echo "<td>" . $room. "</td>";
echo "<td>" . $perigrafi. "</td>";
echo "<td>" . $datefixed. "</td>";
echo "<td>" . $ypename. "</td>";
echo "<td>" . $ene. "</td>";
echo "<td>" . $st. "</td>";
echo "</tr>"; 
}
echo "</table>";

}
}
else
{
	echo " Η ΑΝΑΦΟΡΑ ΔΕΝ ΣΑΣ ΑΦΟΡΑ";
}
 ?>
</body>
</html>