<?php
include "scrinit.php";
include ("logo.php");
?><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Kathisteriseis</title>
</head>
</script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">

function require()
{
var empt = document.forms["selectpoini"]["pini"].value;

if ($('#tims option:selected').length == 0)
   {
      alert("Δεν έχετε επιλέξει καθυστερήσεις!");
     return false;
   }
else
if (empt == "")
{
alert("Το πεδίο της ποινής δεν μπορεί να είναι κενό!");
return false;
}
else
{
	document.forms["selectpoini"].submit();
}

}

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);
}
</script>

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


body {
    font: 0.8em/1.1em Verdana, Geneva, Arial, Helvetica, sans-serif;
    background-color:#FFF; }

#wrap {
   font-size: 1em/1.1em;
   width: 900px;
   padding: 15px;
   margin: 0 auto; 
   background-color: #fff;
   position: relative; }

/* These styles create the dropdown menus. */
#navbar {
   margin: 0;
   padding: 0;
   height: 1.2em; }
#navbar li {
   list-style: none;
   float: left; }
#navbar li a {
   display: block;
   padding: 3px 8px;
   background-color: #5e8ce9;
   color: #fff;
   text-decoration: none; }


#header h1 img { 
border: none; 
}  
 
</style>

<body>
<?php

require("dbconnect.php");

$dt=$_SESSION['dt'];
$name = $_SESSION['n'];
$am=$_GET['am'];
$_SESSION['am']=$am;

$sql = mysqli_query($con,"SELECT eponimo,onoma,tmima FROM allstudentinfo  WHERE mitroo='$am' " );
$row=mysqli_fetch_array($sql);

$stname=$row['eponimo']."  ".$row['onoma'];
$_SESSION['tm1']=$row['tmima'];

$sql = mysqli_query($con,"SELECT * FROM apousies  WHERE   kath > 0 AND mitroo='$am' ORDER BY dateout,period" );
if (mysqli_num_rows($sql)==0){
	echo " Ο μαθητής δεν έχει ατιμώρητες καθυστερήσεις";}
else
{
echo "ΕΠΙΒΟΛΗ ΠΟΙΝΗΣ ΓΙΑ ΜΑΘΗΤΗ  :"."<b>".$stname."</b>";
echo "<br>";
$_SESSION['stname']=$stname;
/*$kath = array_fill(1, 30, 0);
$per = array_fill(1, 30, 0);
$datet = array_fill(1, 30, 0);*/
$kath=$per=$datet=array();

?>	
<p style="color: red"> Να επιλέξετε τις καθυστερήσεις που θα τιμωρηθούν (CTRL / SHIFT - για πολλαπλή επιλογή) </p>
<p> A/A  Hμερομ.  Περ/δος Καθυστερηση</p>
<form method="POST" name="selectpoini" action="timoria2.php" >
<?php

echo "<select name='tim[]'  id='tims' size=20 multiple>";
$i=1;
while ($row = mysqli_fetch_array($sql)) 
{
	 $kath[$i]=$row['kath'];
	 $per[$i]=$row['period'];
	 $datet[$i]=$row['dateout'];
	 $opt=$i."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp".$datet[$i]."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp".$per[$i]."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp".$kath[$i]."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp";
     if ($row['timoriacode']>0) {
	    echo "<option value='$i'   disabled>$opt</option>";	 
	 }
	 else
	 {
	 echo "<option value='$i' style='color:Red'>$opt</option>";}
	
	$i++;
}    
echo "</select>";
echo "<input type='text' name='kath[]' value='$kath' hidden >";
echo "<input type='text' name='per[]' value='$per' hidden >";

$_SESSION['datet']=$datet;
$_SESSION['kath']=$kath;
$_SESSION['per']=$per;

 ?>	
<p>
ΠΟΙΝΗ ΣΕ ΠΕΡΙΟΔΟΥΣ:<input type='text'  name= 'pini' size=9 />

<Input type = 'Radio' name ='etimo' value= '0'  >ΜΕ ΑΝΑΣΤΟΛΗ</td>
<Input type = 'Radio' name ='etimo' value= '1'  >ΚΑΤ' ΟΙΚΟΝ </td>
<Input type = 'Radio' name ='etimo' value= '2'  >ΑΛΛΗ </td>
</p>


<input type="button" name="exit2" value="Επιβεβαίωση Ποινής" onClick="require()" />
</form>	
<?php


}
?>

		
</body>
</html>