site-accueil-insa/planning.php

89 lines
2.3 KiB
PHP
Raw Normal View History

2022-01-19 22:26:58 +01:00
<?php
2020-09-19 16:08:07 +02:00
ob_start(); // Start reading html
include "script/db.php";
if(isset($_GET['planning']) AND !empty(['planning']))
{
$planning = (int) htmlspecialchars($_GET['planning']);
2022-06-16 23:05:10 +02:00
} else {
2022-06-18 17:34:41 +02:00
header('Location: planning.php?planning=1');
}
2020-09-19 16:08:07 +02:00
?>
<main>
<div class="box-jaune">
<span class="corners corners-top"></span>
<span class="corners corners-bottom"></span>
<div class="title">Planning</div>
<span class="circles circles-top"></span>
<span class="circles circles-bottom"></span>
</div>
2020-09-19 16:08:07 +02:00
<?php
if(isset($planning)) {
?>
<table>
<tr class="tr-th">
<th width="12.5%">Heures</th>
<th width="12.5%">Lundi</th>
<th width="12.5%">Mardi</th>
<th width="12.5%">Mercredi</th>
<th width="12.5%">Jeudi</th>
<th width="12.5%">Vendredi</th>
<th width="12.5%">Samedi</th>
<th width="12.5%">Dimanche</th>
</tr>
<tr class="tr-td">
<td>
<?php
2022-06-18 11:41:53 +02:00
for($i=7;$i<=26;$i++) {
if($i > 23) {
?>
<div style="height: <?= 100/20 ?>%;" class="hours">
<?= $i-24 ?>
</div>
<?php
} else {
?>
2022-06-18 11:41:53 +02:00
<div style="height: <?= 100/20 ?>%;" class="hours">
<?= $i ?>
</div>
<?php
2022-06-18 11:41:53 +02:00
}
}
?>
</td>
<?php
for($day=1;$day<=7;$day++) {
2022-06-18 14:52:54 +02:00
echo "<td style='border-bottom: 2px solid black;'>";
$req1 = $db->prepare('SELECT title, description, color, length FROM planning_insa WHERE day = ? AND num_planning = ? ORDER BY order_start ASC');
$req1->execute(array($day, $planning));
while($r1 = $req1->fetch()) {
?>
2022-06-18 14:25:41 +02:00
<div style="background-color: <?= $r1['color'] ?>; height: <?= $r1['length'] ?>%; border: 0; color: white; border-right: 2px solid black; border-top: 2px solid black; ?>" class="content">
<span><?= $r1['title'] ?></span>
</div>
<?php
}
2022-06-16 23:05:10 +02:00
echo "</td>";
}
?>
</tr>
</table>
<?php
2022-06-16 23:05:10 +02:00
} else {
?>
2022-06-16 23:05:10 +02:00
<section>
Clique sur le planning que tu souhaites visionner : <br>
<font color="red">On les a pas encore en fait</font>
</section>
<?php } ?>
</main>
2020-09-19 16:08:07 +02:00
<?php
2022-01-19 22:26:58 +01:00
$infopage = ["", "Planning", ob_get_clean(), "", "planning"]; //relativepath, pagetitle, pagecontent, pagescript, pagename | cf structure/template.php ligne 2 à 6
include("structure/template.php");
?>