<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Circulaire </title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="w3.css">
</head>

<body>
<?php
include("_serveur.php");
$query = "SELECT * FROM circulaire join cycles on circulaire.cycleID=cycles.id ORDER BY date DESC";
echo '<table width="90%" class="w3-table w3-striped w3-bordered" align="center">';
echo "<tr> <td coplspan='4'><p align='center'><b> Les Circulaires</b></p></td></tr>"; 
   if(!(mysqli_query($link, $query))){
    echo "ERROR: Could not able to execute $query. " . mysqli_error($link);
}
$result=mysqli_query($link, $query);
echo "<tr> <td>Titre</td><td>Date</td><td>Profs.</td><td>Cycle</td></tr>"; 

while ($data = mysqli_fetch_array($result)) {
         $date=$data['date'];
	   $title=$data['title'];
	   $teacheronly=$data['teacherOnly'];
	   $url=$data['url'];
	   $cycle=$data['name'];
    // Open the folder
    // Loop through the files
		   if($teacheronly==1)  {echo "<tr > <td>"; echo "<a href=\"$url\">$title</a><br /></td><td>$date</td><td>&#9989;</td><td>$cycle</td></tr>";}
		   else {echo "<tr > <td>"; echo "<a href=\"$url\">$title</a><br /></td><td>$date</td><td>X</td><td>$cycle</td></tr>";}
		   
	 }
	echo "<br/></tbody></table> ";    // Close
mysqli_close($link);
?>

</body>

</html>

