<?php
include "scrinit.php";
include "logo.php";
?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js">
</script>
<script type="text/javascript">
function disx(b)
{
	document.getElementById(sms.b).disabled = true;
	alert(2);
	
}

function enx(x)
{
    document.getElementById(sms.x).disabled = false;
	alert(1);
}


</script>
<style type="text/css">
input.right{  text-align:right;  }
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:1px solid black;padding:2px;font-size:10pt; }
</style>
</script>

</head>

<body>
<h3> ΕΛΕΓΧΟΣ ΦΩΤΟΓΡΑΦΙΩΝ ΑΠΟΛΥΤΗΡΙΟΥ</h3>

<?php
require "dbconnect.php"; 
$usr=$_SESSION['usr'];
$yt=0;
$sql = mysqli_query($con,"SELECT * from voithos where yt='$usr'");
if (mysqli_num_rows($sql) > 0)
{
  $yt=1;
  $row=mysqli_fetch_array($sql);
  $tmima= $row['Class_id'];

echo '<p style="color: blue; text-align: left; font-weight: bold;"> ΦΩΤΟΓΡΑΦΙΕΣ ΤΜΗΜΑΤΟΣ  </p>';
echo "ΤΜΗΜΑ:".$tmima."<br>";
	
$sqlt = $dbcon->prepare("SELECT a.mitroo,a.onoma,a.eponimo,a.pateras,p.filen,p.chkim 
		FROM allstudentinfo as a, img as p WHERE a.tmima=? and a.mitroo=p.mitroo order by a.eponimo,a.onoma");
$sqlt->execute([$tmima]);
$ct=$sqlt->rowCount();
$path = 'uploads/'; // upload directory
echo "<table style='width:900px' class='myTable' >
<tr style='border:1px solid black;font-size:9px' bgcolor='#d6ff73'   >
<th>Α/Α</th>
<th>ΜΗΤΡΩΟ </th>
<th>ΜΑΘΗΤΗΣ/ΤΡΙΑ </th>
<th>ΠΑΤΕΡΑΣ</th>
<th>ΦΩΤΟΓΡΑΦΙΑ</th>
<th>ΕΛΕΓΧΟΣ</th>
</tr>";
	
?>
<FORM method ="post" action="photosub.php">
<?php
$i=1;
while($rowt=$sqlt->fetch(PDO::FETCH_ASSOC))
{

	echo "<tr>";
	$mitroo[$i]=$rowt['mitroo'];
	echo "<td>" .$i. "</td>";
	echo "<td>" .$mitroo[$i]. "</td>";
	echo "<td>" .$rowt['eponimo']." ".$rowt['onoma']."</td>";
	echo "<td>" .$rowt['pateras']. "</td>";
	$ph=$path.$rowt['filen'];
	$kat=$rowt['chkim'];
	$xx='sms'.$i;
	?>
	<td>
	<img src=<?php echo $ph; ?> /> 
	</td>
	<td>
	ΑΠΟΔΟΧΗ ΦΩΤΟΓΡ: <br>
    <input type="radio" name=<?php echo "s".$i;?>  onclick="disx()" value="<?php echo $mitroo[$i]."/"."0";?>"  <?php if ($kat=="0") echo "checked";?>   >ΕΚΚΡΕΜΕΙ
	<br>
	<input type="radio" name=<?php echo "s".$i;?>  onclick="disx()" value="<?php echo $mitroo[$i]."/"."1";?>" <?php if ($kat=="1") echo "checked";?>   >ΑΠΟΔΕΧΤΗ
	<br>
	<input type="radio" name=<?php echo "s".$i;?>  onclick="enx(${i})" value="<?php echo $mitroo[$i]."/"."9";?>" <?php if ($kat=="9") echo "checked";?>   >ΑΠΟΡΡΙΠΤΕΤΑΙ
	<br><br>
	<input type="button" id=<?php echo "sms".$i;?> class="bt2" disabled value="ΑΠΟΣΤΟΛΗ SMS" onclick="window.open('smsphoto.php?alp=<?php echo $mitroo[$i];?>','','width=600,height=600')" />
	</td>
	<?php
	echo "</tr>"; 
	$i++;
}
echo "</table>";
echo "<br>";
?>
<input type="submit" name="submitph" value="ΕΝΗΜΕΡΩΣΗ ΕΛΕΓΧΟΥ ΦΩΤΟΓΡΑΦΙΩΝ" >
</FORM>
<?php
}

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

</body>
</html>