<?php
include "scrinit.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<style type="text/css">
table.o { border-collapse:collapse;border:solid 2px #00F ;}
table.o td {border:solid 2px #00F; padding:2px ; word-wrap:break-word;} 
table.o th { border:2px solid black; background-color: #CCF;padding:2px;font-size:10pt;word-wrap:break-word; }
<p style="font-size:10px;"></p>
</style>
<body>

<?php
require "dbconnect.php";
$dt=date('Y-m-d');
   
 
//..............................
$ep1=$ep2=$ep3=$ep4=array();
$sql=mysqli_query($con,"SELECT * FROM epitropes order by code" );
$c=mysqli_num_rows($sql);
$pere=array();

while ($row = mysqli_fetch_array($sql))
	{
		
		$cc[$row['code']]=$row['code'];
		$pere[$row['code']]=$row['perigrafi'];
		
	}
echo "<table class='o' >
<tr>
<th>ΚΩΔ.</th>
<th>ΕΠΙΤΡΟΠΗ</th>
<th>ΠΡΟΤΙΜΗΣΗ 1</th>
<th>ΠΡΟΤΙΜΗΣΗ 2</th>
<th>ΠΡΟΤΙΜΗΣΗ 3</th>
<th>ΠΡΟΤΙΜΗΣΗ 4</th>
</tr>";
$coun=array();
foreach ($cc as $cd)
{	
	echo "<tr>";
	echo "<td>".$cd."</td>";
	echo "<td>".$pere[$cd]."</td>";
	$sql = mysqli_query($con,"SELECT t.Name FROM teachers as t,dilosiep as d WHERE d.teach=t.PMP and code1='$cd' " );
	echo "<td>";
	while ($row = mysqli_fetch_array($sql))
	{
		echo $row['Name'].",";
		$coun[$cd]++;
	}
	echo "</td>";
	$sql = mysqli_query($con,"SELECT t.Name FROM teachers as t,dilosiep as d WHERE d.teach=t.PMP and code2='$cd' " );
	echo "<td>";
	while ($row = mysqli_fetch_array($sql))
	{
		echo $row['Name'].",";
		$coun[$cd]++;
	}
	echo "</td>";
	$sql = mysqli_query($con,"SELECT t.Name FROM teachers as t,dilosiep as d WHERE d.teach=t.PMP and code3='$cd' " );
	echo "<td>";
	while ($row = mysqli_fetch_array($sql))
	{
		echo $row['Name'].",";
		$coun[$cd]++;
	}
	echo "</td>";
	$sql = mysqli_query($con,"SELECT t.Name FROM teachers as t,dilosiep as d WHERE d.teach=t.PMP and code4='$cd' " );
	echo "<td>";
	while ($row = mysqli_fetch_array($sql))
	{
		echo $row['Name'].",";
		$coun[$cd]++;
	}
	echo "</td>";
	echo "</tr>";
}
echo "</table>";
print_r($coun);
?> <h3> ΔΕΝ ΔΗΛΩΣΑΝ ΕΠΙΤΡΟΠΕΣ </h3>
<?php
$sql = mysqli_query($con,"SELECT a.Name,a.PMP FROM teachers AS a 
WHERE (NOT EXISTS (  SELECT b.teach   FROM dilosiep AS b   WHERE a.PMP=b.teach )) and a.access=1 and a.workhrs > 8" );
$i=1;
while ($row = mysqli_fetch_array($sql))
{
	echo "<br>".$i." ".$row['Name'];
	$i++;
}

/*
$xls_filename = 'export_'.date('Y-m-d').'.xls'; // Define Excel (.xls) file name

//create a file and send to browser for user to download
header("Content-Type: application/xls");
header("Content-Disposition: attachment; filename=$xls_filename");
header("Pragma: no-cache");
header("Expires: 0"); 
 
// Start of printing column names as names of MySQL fields
$header= "a/a". ","."mitroo". ","."tmima". ","."onoma". ","."omilos1".","."omilos2";
print "$header\n";
 
// Start while loop to get data
$i=1;
while ($row = mysqli_fetch_array($sql)) 
{
$id[$i]=$row['pmp'];
$tmima=$row['tmima'];
$omilos1=$row['code1'];
$omilos2=$row['code2'];
$name= $row['eponimo']." ".$row['onoma'];

$data = $i.",".$id[$i].",".$tmima.",".$name.",".$omilos1.",".$omilos2;
$data = trim( $data ) . "\n";
$data = str_replace( "\r" , "" , $data );
print "$data";
  $i++; 
}

//..............................
$sql = mysqli_query($con,"SELECT mitroo FROM allstudentinfo " ); 
$i=1;
while ($row = mysqli_fetch_array($sql)) 
{ 
$mitr[$i]=$row['mitroo'];
$i++; 
}

$celement = array_diff($mitr,$id);
$ll=count($celement);	 
echo $ll."<br>";
//print_r ($celement);
$i=1;
foreach($celement as $id) 
{
   $sql = mysqli_query($con,"SELECT tmima,eponimo,onoma FROM allstudentinfo WHERE mitroo='$id' " ); 
   $row = mysqli_fetch_array($sql);
   $name=$row['eponimo']." ".$row['onoma'];
   $tmima=$row['tmima'];
   if ($i <15 ){
   $data = $i.",".$id.",".$tmima.",".$name.","."15";}
   else{ 
    $data = $i.",".$id.",".$tmima.",".$name.","."16";}
   $data = trim( $data ) . "\n";
   $data = str_replace( "\r" , "" , $data );
    print "$data";
   $i++;
}
*/
?>
<br /><br />
<a  href=<?php echo $menu;?> style="color:blue "  > <button> Επιστροφή στο Μενού  </a>
</body>
</html>