uniqid(), 'title' => htmlspecialchars(trim($title)), 'nombre' => htmlspecialchars(trim($nombre)), 'description' => htmlspecialchars(trim($description) ?: "Aucun détail supplémentaire fourni."), 'transport_option' => htmlspecialchars(trim($transportOption)), 'restaurant_picnic' => $restaurantPicnic, // Nouvelle donnée date_default_timezone_set("Europe/Paris"), 'date' => date('d-m-Y \à\ H:i:s') ]; $annonces[] = $annonce; saveAnnonces($annonces); return $annonce; } // Afficher toutes les annonces existantes avec le comptage des options de transport et restaurant/pique-nique function displayAnnonces() { $annonces = loadAnnonces(); $totalCovoiturage = 0; $totalRdv = 0; $totalRestaurantPicnic = 0; // Calculer les totaux par option de transport et restaurant/pique-nique foreach ($annonces as $annonce) { $totalParticipants += (int)$annonce['nombre']; if ($annonce['transport_option'] === 'Covoiturage') { $totalCovoiturage += (int)$annonce['nombre']; } elseif ($annonce['transport_option'] === 'Rendez-vous départ') { $totalRdv += (int)$annonce['nombre']; } // Ajouter au total des personnes intéressées par le restaurant ou pique-nique if (isset($annonce['restaurant_picnic'])) { $totalRestaurantPicnic += (int)$annonce['restaurant_picnic']; } } // Afficher les totaux par option de transport et pour le restaurant/pique-nique echo "
Aucune personne inscrite pour le moment.
"; } else { foreach ($annonces as $annonce) { echo "Nombre de personnes : " . $annonce['nombre'] . "
"; echo "Option choisie : " . $annonce['transport_option'] . "
"; } else { echo "Cette personne a indiqué qu'elle ne sera pas présente.
"; } if (isset($annonce['restaurant_picnic']) && $annonce['restaurant_picnic'] > 0) { echo "Personnes intéressées par un restaurant ou un pique-nique : " . $annonce['restaurant_picnic'] . "
"; } echo "" . $annonce['description'] . "
"; echo "Publié le " . $annonce['date'] . ""; echo "