Ajouts divers

This commit is contained in:
Erwann PHILIPPE 2026-03-10 10:37:35 +01:00
parent 29a14af020
commit c6289a1588
10 changed files with 250 additions and 134 deletions

View file

@ -390,3 +390,15 @@ function getSpecificRaccourcis($bdd, $id)
}
return $return;
}
function getGuides($bdd) {
$results = mysqli_query($bdd, "SELECT * FROM `guides`");
$return = [];
while ($row = mysqli_fetch_assoc($results)) {
$return[] = $row;
}
return $return;
}

110
event.php
View file

@ -15,7 +15,7 @@ if (!isset($_SESSION['connected']) || $_SESSION['connected'] == false) {
$titre = getEventName($bdd, $_GET['event']);
$images = getEventImages($bdd, $_GET['event']);
$couvertureImg = getEventBigImage($bdd, $_GET['event']);
$prefixe = $config["LOCAL_IMG_PREFIXE"]."gallerie/";
$prefixe = $config["LOCAL_IMG_PREFIXE"] . "gallerie/";
?>
<!doctype html>
@ -28,46 +28,6 @@ $prefixe = $config["LOCAL_IMG_PREFIXE"]."gallerie/";
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="shortcut icon" href="./Assets/Icones/APEIMBGE.jpg" type="image/x-icon">
<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>
@ -78,64 +38,20 @@ $prefixe = $config["LOCAL_IMG_PREFIXE"]."gallerie/";
<div class="custom-grid-container">
<?php
$nbColumns = 4;
$rowsPerColumn = count($images)/3;
$columns = [];
$offset = 3;
$totalImages = count($images);
/**
* 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) {
if (canPlace($columns, $col, $row, $prefixe . $img['chemin'])) {
$columns[$col][$row] = $img['chemin'];
$placed = true;
break;
}
}
if (!$placed && !empty($images)) {
$columns[$col][$row] = $prefixe.$images[0]['chemin'];
}
}
}
// Affichage manuel sans classes Bootstrap conflictuelles
for ($col = 0; $col < $nbColumns; $col++): ?>
for ($col = 0; $col < $nbColumns; $col++):
$startIndex = ($col * $offset) % $totalImages;
?>
<div class="custom-column">
<?php foreach ($columns[$col] as $imgPath): ?>
<img src="<?= $prefixe.$imgPath ?>" alt="Image évènement">
<?php endforeach; ?>
<?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; ?>
</div>
<?php endfor; ?>
</div>

View file

@ -3,6 +3,8 @@ 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"]);
$page = 'Guides';
$guides = getGuides($bdd);
?>
<!doctype html>
<html lang="fr">
@ -16,6 +18,15 @@ $page = 'Guides';
<body>
<?php include('./Assets/navbar.php');?>
<div class="grid-container">
<?php foreach ($guides as $guide): ?>
<div class="card" onclick="window.location.href='<?= $guide['lien'] ?>'">
<h4><?= $guide['nom'] ?></h4>
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/c1/Google_%22G%22_logo.svg/3840px-Google_%22G%22_logo.svg.png" alt="Image de couverture">
</div>
<?php endforeach ?>
</div>
<!-- footer pas toucher -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js" integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI" crossorigin="anonymous"></script>
</body>

View file

@ -40,5 +40,6 @@ if(isset($_POST['user']) && isset($_POST['password']) && isset($_GET['redirect_t
<input type="hidden" name="csrf" value="<?= $csrf ?>">
<button type="submit" class="btn btn-primary">Connexion</button>
</form>
<h3>En cas d'oubli de votre mot de passe, veuillez contacter Blandine Lemaire au <a href="tel:20117">20117</a></h3>
</body>
</html>

5
logout.php Normal file
View file

@ -0,0 +1,5 @@
<?php
session_start();
session_destroy();
header('location: index.php');
exit();

View file

@ -6,7 +6,7 @@ $page = 'photos';
/* Gestion de la connexion */
session_start();
if(!isset($_SESSION['connected']) || $_SESSION['connected'] == false){
if (!isset($_SESSION['connected']) || $_SESSION['connected'] == false) {
header('location: login.php?redirect_to=photos.php');
}
@ -17,16 +17,18 @@ $prefixe = $config['LOCAL_IMG_PREFIXE']
?>
<!doctype html>
<html lang="fr">
<head>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Intranet de l'APEI</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
<link rel="shortcut icon" href="./Assets/Icones/APEIMBGE.jpg" type="image/x-icon">
<link rel="stylesheet" href="./styles-scripts/photos.css">
</head>
<body>
<?php include('./Assets/navbar.php');?>
</head>
<body>
<?php include('./Assets/navbar.php'); ?>
<h3>Évènements de <?= getSiteName($bdd, $_SESSION['site']) ?></h3>
@ -68,8 +70,15 @@ $prefixe = $config['LOCAL_IMG_PREFIXE']
</a>
</div>
</div>
<button type="button" class="btn btn-primary" style="position: fixed; bottom: 20px; right: 20px;" onclick="window.location.href='./viewAllEvents.php'">Voir tous les évènements</button>
<form action="logout.php" method="post" style="position: fixed; bottom: 20px; left: 20px;">
<button type="submit" class="btn btn-danger">
Se déconnecter
</button>
</form>
<!-- footer pas toucher -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js" integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI" crossorigin="anonymous"></script>
</body>
</body>
</html>

View file

@ -55,3 +55,44 @@ body {
max-width: 100%;
}
}
/* 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;
}

14
styles-scripts/guides.css Normal file
View file

@ -0,0 +1,14 @@
.grid-container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 1rem;
padding: 1rem;
}
.card {
background: #f0f0f0;
border: 2px solid #ccc;
padding: 20px;
/* text-align: center; */
border-radius: 8px;
}

View file

@ -97,3 +97,55 @@ img {
font-weight: bold;
text-align: center;
}
.event-banner {
position: relative;
height: 220px;
margin-bottom: 25px;
border-radius: 12px;
overflow: hidden;
background-size: cover; /* empêche la déformation */
background-position: center; /* centre l'image */
background-repeat: no-repeat;
display: flex;
align-items: center;
justify-content: center;
transition: transform 0.2s ease;
}
.event-banner:hover {
transform: scale(1.02);
}
.event-overlay {
position: absolute;
inset: 0;
background: rgba(0,0,0,0.45);
}
.event-text {
position: relative;
color: white;
text-align: center;
z-index: 2;
}
.event-text h2 {
font-weight: 600;
margin-bottom: 5px;
}
/* lien invisible */
.event-banner-link {
text-decoration: none;
color: inherit;
display: block;
}
.event-banner-link:hover {
text-decoration: none;
color: inherit;
}

55
viewAllEvents.php Normal file
View file

@ -0,0 +1,55 @@
<?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"]);
$page = 'photos';
/* Gestion de la connexion */
session_start();
if (!isset($_SESSION['connected']) || $_SESSION['connected'] == false) {
header('location: login.php?redirect_to=photos.php');
}
/* Récupération des évènements */
$evenements = getEvenements($bdd, $_SESSION['site']);
$prefixe = $config['LOCAL_IMG_PREFIXE']
?>
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Intranet de l'APEI</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
<link rel="shortcut icon" href="./Assets/Icones/APEIMBGE.jpg" type="image/x-icon">
<link rel="stylesheet" href="./styles-scripts/photos.css">
</head>
<body>
<?php include('./Assets/navbar.php'); ?>
<div class="container mt-4">
<?php foreach ($evenements as $event):
$img = $prefixe . getEventBigImage($bdd, $event['id']);
?>
<a href="event.php?event=<?php echo $event['id']; ?>" class="event-banner-link">
<div class="event-banner" style="background-image: url('<?php echo $img; ?>');">
<div class="event-overlay"></div>
<div class="event-text">
<h2><?php echo $event['titre']; ?></h2>
<p><?php echo $event['date']; ?></p>
</div>
</div>
</a>
<?php endforeach; ?>
</div>
</body>
</html>