forked from vergnet/site-accueil-insa
Compare commits
4 commits
34b2dbbe03
...
8cc8d20fa3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8cc8d20fa3 | ||
|
|
2f3ca4cbde | ||
|
|
b17011e74b | ||
|
|
d002bbae93 |
6 changed files with 281 additions and 6 deletions
|
|
@ -5,7 +5,7 @@ if($user['perm'] < 2) {
|
|||
header('Location: deco.php');
|
||||
}
|
||||
|
||||
if(isset($_GET['del']) AND !empty(['del']))
|
||||
if(isset($_GET['del']) AND !empty($_GET['del']))
|
||||
{
|
||||
if($user['perm'] >= 2) {
|
||||
$del = (int) htmlspecialchars($_GET['del']);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,54 @@ if($user['perm'] < 1) {
|
|||
header('Location: deco.php');
|
||||
}
|
||||
|
||||
$req = $db->query('SELECT * FROM planning_insa');
|
||||
|
||||
if(isset($_GET['del']) AND !empty($_GET['del']))
|
||||
{
|
||||
if($user['perm'] >= 1) {
|
||||
$del = (int) htmlspecialchars($_GET['del']);
|
||||
|
||||
$req = $db->prepare('DELETE FROM planning_insa WHERE id =?');
|
||||
$req->execute(array($del));
|
||||
header('Location: planning.php');
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_GET['select']) AND !empty($_GET['select']))
|
||||
{
|
||||
$select = (int) htmlspecialchars($_GET['select']);
|
||||
$req = $db->prepare('SELECT * FROM planning_insa WHERE num_planning = ?');
|
||||
$req->execute(array($select));
|
||||
}
|
||||
|
||||
$req2 = $db->query('SELECT num_planning FROM planning_insa');
|
||||
$tab = [];
|
||||
$length = 0;
|
||||
while($h = $req2->fetch()) {
|
||||
array_push($tab, $h['num_planning']);
|
||||
$length++;
|
||||
}
|
||||
$tab = array_unique($tab); //supprimer les doublons
|
||||
|
||||
if(isset($_POST['send'])) {
|
||||
if($user['perm'] >= 1) {
|
||||
if(isset($_POST['day']) AND !empty($_POST['day']) AND isset($_POST['title']) AND !empty($_POST['title']) AND isset($_POST['description']) AND !empty($_POST['description']) AND isset($_POST['color']) AND !empty($_POST['color']) AND isset($_POST['order_start']) AND !empty($_POST['order_start']) AND isset($_POST['length']) AND !empty($_POST['length']) AND isset($_POST['num_planning']) AND !empty($_POST['num_planning'])) {
|
||||
$day = (int) htmlspecialchars($_POST['day']);
|
||||
$title = htmlspecialchars($_POST['title']);
|
||||
$desc = htmlspecialchars($_POST['description']);
|
||||
$color = htmlspecialchars($_POST['color']);
|
||||
$order_start = (int) htmlspecialchars($_POST['order_start']);
|
||||
$len = (int) htmlspecialchars($_POST['length']);
|
||||
$num_planning = (int) htmlspecialchars($_POST['num_planning']);
|
||||
|
||||
$req = $db->prepare("INSERT INTO planning_insa(day, title, description, color, order_start, length, num_planning) VALUES(?, ?, ?, ?, ?, ?, ?)");
|
||||
$req->execute(array($day, $title, $desc, $color, $order_start, $len, $num_planning));
|
||||
header('refresh:0');
|
||||
} else {
|
||||
$error = "Tout les champs doivent être complétés";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
|
@ -15,6 +63,95 @@ if($user['perm'] < 1) {
|
|||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<form method="POST">
|
||||
<select name="day" class="input_inline">
|
||||
<option value="1">Lundi</option>
|
||||
<option value="2">Mardi</option>
|
||||
<option value="3">Mercredi</option>
|
||||
<option value="4">Jeudi</option>
|
||||
<option value="5">Vendredi</option>
|
||||
<option value="6">Samedi</option>
|
||||
<option value="7">Dimanche</option>
|
||||
</select>
|
||||
<input type="text" class="input_inline" name="title" placeholder="titre">
|
||||
<input type="text" class="input_inline" name="description" placeholder="description">
|
||||
<input type="color" name="color">
|
||||
<input type="number" class="input_inline" name="order_start" placeholder="Ordre d'apparition">
|
||||
<input type="number" class="input_inline" name="length" placeholder="Taille (%)">
|
||||
<select name="num_planning" class="input_inline">
|
||||
<option value="1">Planning 1</option>
|
||||
<option value="2">Planning 2</option>
|
||||
<option value="3">Planning 3</option>
|
||||
<option value="4">Planning 4</option>
|
||||
<option value="5">Planning 5</option>
|
||||
</select>
|
||||
<input type="submit" value="Ajouter" name="send" class="submit_inline">
|
||||
</form><br><br>
|
||||
<a href="planning.php"><input type="submit" value="All" class="submit_inline"></a>
|
||||
<?php
|
||||
if(isset($error)) {
|
||||
echo $error;
|
||||
}
|
||||
|
||||
for($i=0; $i<$length; $i++) {
|
||||
if(isset($tab[$i])) {
|
||||
echo '<a href="?select='.$tab[$i].'"><input type="submit" value="Planning '.$tab[$i].'" class="submit_inline"></a>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<br><br>
|
||||
<table class="acces">
|
||||
<tr>
|
||||
<th width="5%">ID (db)</th>
|
||||
<th width="10%">Jour</th>
|
||||
<th width="20%">Titre</th>
|
||||
<th width="30%">Description</th>
|
||||
<th width="5%">Couleur</th>
|
||||
<th width="5%">Ordre d'apparition</th>
|
||||
<th width="5%">taille (%)</th>
|
||||
<th width="10%">Planning n°</th>
|
||||
<th width="10%">Action</th>
|
||||
</tr>
|
||||
<?php
|
||||
while($r = $req->fetch()) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?= $r['id'] ?></td>
|
||||
<td><?php
|
||||
switch ($r['day']) {
|
||||
case 1:
|
||||
echo "Lundi";
|
||||
break;
|
||||
case 2:
|
||||
echo "Mardi";
|
||||
break;
|
||||
case 3:
|
||||
echo "Mercredi";
|
||||
break;
|
||||
case 4:
|
||||
echo "Jeudi";
|
||||
break;
|
||||
case 5:
|
||||
echo "Vendredi";
|
||||
break;
|
||||
case 6:
|
||||
echo "Samedi";
|
||||
break;
|
||||
case 7:
|
||||
echo "Dimanche";
|
||||
break;
|
||||
}
|
||||
?></td>
|
||||
<td><?= $r['title'] ?></td>
|
||||
<td><?= $r['description'] ?></td>
|
||||
<td bgcolor="<?= $r['color'] ?>"></td>
|
||||
<td><?= $r['order_start'] ?></td>
|
||||
<td><?= $r['length'] ?>%</td>
|
||||
<td><?= $r['num_planning'] ?></td>
|
||||
<td><a href="?del=<?= $r['id'] ?>" class="cross">X</a></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -4,7 +4,7 @@ include "script.php";
|
|||
$req = $db->query('SELECT id, texte, points, team, id_staff FROM scores');
|
||||
|
||||
|
||||
if(isset($_GET['del']) AND !empty(['del']))
|
||||
if(isset($_GET['del']) AND !empty($_GET['del']))
|
||||
{
|
||||
|
||||
$del = (int) htmlspecialchars($_GET['del']);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,60 @@
|
|||
main {
|
||||
text-align: center;
|
||||
border: 0;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table {
|
||||
margin: 50px;
|
||||
border-collapse: collapse;
|
||||
height: 80vh;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
table th, td {
|
||||
border: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.tr-th {
|
||||
background-color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
||||
.tr-th th {
|
||||
padding: 20px;
|
||||
color: black;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
.tr-td {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
div.hours {
|
||||
background-color: rgba(255, 255, 255, 0.7);
|
||||
border-top: 2px solid black;
|
||||
color: black;
|
||||
border-right:2px solid black;
|
||||
}
|
||||
|
||||
div.content {
|
||||
display : flex;
|
||||
align-items : center;
|
||||
justify-content : center;
|
||||
border: 2px solid black;
|
||||
}
|
||||
|
||||
section {
|
||||
display: block;
|
||||
background-color: rgba(255,255,255,0.5);
|
||||
width: 80%;
|
||||
max-width: 800px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
padding: 50px;
|
||||
font-size: 1.2rem;
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
|
@ -2,9 +2,9 @@
|
|||
ob_start(); // Start reading html
|
||||
?>
|
||||
<main>
|
||||
<img src="assets/img/error.JPG" style="margin-top: 50px;width:50vw;">
|
||||
<img src="assets/img/error.jpg" style="margin-top: 50px;width:50vw;">
|
||||
</main>
|
||||
<?php
|
||||
$infopage = ["", "Erreur 404", ob_get_clean(), "", "erreur"]; //relativepath, pagetitle, pagecontent, pagescript, pagename | cf structure/template.php ligne 2 à 6
|
||||
$infopage = ["", "Erreur", ob_get_clean(), "", "erreur"]; //relativepath, pagetitle, pagecontent, pagescript, pagename | cf structure/template.php ligne 2 à 6
|
||||
include("structure/template.php");
|
||||
?>
|
||||
82
planning.php
82
planning.php
|
|
@ -1,8 +1,86 @@
|
|||
<?php
|
||||
ob_start(); // Start reading html
|
||||
header('Location: construction.php');
|
||||
?>
|
||||
|
||||
include "script/db.php";
|
||||
|
||||
if(isset($_GET['planning']) AND !empty(['planning']))
|
||||
{
|
||||
$planning = (int) htmlspecialchars($_GET['planning']);
|
||||
} else {
|
||||
header('Location: construction.php');
|
||||
}
|
||||
?>
|
||||
<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>
|
||||
|
||||
<?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
|
||||
for($i=8;$i<=22;$i++) {
|
||||
?>
|
||||
<div style="height: <?= 100/15 ?>%;" class="hours">
|
||||
<?= $i ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
for($day=1;$day<=7;$day++) {
|
||||
echo "<td>";
|
||||
$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()) {
|
||||
?>
|
||||
<div style="background-color: <?= $r1['color'] ?>; height: <?= $r1['length'] ?>%; <?php if($day == 7) { echo "border-right: 4px solid black;"; } ?>" class="content">
|
||||
<span><?= $r1['title'] ?></span>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
$cnt = $req1->rowCount(); //pour les ptit farceurs
|
||||
if($cnt == 0) {
|
||||
header('Location: error.php');
|
||||
}
|
||||
|
||||
echo "</td>";
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<section>
|
||||
Clique sur le planning que tu souhaites visionner : <br>
|
||||
<font color="red">On les a pas encore en fait</font>
|
||||
</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");
|
||||
|
|
|
|||
Loading…
Reference in a new issue