<?php
session_start();$menu = $_SESSION['menu'];
include $menu;
?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Βαθμολόγιο Καθηγητή</title>

</script>
<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, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=800, height=800, top='+top+', left='+left);
}

function submitform()
{
    document.forms["carservice"].submit();
}

function pop_up(url){
window.open(url,'win2','status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=800,height=800,directories=no,location=no') 
}

</script>

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

</head>

<body>

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

echo "<br>"."ΗΜΕΡΟΜΗΝΙΑ:".$dt."<br>";
echo "<br>"." ΕΚΠΑΙΔΕΥΤΙΚΟΣ:".$name."<br>";
echo "<br>"."<br>";
echo "ΕΠΙΛΟΓΗ ΤΜΗΜΑΤΟΣ / ΣΥΝΔΙΔΑΣΚΑΛΙΑΣ"; echo "<br>"."<br>";

if ($access==4){
	echo " Ενδεικτικό τμήμα για εισηγήσεις - Ο Διευθυντής θα βλέπει μόνο το συγκεντροτικό του τμήματος";
	$mathima=array("Α09");
}
else
{
   $day=array("Mon","Tue","Wed","Thu","Fri");
   $result = mysqli_query($con,"SELECT * FROM timetable WHERE Teacher='$name'  " ); 
   $row = mysqli_fetch_array($result);
   $c = mysqli_num_rows($result);
   $id1=$row['id']+1;
   $result1 = mysqli_query($con,"SELECT * FROM timetable WHERE id='$id1'  " ); 
   $row1 = mysqli_fetch_array($result1);
   $i=0;
   $ind=1;
   while($i <= 4)
     {
	  $per=1;
      
	  while ($per <= 7) {
	  $dayf=$day[$i].$per;
	  $lesson= $row["$dayf"];
	  if (!empty($lesson)){
	      $lesson=ltrim(rtrim($lesson));
	      $subj=$row1["$dayf"];

		$mathima[$ind]=$lesson;
		$ar=explode('/',$subj);
		$subject[$ind]= $ar[1];
		$mathsubj[$ind]=$mathima[$ind]."/".$subject[$ind];
	    $ind++;
	}
		$per++;

}
    
	  $i++;
	 }

 $mathsubj=array_unique($mathsubj);

}
 
echo "<table class='myTable' >
<tr style='border:1px solid black' >
</tr>";
echo "<tr > 
<th>Α/Α</th>
<th>ΤΜΗΜΑ / ΣΥΝΔΙΔΑΣΚΑΛΙA</th>
</tr>";
$i=1;
$k=0;
foreach ($mathsubj as $m){
  echo "<td>" . $i. "</td>";
  echo "<td>" . "<a href=\"bathmologio1.php?math=".$m."\">".$m. "</a>". "</td>";	
  echo "</tr>";
  $i++;
}
echo "</table>"; 
 
?>
<br />
<a  href=<?php echo $menu;?> style="color:blue "  >  Επιστροφή στο Μενού  </a>

</body>
</html>