intranet-apei/event.php

63 lines
2.2 KiB
PHP
Raw Normal View History

2026-02-24 14:26:25 +00:00
<?php
include("./Assets/functions.php");
$config = json_decode(file_get_contents("./Assets/config.json"), true);
$bdd = connectBDD("localhost", $config["BDD_USER"], $config["BDD_PASSWD"], $config["BDD_NAME"]);
2026-02-24 14:26:25 +00:00
$page = 'Bonnes pratiques';
/* Gestion de la connexion */
session_start();
2026-02-27 09:45:37 +00:00
if (!isset($_SESSION['connected']) || $_SESSION['connected'] == false) {
2026-02-27 13:56:12 +00:00
header('location: login.php?redirect_to=photos.php');
2026-02-27 09:45:37 +00:00
exit;
2026-02-24 14:26:25 +00:00
}
/* Récupération de l'évènement */
$titre = getEventName($bdd, $_GET['event']);
2026-02-24 15:43:05 +00:00
$images = getEventImages($bdd, $_GET['event']);
$couvertureImg = getEventBigImage($bdd, $_GET['event']);
2026-03-10 09:37:35 +00:00
$prefixe = $config["LOCAL_IMG_PREFIXE"] . "gallerie/";
2026-02-24 14:26:25 +00:00
?>
<!doctype html>
<html lang="fr">
2026-02-27 09:45:37 +00:00
<head>
2026-02-24 14:26:25 +00:00
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Intranet de l'APEI</title>
2026-02-27 09:45:37 +00:00
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
2026-02-24 14:26:25 +00:00
<link rel="shortcut icon" href="./Assets/Icones/APEIMBGE.jpg" type="image/x-icon">
2026-02-27 09:45:37 +00:00
<link rel="stylesheet" href="./styles-scripts/event.css">
</head>
<body>
<?php include('./Assets/navbar.php'); ?>
<h1><?= htmlspecialchars($titre) ?></h1>
<div class="custom-grid-container">
<?php
$nbColumns = 4;
2026-03-10 09:37:35 +00:00
$offset = 3;
$totalImages = count($images);
2026-02-27 09:45:37 +00:00
2026-03-10 09:37:35 +00:00
for ($col = 0; $col < $nbColumns; $col++):
$startIndex = ($col * $offset) % $totalImages;
?>
2026-02-27 09:45:37 +00:00
<div class="custom-column">
2026-03-10 09:37:35 +00:00
<?php
for ($i = 0; $i < $totalImages; $i++):
$index = ($startIndex + $i) % $totalImages;
$imgPath = $images[$index]['chemin'];
?>
<img src="<?= $prefixe . $imgPath ?>" alt="Image évènement">
<?php endfor; ?>
2026-02-27 09:45:37 +00:00
</div>
<?php endfor; ?>
2026-02-24 15:43:05 +00:00
</div>
2026-02-27 09:45:37 +00:00
<button type="button" class="btn btn-primary" style="position: fixed; bottom: 20px; right: 20px;" onclick="window.location.href='diapo.php?event=<?= $_GET['event'] ?>'">Diaporama</button>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
2026-02-24 14:26:25 +00:00
</html>