<?php
include "scrinit.php";
include $menu;
?><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="style1.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
   function sxed(codx) 
	{
        window.open("sxediagramma.php?mathid="+codx, "_blank", "toolbar=yes, scrollbars=yes, resizable=yes, top=100, left=200, width=1400, height=800");
    } 
	
	function pop_up(url){
		window.open(url,'win2','toolbar=yes, scrollbars=yes, resizable=yes, top=100, left=200, width=600, height=800') 
	}
	
	function progr(codex) 
	{
        window.open("programatismos1.php?mathid="+codex, "_blank", "toolbar=yes, scrollbars=yes, resizable=yes, top=100, left=100, width=1000, height=800");
    }
	
	function marksd(codex) 
	{
        window.open("bathmodpm.php?mathid="+codex, "_blank", "toolbar=yes, scrollbars=yes, resizable=yes, top=100, left=100, width=1000, height=800");
    }
	function marksa(codex) 
	{
        window.open("bathmoda.php?mathid="+codex, "_blank", "toolbar=yes, scrollbars=yes, resizable=yes, top=100, left=100, width=1000, height=800");
    }
	function marksposo(codex) 
	{
        window.open("bathola3.php?mathid="+codex, "_blank", "toolbar=yes, scrollbars=yes, resizable=yes, top=100, left=100, width=1000, height=800");
    }
	
    	function markstel(codex) 
	{
        window.open("bathexet.php?mathid="+codex, "_blank", "toolbar=yes, scrollbars=yes, resizable=yes, top=100, left=100, width=1000, height=800");
    }
	function poiotiki(codex) 
	{
        window.open("poiotiki1.php?math="+codex, "_blank", "toolbar=yes, scrollbars=yes, resizable=yes, top=100, left=100, width=1000, height=800");
    }	
		function dildiag(codex) 
	{
        window.open("diagpermonth.php?mathid="+codex, "_blank", "toolbar=yes, scrollbars=yes, resizable=yes, top=100, left=100, width=1000, height=800");
    }
</script>

<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>

<?php
require "dbconnect.php"; 
$dt=$_SESSION['dt'];
$teacher=$_SESSION['usr'];
$usr=$_SESSION['usr'];
$access=$_SESSION['access'];
$tetramino=$_SESSION['tetramino'];
$math=$tm=array();
include "selectmath.php";
$i=1;
foreach ($mathsubj as $m)
{ 		  
	$math[$i]=$m;
	$t=mysqli_query($con,"select code from teams where pmp='$usr' and mathima='$m' ");
	$row=mysqli_fetch_array($t);
	$tm[$i]=$row['code'];
	$i++;
}

echo "<p class='p1'>". "ΤΑ ΜΑΘΗΜΑΤΑ ΜΟΥ". "</p>";

$ind=$ind-1;
echo "<table class='myTable3' id='tablex' >
	<tr> 
	<th>Α/Α</th>
	<th>ΤΜΗΜΑ/ΜΑΘΗΜΑ</th>
	<th>ΚΩΔΙΚΟΣ ΤΕΑΜΣ</th>
	<th>ΥΛΗ/ΔΕΙΧΤΕΣ</th>
	<th>ΔΗΛΩΣΗ ΔΙΑΓ.</th>
	<th>ΒΑΘΜΟΙ ΔΙΑΓ.</th>
	<th>ΒΑΘΜΟΙ ΑΠΡ. ΑΣΚ.</th>
	<th>ΠΡΟΦ+ΓΡΑΠΤ ΑΞΙΟΛ</th>
	<th>ΒΑΘΜΟΣ ΕΞΕΤ</th>
	<th>ΠΟΙΟΤΙΚΗ</th>
	<th>ΣΧΕΔΙΑΓΡΑΜΜΑ ΤΑΞΗΣ</th>
	</tr>";
$i=1;
$n=count($math);
for ($i=1;$i<=$n;$i++)
{
	echo "<tr>";
	echo "<td>". $i."</td>";
	$mt=$math[$i]."/".$usr;
	$arr=explode("/",$mt);
	
	//*************
	$ar=explode("/",$math[$i]);
	$mat1=explode("(",$ar[1]);
	$mat=$mat1[0];
	$q=mysqli_query($con,"select * from kodikoimathimatos where kodikos='$mat'");
	$row=mysqli_fetch_array($q);
	$ekset=$row['ekset'];
	
	
	//**************
	$arr = explode("/", $math[$i]);
	$tmima=$arr[0];
	$mathima=trim($arr[1]);
	$cl=mb_substr($tmima,0,1,'UTF-8');
	$result = mysqli_query($con,"SELECT DISTINCT s.mitroo,a.eponimo,a.onoma,a.tmima,a.omp 
	FROM syndidaskalies as s,allstudentinfo as a, syndcodes as sc 
	WHERE sc.synd = '$tmima' AND s.mitroo=a.mitroo AND sc.syndid=s.syndid ORDER BY a.eponimo,a.onoma");
	$crow1=mysqli_num_rows($result);

	if ($crow1 > 0)
	{
		$row=mysqli_fetch_array($result);
		$omp=trim($row['omp']);
	}
	else
	{	
	 $result = mysqli_query($con,"SELECT mitroo,eponimo,onoma,omp FROM allstudentinfo WHERE tmima='$tmima' ORDER BY eponimo,onoma  ");
	 $row = mysqli_fetch_array($result);
	 $omp=trim($row['omp']);
	} 
	
	$ar=explode("(",$mathima);
	$mathima=trim($ar[0]);
	//echo $cl.$tmima.$omp;
	include "pososta.php";
	//*************
	echo "<td>"."<a href=\"psyndtel.php?syndx=".$tmima."\" onclick=\"pop_up(this.href);return false\">"."<b>".$math[$i]."</b>". "</a>". "</td>";
	echo "<td><b>". $tm[$i]."</b></td>";
	echo '<td><center><img src="icons/progr.png" onclick="progr(\''.$mt.'\')" width="30" height="30" /></center></td>';
	echo '<td><center><img src="icons/diagonisma.png" onclick="dildiag(\''.$mt.'\')" width="30" height="30" /></center></td>';
	echo '<td><center><img src="icons/test.png" onclick="marksd(\''.$mt.'\')" width="30" height="30" /></center></td>';
	echo '<td><center><img src="icons/diagapro.png" onclick="marksa(\''.$mt.'\')" width="30" height="30" /></center></td>';
	echo '<td><center><img src="icons/bathmotetr.png" onclick="marksposo(\''.$mt.'\')" width="30" height="30" /></center></td>';
	//echo '<td><center><img src="icons/test.png" onclick="marks(\''.$mt.'\')" width="30" height="30" /></center></td>';
	//echo '<td><center><img src="icons/bathmotel.png" onclick="markstel(\''.$mt.'\')" width="30" height="30" /></center></td>';
	if ($ekset==1)
	{
	echo '<td><center><img src="icons/bathmotel.png" onclick="markstel(\''.$mt.'\')" width="30" height="30" /></center></td>';
	}
	else
	{
	echo '<td></td>';	
	}
	echo '<td><center><img src="icons/poiotiki.png" onclick="poiotiki(\''.$math[$i].'\')" width="30" height="30" /></center></td>';
	echo '<td><center><img src="icons/sxed.png" onclick="sxed(\''.$mt.'\')" width="30" height="30" /></center></td>';
}
echo "</table>";
echo "<p>";
echo "ΦΟΡΤΩΣΗ ΠΡΟΓΡΑΜΜΑΤΟΣ TEAMS"."</P>";
echo "<p>";
echo "<a target='_blank' href=\"https://teams.microsoft.com\"><img src=icons/tm.png width='40' height='40'></a>";
echo "</p>";
?>
</body>
</html>