123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289 |
- <?php
- ob_start(); // Start reading html
-
- include "script/db.php";
-
- if(isset($_GET['planning']) AND !empty(['planning']))
- {
- $planning = (int) htmlspecialchars($_GET['planning']);
- }
-
- ?>
- <main>
-
- <div class="box-jaune">
- <span class="corners corners-top"></span>
- <span class="corners corners-bottom"></span>
-
- <div class="title">
- Planning
- <?php
- if(isset($planning)) {
- switch($planning) {
- case 1:
- echo "général";
- break;
- case 2:
- echo "Pkpeach";
- break;
- case 3:
- echo "Boomario";
- break;
-
- }
- }
- ?>
- </div>
-
- <span class="circles circles-top"></span>
- <span class="circles circles-bottom"></span>
- </div>
- <!--
- //////////////////////////////////////////////////////////////
- /////// Le lien de cette page est modifiable ^^ ////////////
- //////////////////////////////////////////////////////////////
- -->
-
- <?php if(isset($planning)) { ?>
-
- <div id="planning-container" class="planning-container" selected="0">
-
- <div id="days" class="column days">
- <div class="day_title">Jour</div>
-
- <div class="day day0">L</div>
- <div class="day day1">Ma</div>
- <div class="day day2">Me</div>
- <div class="day day3">J</div>
- <div class="day day4">V</div>
- <div class="day day5">S</div>
- <div class="day day6">D</div>
-
- <script defer>
-
- const daysPLA = document.getElementsByClassName("day");
- const containerPLA = document.getElementById("planning-container");
-
-
-
- for (let i = 0; i < daysPLA.length; i++) {
- const day = daysPLA[i];
- day.addEventListener("click", (e) => {
- let number = day.classList.item(1).charAt(3)
- containerPLA.setAttribute("selected", number)
- });
- }
-
- </script>
- </div>
-
- <div class="column time">
-
- <div class="day_title">Heure</div>
- <div class="hour">07</div>
- <div class="hour">08</div>
- <div class="hour">09</div>
- <div class="hour">10</div>
-
- <div class="hour">11</div>
- <div class="hour">12</div>
- <div class="hour">13</div>
- <div class="hour">14</div>
- <div class="hour">15</div>
-
- <div class="hour">16</div>
- <div class="hour">17</div>
- <div class="hour">18</div>
- <div class="hour">19</div>
- <div class="hour">20</div>
-
- <div class="hour">21</div>
- <div class="hour">22</div>
- <div class="hour">23</div>
- <div class="hour">00</div>
- <div class="hour">01</div>
-
- </div>
-
- <div id="lundi" class="column lundi">
- <div class="day_title">L</div>
-
- <?php
- // For every planned activity on day 0
- $req1 = $db->prepare('SELECT title, description, color, length FROM planning_insa WHERE day = 1 AND num_planning = ? ORDER BY order_start ASC');
- $req1->execute(array($planning));
- while($r1 = $req1->fetch()) {
- ?>
- <div class="class" data-description="<?=$r1['description']?>" style="background-color: <?= $r1['color'] ?>; height: <?= $r1['length'] ?>vh;">
- <?= $r1['title'] ?>
- </div>
- <?php
- }
- ?>
-
- </div>
-
- <div id="mardi" class="column mardi">
- <div class="day_title">Ma</div>
-
- <?php
- // For every planned activity on day 0
- $req1 = $db->prepare('SELECT title, description, color, length FROM planning_insa WHERE day = 2 AND num_planning = ? ORDER BY order_start ASC');
- $req1->execute(array($planning));
- while($r1 = $req1->fetch()) {
- ?>
- <div class="class" data-description="<?=$r1['description']?>" style="background-color: <?= $r1['color'] ?>; height: <?= $r1['length'] ?>vh;">
- <?= $r1['title'] ?>
- </div>
- <?php
- }
- ?>
- </div>
-
- <div id="mercredi" class="column mercredi">
- <div class="day_title">Me</div>
-
- <?php
- // For every planned activity on day 0
- $req1 = $db->prepare('SELECT title, description, color, length FROM planning_insa WHERE day = 3 AND num_planning = ? ORDER BY order_start ASC');
- $req1->execute(array($planning));
- while($r1 = $req1->fetch()) {
- ?>
- <div class="class" data-description="<?=$r1['description']?>" style="background-color: <?= $r1['color'] ?>; height: <?= $r1['length'] ?>vh;">
- <?= $r1['title'] ?>
- </div>
- <?php
- }
- ?>
- </div>
-
- <div id="jeudi" class="column jeudi">
- <div class="day_title">J</div>
-
- <?php
- // For every planned activity on day 0
- $req1 = $db->prepare('SELECT title, description, color, length FROM planning_insa WHERE day = 4 AND num_planning = ? ORDER BY order_start ASC');
- $req1->execute(array($planning));
- while($r1 = $req1->fetch()) {
- ?>
- <div class="class" data-description="<?=$r1['description']?>" style="background-color: <?= $r1['color'] ?>; height: <?= $r1['length'] ?>vh;">
- <?= $r1['title'] ?>
- </div>
- <?php
- }
- ?>
- </div>
-
- <div id="vendredi" class="column vendredi">
- <div class="day_title">V</div>
-
- <?php
- // For every planned activity on day 0
- $req1 = $db->prepare('SELECT title, description, color, length FROM planning_insa WHERE day = 5 AND num_planning = ? ORDER BY order_start ASC');
- $req1->execute(array($planning));
- while($r1 = $req1->fetch()) {
- ?>
- <div class="class" data-description="<?=$r1['description']?>" style="background-color: <?= $r1['color'] ?>; height: <?= $r1['length'] ?>vh;">
- <?= $r1['title'] ?>
- </div>
- <?php
- }
- ?>
- </div>
-
- <div id="samedi" class="column samedi">
- <div class="day_title">S</div>
- <?php
- // For every planned activity on day 0
- $req1 = $db->prepare('SELECT title, description, color, length FROM planning_insa WHERE day = 6 AND num_planning = ? ORDER BY order_start ASC');
- $req1->execute(array($planning));
- while($r1 = $req1->fetch()) {
- ?>
- <div class="class" data-description="<?=$r1['description']?>" style="background-color: <?= $r1['color'] ?>; height: <?= $r1['length'] ?>vh;">
- <?= $r1['title'] ?>
- </div>
- <?php
- }
- ?>
- </div>
-
- <div id="dimanche" class="column dimanche">
- <div class="day_title">D</div>
-
- <?php
- // For every planned activity on day 0
- $req1 = $db->prepare('SELECT title, description, color, length FROM planning_insa WHERE day = 7 AND num_planning = ? ORDER BY order_start ASC');
- $req1->execute(array($planning));
- while($r1 = $req1->fetch()) {
- ?>
- <div class="class" data-description="<?=$r1['description']?>" style="background-color: <?= $r1['color'] ?>; height: <?= $r1['length'] ?>vh;">
- <?= $r1['title'] ?>
- </div>
- <?php
- }
- ?>
- </div>
-
- </div>
-
-
- <!-- téléchargement du planning-->
- <?php
- include_once("assets/scripts/php2ics.php");
- ?>
- <form method="POST">
- <input type="submit" name="download_planning" value="télécharger le planning" class="submit">
- </form>
-
-
-
-
- <!-- needed for showing custom alert -->
- <script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
-
- <script>
-
- const pln_cases = document.getElementsByClassName("class");
- for (let i = 0; i < pln_cases.length; i++) {
- let current = pln_cases[i];
-
- current.addEventListener("click", (e) => {
- Swal.fire({
- title: '<strong id="modal-title">' + current.innerHTML.trim() + '</strong>',
- html: current.dataset.description
- })
- })
- }
-
- </script>
-
- <?php
- } else {
-
- if(isset($_POST['p1'])) {
- header('Location: planning.php?planning=1');
- }
- if(isset($_POST['p2'])) {
- header('Location: planning.php?planning=2');
- }
- if(isset($_POST['p3'])) {
- header('Location: planning.php?planning=3');
- }
- ?>
-
- <section>
- <form method="POST">
- <input type="submit" name="p2" value="Planning Pkpeach" class="submit">
- <input type="submit" name="p3" value="Planning Boomario" class="submit">
- <input type="submit" name="p1" value="Planning général" class="submit">
- </form>
- </section>
-
- <?php } ?>
-
- </main>
-
- <?php
- $infopage = ["", "Planning", ob_get_clean(), "", "planning"]; //relativepath, pagetitle, pagecontent, pagescript, pagename | cf structure/template.php ligne 2 à 6
- include("structure/template.php");
- ?>
|