2026-02-24 14:26:25 +00:00
|
|
|
<?php
|
|
|
|
|
include("./Assets/functions.php");
|
2026-02-25 07:52:22 +00:00
|
|
|
$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-04 13:26:06 +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">
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
/* Nettoyage des styles pour éviter les conflits Bootstrap sur le reste de la page */
|
|
|
|
|
body {
|
|
|
|
|
overflow-x: hidden; /* Sécurité anti-scroll horizontal */
|
|
|
|
|
margin: 0;
|
|
|
|
|
padding: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.custom-grid-container {
|
|
|
|
|
width: 100%;
|
|
|
|
|
padding: 0 15px; /* Évite que les images collent aux bords de l'écran */
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Clearfix pour contenir les éléments en float */
|
|
|
|
|
.custom-grid-container::after {
|
|
|
|
|
content: "";
|
|
|
|
|
display: table;
|
|
|
|
|
clear: both;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.custom-column {
|
|
|
|
|
float: left;
|
|
|
|
|
width: 25%;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
padding: 5px; /* Espacement entre les images */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.custom-column img {
|
|
|
|
|
width: 100%;
|
|
|
|
|
display: block;
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
h1 {
|
|
|
|
|
padding: 20px 15px;
|
|
|
|
|
margin: 0;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
<?php include('./Assets/navbar.php'); ?>
|
|
|
|
|
|
|
|
|
|
<h1><?= htmlspecialchars($titre) ?></h1>
|
|
|
|
|
|
|
|
|
|
<div class="custom-grid-container">
|
|
|
|
|
<?php
|
|
|
|
|
$nbColumns = 4;
|
2026-03-04 13:26:06 +00:00
|
|
|
$rowsPerColumn = count($images)/3;
|
2026-02-27 09:45:37 +00:00
|
|
|
$columns = [];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Vérifie si une image peut être placée à une position donnée
|
|
|
|
|
*/
|
|
|
|
|
function canPlace($columns, $col, $row, $imagePath)
|
|
|
|
|
{
|
|
|
|
|
// Vérifie le dessus
|
|
|
|
|
if ($row > 0 && isset($columns[$col][$row - 1]) && $columns[$col][$row - 1] === $imagePath) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($col > 0) {
|
|
|
|
|
// Gauche
|
|
|
|
|
if (isset($columns[$col - 1][$row]) && $columns[$col - 1][$row] === $imagePath) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// Diagonale Haut-Gauche
|
|
|
|
|
if ($row > 0 && isset($columns[$col - 1][$row - 1]) && $columns[$col - 1][$row - 1] === $imagePath) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// Diagonale Bas-Gauche
|
|
|
|
|
if (isset($columns[$col - 1][$row + 1]) && $columns[$col - 1][$row + 1] === $imagePath) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Construction de la structure de données
|
|
|
|
|
for ($col = 0; $col < $nbColumns; $col++) {
|
|
|
|
|
$columns[$col] = [];
|
|
|
|
|
|
|
|
|
|
for ($row = 0; $row < $rowsPerColumn; $row++) {
|
|
|
|
|
shuffle($images);
|
|
|
|
|
$placed = false;
|
|
|
|
|
|
|
|
|
|
foreach ($images as $img) {
|
2026-03-04 13:26:06 +00:00
|
|
|
if (canPlace($columns, $col, $row, $prefixe . $img['chemin'])) {
|
2026-02-27 09:45:37 +00:00
|
|
|
$columns[$col][$row] = $img['chemin'];
|
|
|
|
|
$placed = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!$placed && !empty($images)) {
|
2026-03-04 13:26:06 +00:00
|
|
|
$columns[$col][$row] = $prefixe.$images[0]['chemin'];
|
2026-02-27 09:45:37 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Affichage manuel sans classes Bootstrap conflictuelles
|
|
|
|
|
for ($col = 0; $col < $nbColumns; $col++): ?>
|
|
|
|
|
<div class="custom-column">
|
|
|
|
|
<?php foreach ($columns[$col] as $imgPath): ?>
|
2026-03-04 13:26:06 +00:00
|
|
|
<img src="<?= $prefixe.$imgPath ?>" alt="Image évènement">
|
2026-02-27 09:45:37 +00:00
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</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>
|