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
],
"Membre" => [
"deconnexion","proposerOffre","consulterProfil","modifierProfil","signaler","ajouterExperience","supprimerExperience"
"deconnexion","proposerOffre","consulterProfil","modifierProfil","signaler","ajouterExperience","supprimerExperience", "listerExperience"
],
"Utilisateur" => [

@ -28,7 +28,13 @@ class MembreControleur extends UtilisateurControleur
$this->signaler();
break;
case "ajouterExperience":
$this->ajouterExperience();
$this->addExperience();
break;
case "supprimerExperience":
$this->deleteExperience();
break;
case "listerExperience":
$this->displayExperience();
break;
default:
parent::__construct();
@ -62,7 +68,7 @@ class MembreControleur extends UtilisateurControleur
//TODO
}
public function listerExperience()
public function displayExperience()
{
global $twig;
@ -86,21 +92,30 @@ class MembreControleur extends UtilisateurControleur
echo $twig->render("CreerExperience.html", []);
}
protected function ajouterExperience()
protected function addExperience()
{
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->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();
} else {
$dVueErreur[] ="Erreur lors de la création de l'évènement";
echo $twig->render("erreur.html",['dVueErreur' => $dVueErreur]);
}
} 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;
}
public function getMaxId() : int
public function getNewId() : int
{
$query='SELECT MAX(id) FROM Experience';
$this->con->executeQuery($query);
@ -31,7 +31,7 @@ class ExperienceGateway
return intval($res[0]['COUNT(*)']);
}
public function getExperienceFromId($id) : array
public function getExperienceFromId(int $id) : array
{
$query = "SELECT * FROM experience WHERE id=:id";
$this->con->executeQuery($query, array(
@ -40,7 +40,7 @@ class ExperienceGateway
return $this->con->getResults();
}
public function getExperienceFromProfil($profil) : array
public function getExperienceFromProfil(int $profil) : array
{
$query = "SELECT * FROM experience WHERE profil=:profil AND " ;
$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'
$this->con->executeQuery($query, array(

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

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@ -18,26 +18,26 @@
</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>
</div>
<div>
<label for="date">Date de fin :</label>
<label for="dateFin">Date de fin :</label>
<input type="date" id="dateFin" name="dateFin">
</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>
</div>
<div class="form-group">
<label for="image">Job en cours ? :</label>
<input type="radio" name="image" id="image" required>
<div>
<label for="currentJob">Job en cours ? :</label>
<input type="radio" name="currentJob" id="currentJob" required>
</div>
<div class="form-group">
<div>
<input type="submit" value="ajouter_Experience">
</div>
</form>

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="fr">
<head>
<meta charset="UTF-8">
<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