This commit is contained in:
Baptiste 2022-06-18 12:19:38 +02:00
parent 9787dca0d6
commit 333890c2ca

View file

@ -46,9 +46,16 @@ if(isset($_POST['send'])) {
$len = (float) (100/20)*htmlspecialchars($_POST['length']);
$num_planning = (int) htmlspecialchars($_POST['num_planning']);
if (isset($_POST['colorhex']) AND !empty($_POST['colorhex'])) {
$color = htmlspecialchars($_POST['colorhex']);
} else {
$color = $color.dechex($opacity);
}
if($opacity <= 100 AND $opacity >= 0) {
$req = $db->prepare("INSERT INTO planning_insa(day, title, description, color, order_start, length, num_planning) VALUES(?, ?, ?, ?, ?, ?, ?)");
$req->execute(array($day, $title, $desc, $color.dechex($opacity), $order_start, $len, $num_planning));
$req->execute(array($day, $title, $desc, $color, $order_start, $len, $num_planning));
header('refresh:0');
} else {
$error ="L'opacité doit être en %";
@ -82,6 +89,7 @@ if(isset($_POST['send'])) {
<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="text" name="colorhex" placeholder="couleur hexa (pas obligatoire)" class="input_inline">
<input type="float" class="input_inline" name="opacity" placeholder="Opacité (%)" value="100">
<input type="number" class="input_inline" name="order_start" placeholder="Ordre d'apparition">
<input type="number" step="0.01" class="input_inline" name="length" placeholder="Taille (en heure)">
@ -153,7 +161,7 @@ if(isset($_POST['send'])) {
?></td>
<td><?= $r['title'] ?></td>
<td><?= $r['description'] ?></td>
<td style="background-color: <?= $r['color'] ?>;"><?= $r['color'] ?><br><?= hex2rgba($r['color']) ?></td>
<td style="background-color: <?= $r['color'] ?>;"><?= $r['color'] ?></td>
<td><?= $r['order_start'] ?></td>
<td><?= $r['length'] ?>%</td>
<td><?= $r['num_planning'] ?></td>