Action supprimerEvenement fonctionnel

evenements
Clément VERDOIRE 1 year ago
parent 58b4a8b01c
commit 80ca88b7ea

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

@ -0,0 +1,32 @@
/* styles.css */
/* Reset CSS pour normaliser le rendu sur tous les navigateurs */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Arial', sans-serif;
background-color: #f8f9fa;
color: #333;
}
.container {
margin-top: 20px;
}
h1 {
color: #00DBFF;
}
.list-group-item {
display: flex;
flex-direction: row;
justify-content: space-between;
margin-bottom: 20px;
padding: 15px;
border: 1px solid #dee2e6;
border-radius: 5px;
}

@ -0,0 +1,148 @@
a {
text-decoration: none;
}
.navbar-container {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 2rem;
width: 100%;
height: 70px;
background: #fff;
color: #212121;
position: sticky;
top: 0;
left: 0;
z-index: 100;
}
.navbar-container .logo-container a {
font-size: 1.5rem;
font-weight: 500;
font-family: 'Kanit', sans-serif;
text-transform: uppercase;
cursor: pointer;
color: #212121;
max-height: 70px;
}
.navbar-container .nav-items {
display: flex;
align-items: center;
gap: 3rem;
list-style: none;
}
.navbar-container .nav-items .nav-link a {
color: #212121;
padding: 10px;
text-transform: uppercase;
transition: 0.2s;
text-decoration: none;
}
.navbar-container .nav-items .nav-link:after {
content: '';
display: block;
border-top: 3px solid #00DBFF;
transform: scaleX(0);
transition: transform 250ms ease-in-out;
}
.navbar-container .nav-items .nav-link:hover:after {
transform: scaleX(0.8);
}
.navbar-container .nav-items .login-register {
display: flex;
flex-direction: row;
gap: 1rem;
}
.navbar-container .nav-items .login-register .button {
color: #00DBFF;
padding: 5px 20px;
text-transform: uppercase;
border-radius: 15px;
border: #fff 2px solid;
text-decoration: none;
}
.navbar-container .nav-items .login-register .button2{
background: #00DBFF;
color: #fff;
border-radius: 15px;
text-decoration: none;
}
.navbar-container .nav-items .login-register .button:hover {
border: #00DBFF 2px solid;
}
.navbar-container .nav-items .login-register .button2:hover {
border: #00A4FF 2px solid;
}
@media(max-width: 1030px) {
.navbar-container {
padding: 0 1rem;
}
.navbar-container .nav-items {
gap: 0.1rem;
}
.navbar-container .nav-items .nav-link a,
.navbar-container .nav-items .login-register .button {
font-size: 0.9rem;
}
}
@media(max-width: 915px) {
.navbar-container .nav-items {
flex-direction: column;
position: fixed;
top: 70px;
right: -100%;
width: 100vw;
height: 100vh;
padding: 1rem 0;
z-index: 99;
background: #fff;
transition: 0.2s ease-in;
}
.bars {
width: 22px;
height: auto;
cursor: pointer;
}
.bars .bar {
width: 100%;
height: 2px;
background: #212121;
margin: 5px;
}
.navbar-container .nav-items {
gap: 3rem;
}
.navbar-container .nav-items .login-register {
width: 50%;
text-align: center;
flex-direction: column;
gap: 2rem;
}
.navbar-container .nav-items .login-register .button {
padding: 1rem 0;
}
}
.navbar-container .nav-items.active {
right: 0;
}

@ -1,32 +0,0 @@
// change la possibilité d'entrer une ville pour l'offre
// cas où l'offre est à pourvoir en full remote
document.getElementById("fullRemote").addEventListener("change", function () {
var villeInput = document.getElementById("ville");
villeInput.disabled = this.checked;
//var ville = document.getElementById('')
});
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("form");
const submitButton = document.querySelector('input[type="submit"]');
// Fonction pour vérifier si tous les champs du formulaire sont remplis
function checkFormFields() {
const inputs = form.querySelectorAll('input, textarea, select');
let allFieldsFilled = true;
inputs.forEach(function(input) {
if (!input.value) {
allFieldsFilled = false;
}
});
submitButton.disabled = !allFieldsFilled;
}
// Écoute les événements de saisie dans les champs du formulaire
form.addEventListener("input", checkFormFields);
// Appelle la fonction initiale pour la première vérification
checkFormFields();
});

@ -10,7 +10,7 @@ class FrontControleur
$dVueErreur = []; $dVueErreur = [];
$actions = array( $actions = array(
"Admin" => [ "Admin" => [
"supprimerCompte", "consulterSignalement", "supprimerEvenement","supprimerOffre" "supprimerCompte", "consulterSignalement","supprimerOffre"
], ],
"Moderateur" => [ "Moderateur" => [
//TODO //TODO
@ -19,7 +19,7 @@ class FrontControleur
"deconnexion","proposerOffre","consulterProfil","modifierProfil","signaler" "deconnexion","proposerOffre","consulterProfil","modifierProfil","signaler"
], ],
"Utilisateur" => [ "Utilisateur" => [
"connection", "inscription", "accueil","consulterProfilLimite","listerEvenement", "creerEvenement" "connection", "inscription", "accueil","consulterProfilLimite","listerEvenement", "creerEvenement", "supprimerEvenement"
] ]
); );

@ -21,7 +21,7 @@ class UtilisateurControleur
global $twig; global $twig;
if (!isset($_REQUEST["action"])) { if (!isset($_REQUEST["action"])) {
//$action = NULL; //$action = NULL;
$action = "creerEvenement"; $action = "listerEvenement";
} else { } else {
$action = \App\config\Validation::nettoyerString($_REQUEST["action"]); $action = \App\config\Validation::nettoyerString($_REQUEST["action"]);
} }
@ -58,6 +58,9 @@ class UtilisateurControleur
case "creerEvenement": case "creerEvenement":
$this->creerEvenement(); $this->creerEvenement();
break; break;
case "supprimerEvenement":
$this->supprimerEvenement();
break;
default: default:
$dVueErreur[] ="Action inconnue ou non autorisée"; $dVueErreur[] ="Action inconnue ou non autorisée";
echo $twig->render("erreur.html",['dVueErreur' => $dVueErreur]); echo $twig->render("erreur.html",['dVueErreur' => $dVueErreur]);
@ -185,4 +188,15 @@ class UtilisateurControleur
} }
} }
protected function supprimerEvenement()
{
$mdl = new \App\modele\UtilisateurModele();
$mdl->deleteEvenement($_GET["id"]);
global $twig;
$twig->addExtension(new TwigExtensions());
$evenements = $mdl->getEvenement();
echo $twig->render('evenement.html', ['evenements' => $evenements]);
}
} }

@ -42,4 +42,12 @@ class EvenementGateway
$res=$this->con->getResults(); $res=$this->con->getResults();
return $res; return $res;
} }
public function deleteEvenement($id)
{
$query='DELETE FROM Evenement WHERE id=:id';
$this->con->executeQuery($query, array(
':id' => array($id, \PDO::PARAM_INT)
));
}
} }

@ -117,4 +117,14 @@ class UtilisateurModele
$gate->insertEvenement($evenement); $gate->insertEvenement($evenement);
} }
public function deleteEvenement(int $id)
{
global $dsn, $username, $password;
$con = new \App\gateway\Connection($dsn, $username, $password);
$gate = new \App\gateway\EvenementGateway($con);
$gate->deleteEvenement($id);
}
} }

@ -1,21 +1,41 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="en">
<head> <head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Liste des Événements</title> <title>Liste des Événements</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link rel="stylesheet" href="css/evenement.css">
</head> </head>
<body> <body>
<header>
{% include "menu.html" %}
</header>
<div class="container mt-4">
<h1>Liste des Événements</h1> <h1>Liste des Événements</h1>
<ul> <ul class="list-group">
{% for evenement in evenements %} {% for evenement in evenements %}
<li> <li class="list-group-item">
<div class="infos">
<h2>{{ evenement.titre }}</h2> <h2>{{ evenement.titre }}</h2>
<p><strong>Organisateur:</strong> {{ evenement.organisateurId}}</p> <p><strong>Organisateur:</strong> {{ evenement.organisateurId}}</p>
<p><strong>Date:</strong> {{ evenement.date }}</p> <p><strong>Date:</strong> {{ evenement.date }}</p>
<p><strong>Description:</strong> {{ evenement.description }}</p> <p><strong>Description:</strong> {{ evenement.description }}</p>
<img src="data:image/png;base64,{{ evenement.getImage().getBlob() | base64 }}" width="250px"> <img src="data:image/png;base64,{{ evenement.getImage().getBlob() | base64 }}" width="250px" class="img-fluid">
<p><strong>Places disponibles:</strong> {{ evenement.nbPlaceMax }}</p> <p><strong>Places disponibles:</strong> {{ evenement.nbPlaceMax }}</p>
</div>
<a href="../public/index.php?action=supprimerEvenement&id={{ evenement.id }}" id="deleteButton">
<img src="assets/close.png" alt="Supprimer" width="20px">
</a>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.3/dist/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body> </body>
</html> </html>

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<link rel="stylesheet" type="text/css" href="css/menu.css">
</head>
<nav class="navbar-container">
<div class="logo-container">
<a href="index.php">
<img src="assets/logo.png" alt="Logo" height="70px">
</a>
</div>
<div class="bars">
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
</div>
<ul class="nav-items">
<li class="nav-link"><a href="#">A propos</a></li>
<li class="nav-link"><a href="#">Evenements</a></li>
<li class="nav-link"><a href="#">Offres</a></li>
<li class="nav-link"><a href="#">Nous contacter</a></li>
</ul>
<ul class="nav-items">
<div class="login-register">
<a href="index.php?action=connection" class="button">Connexion</a>
<a href="index.php?action=inscription" class="button button2">Inscription</a>
</div>
</ul>
</nav>
</html>
Loading…
Cancel
Save