fin expérience -> test en cours

Expérience/Formation
thomas muzard 1 year ago
parent 12f1078968
commit be693be91e

@ -16,7 +16,7 @@ class FrontControleur
//TODO //TODO
], ],
"Membre" => [ "Membre" => [
"deconnexion","proposerOffre","consulterProfil","modifierProfil","signaler","ajouterExperience","supprimerExperience" "deconnexion","proposerOffre","consulterProfil","modifierProfil","signaler","ajouterExperience","supprimerExperience", "listerExperience"
], ],
"Utilisateur" => [ "Utilisateur" => [

@ -28,7 +28,13 @@ class MembreControleur extends UtilisateurControleur
$this->signaler(); $this->signaler();
break; break;
case "ajouterExperience": case "ajouterExperience":
$this->ajouterExperience(); $this->addExperience();
break;
case "supprimerExperience":
$this->deleteExperience();
break;
case "listerExperience":
$this->displayExperience();
break; break;
default: default:
parent::__construct(); parent::__construct();
@ -62,7 +68,7 @@ class MembreControleur extends UtilisateurControleur
//TODO //TODO
} }
public function listerExperience() public function displayExperience()
{ {
global $twig; global $twig;
@ -86,21 +92,30 @@ class MembreControleur extends UtilisateurControleur
echo $twig->render("CreerExperience.html", []); echo $twig->render("CreerExperience.html", []);
} }
protected function ajouterExperience() protected function addExperience()
{ {
global $twig; global $twig;
if (!Validation::validerExperience($_POST["titre"], $_POST["description"], $_POST["date"], $_POST["nbPlaceMax"], $img[1])) { if (!Validation::validerExperience($_POST["intitule"], $_POST["dateDeb"], $_POST["dateFin"], $_POST["nomEntreprise"], $_POST["currentJob"])) {
$modele = new MembreModele(); $modele = new MembreModele();
$modele->addExperience($_POST["titre"], $_POST["description"], $_POST["date"], $_POST["nbPlaceMax"], $img[1]); $modele->addExperience($_POST["intitule"], $_POST["dateDeb"], $_POST["dateFin"], $_POST["nomEntreprise"], $_POST["currentJob"]);
$this->listerExperience(); $this->listerExperience();
} else { } else {
$dVueErreur[] ="Erreur lors de la création de l'évènement"; $dVueErreur[] ="Erreur lors de la création de l'évènement";
echo $twig->render("erreur.html",['dVueErreur' => $dVueErreur]); echo $twig->render("erreur.html",['dVueErreur' => $dVueErreur]);
}
} else { } else {
echo $twig->render('creerEvenement.html', []); echo $twig->render('creerExperience.html', []);
} }
} }
}
protected function deleteEvenement()
{
$mdl = new MembreModele();
$mdl->deleteEvenement($_GET["id"]);
$this->listerExperience();
}
}

@ -15,7 +15,7 @@ class ExperienceGateway
$this->con = $con; $this->con = $con;
} }
public function getMaxId() : int public function getNewId() : int
{ {
$query='SELECT MAX(id) FROM Experience'; $query='SELECT MAX(id) FROM Experience';
$this->con->executeQuery($query); $this->con->executeQuery($query);
@ -31,7 +31,7 @@ class ExperienceGateway
return intval($res[0]['COUNT(*)']); return intval($res[0]['COUNT(*)']);
} }
public function getExperienceFromId($id) : array public function getExperienceFromId(int $id) : array
{ {
$query = "SELECT * FROM experience WHERE id=:id"; $query = "SELECT * FROM experience WHERE id=:id";
$this->con->executeQuery($query, array( $this->con->executeQuery($query, array(
@ -40,7 +40,7 @@ class ExperienceGateway
return $this->con->getResults(); return $this->con->getResults();
} }
public function getExperienceFromProfil($profil) : array public function getExperienceFromProfil(int $profil) : array
{ {
$query = "SELECT * FROM experience WHERE profil=:profil AND " ; $query = "SELECT * FROM experience WHERE profil=:profil AND " ;
$this->con->executeQuery($query, array( $this->con->executeQuery($query, array(
@ -64,7 +64,7 @@ class ExperienceGateway
)); ));
} }
public function deleteExperience($id) public function deleteExperience(int $id)
{ {
$query = 'DELETE FROM experience WHERE id=:id' $query = 'DELETE FROM experience WHERE id=:id'
$this->con->executeQuery($query, array( $this->con->executeQuery($query, array(

@ -116,10 +116,19 @@ class MembreModele extends UtilisateurModele
$gate->insertEvenement($evenement); $gate->insertEvenement($evenement);
} }
/**
* @description supprimer une expérience
*/
public function deleteExperience(int $id)
{
$gate = new ExperienceGateway($this->con);
$gate->deleteExperience($id);
}
/** /**
* @description modifier experience * @description modifier experience
*/ */
public function updateExpereience() : bool public function updateExperience() : bool
{ {
// TO DO // TO DO
return false; return false;

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="fr">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
@ -18,26 +18,26 @@
</div> </div>
<div> <div>
<label for="date">Date de début :</label> <label for="dateDeb">Date de début :</label>
<input type="date" id="dateDeb" name="dateDeb" required> <input type="date" id="dateDeb" name="dateDeb" required>
</div> </div>
<div> <div>
<label for="date">Date de fin :</label> <label for="dateFin">Date de fin :</label>
<input type="date" id="dateFin" name="dateFin"> <input type="date" id="dateFin" name="dateFin">
</div> </div>
<div> <div>
<label for="intitule">Nom de l'entreprise :</label> <label for="nomEntreprise">Nom de l'entreprise :</label>
<input type="text" id="nomEntreprise" name="nomEntreprise" required> <input type="text" id="nomEntreprise" name="nomEntreprise" required>
</div> </div>
<div class="form-group"> <div>
<label for="image">Job en cours ? :</label> <label for="currentJob">Job en cours ? :</label>
<input type="radio" name="image" id="image" required> <input type="radio" name="currentJob" id="currentJob" required>
</div> </div>
<div class="form-group"> <div>
<input type="submit" value="ajouter_Experience"> <input type="submit" value="ajouter_Experience">
</div> </div>
</form> </form>

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="fr">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Mes Expérience(s)</title>
<link rel="stylesheet" href="">
</head>
<body>
<header>
{% include "menu.html" %}
</header>
<div>
<div>
<h1>Mes Expériences</h1>
<a href="../public/index.php?action=ajouterExperience">Ajouter une expérience</a>
</div>
<ul>
{% if experience is not empty %}
{% for experience in experiences %}
<li>
<div>
<h2>{{ experience.intitule }}</h2>
<p> <strong>nom de l'entreprise :</strong> {{ experience.getNomEntreprise() }}</p>
<p><strong>Date début :</strong> {{ experience.getDateDebut }}</p>
<p><strong>Date de fin:</strong> {{ experience.getDateFin }}</p>
<p><strong>Travail actuel :</strong> {{ experience.isTravailActuel }}</p>
</div>
<form action="../public/index.php?action=supprimerExperience&id={{ experience.id }}" method="POST">
<button type="submit" id="deleteButton">
<img src="assets/close.png" alt="Supprimer" width="20px">
</button>
</form>
</li>
{% endfor %}
{% else %}
<li>Aucun événement trouvé.</li>
{% endif %}
</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>
</html>
Loading…
Cancel
Save