Finition DisplayExperience / Manque correction profil

Expérience/Formation
thomas muzard 1 year ago
parent dbb002924d
commit e8e947db5e

@ -96,9 +96,9 @@ class Validation
return false;
}
public static function validerExperience(string $intitule, string $dateDeb, string $dateFin, string $nomEntreprise, bool $currendJob)
public static function validerExperience(int $idProfil, string $intitule, string $dateDeb, string $dateFin, string $nomEntreprise, bool $currendJob)
{
if(!empty($intitule) && !empty($dateDeb) && !empty($nomEntreprise) && !empty($currendJob))
if(!empty($idProfil) && !empty($intitule) && !empty($dateDeb) && !empty($nomEntreprise) && !empty($currendJob))
{
return true;
}

@ -5,6 +5,7 @@ namespace App\controleur;
use App\router\AltoRouter;
use App\controleur\Error;
use ErrorException;
class FrontControleur
{
@ -18,7 +19,7 @@ class FrontControleur
$_SESSION['nom'] = NULL;
$_SESSION['prenom'] = NULL;
$_SESSION['role'] = "guest";
$_SESSION['id'] = NULL;
$_SESSION['id'] = "ttttttttttttttttttttt";
}
else{
$twig->addGlobal('nom', $_SESSION['nom']);
@ -117,14 +118,14 @@ class FrontControleur
echo $twig->render('accueil.html');
}
} catch (Error $error) {
} catch (ErrorException $error) {
$dVueErreur = ['Erreur : Action inconnue'];
echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]);
}
}
}
catch(Error $e)
catch(ErrorException $e)
{
$dVueErreur = ['Erreur : Action inconnue'];

@ -11,10 +11,6 @@ class MembreControleur extends UtilisateurControleur
{}
public function deconnexion()
{
global $twig;
protected function deconnexion()
{
session_unset();
session_destroy();
@ -22,6 +18,7 @@ class MembreControleur extends UtilisateurControleur
header("Location: /SAE_2A_FA-Reseau_ALICA/php/");
exit();
}
public function createOfferForm()
{
global $twig;
@ -104,7 +101,7 @@ class MembreControleur extends UtilisateurControleur
$MemberModel->deleteOffer($offre);
}
$this->consultOffers();
$this->consultOffers(null);
/*$offre = $MemberModel->getOfferFromId($id);
@ -138,50 +135,44 @@ class MembreControleur extends UtilisateurControleur
public function displayExperience()
{
global $twig;
if (isset($_GET["id"]) && intval($_GET["id"]) != null)
{
$experienceModel = new MembreModele();
$exp = $experienceModel->getExperienceFromProfil(intval($_GET["id"]));
$exp = $experienceModel->getExperienceByProfil($_SESSION["id"]);
if($exp != NULL)
{
echo $twig->render("detailExperience.html",['experience' => $exp]);
return;
}
}
$dVueErreur[] = "Erreur, Expérience(s) introuvable";
echo $twig->render("erreur.html", ['dVueErreur' => $dVueErreur]);
}
protected function experienceForm()
public function experienceForm()
{
global $twig;
echo $twig->render("CreerExperience.html", []);
}
protected function addExperience()
public function addExperience()
{
global $twig;
if (!Validation::validerExperience($_POST["intitule"], $_POST["dateDeb"], $_POST["dateFin"], $_POST["nomEntreprise"], $_POST["currentJob"])) {
if (!Validation::validerExperience($_SESSION["id"], $_POST["intitule"], $_POST["dateDeb"], $_POST["dateFin"], $_POST["nomEntreprise"], $_POST["currentJob"])) {
$modele = new MembreModele();
$modele->addExperience($_POST["intitule"], $_POST["dateDeb"], $_POST["dateFin"], $_POST["nomEntreprise"], $_POST["currentJob"]);
$modele->addExperience($_SESSION["id"], $_POST["intitule"], $_POST["dateDeb"], $_POST["dateFin"], $_POST["nomEntreprise"], $_POST["currentJob"]);
$this->listerExperience();
$this->displayExperience($_SESSION["id"]);
echo $twig->render('creerExperience.html', []);
} else {
$dVueErreur[] ="Erreur lors de la création de l'évènement";
echo $twig->render("erreur.html",['dVueErreur' => $dVueErreur]);
} else {
echo $twig->render('creerExperience.html', []);
}
}
protected function deleteEvenement()
public function deleteExperience(?array $params)
{
global $twing;
$mdl = new MembreModele();
$mdl->deleteEvenement($_GET["id"]);
$this->listerExperience();
$mdl->deleteExperience($params['id2']);
$this->displayExperience($_SESSION["id"]);
}
}

@ -186,7 +186,7 @@ class UtilisateurControleur
{
global $twig;
if (isset($params['id']) && intval($params['id']) != null)
if (isset($params['id']) && ($params['id']) != null)
{
$uttilsMdl = new UtilisateurModele();
$offre = $uttilsMdl->getOfferFromId(intval($params["id"]));

@ -42,7 +42,7 @@ class ExperienceGateway
public function getExperienceFromProfil(int $profil) : array
{
$query = "SELECT * FROM experience WHERE profil=:profil AND " ;
$query = "SELECT * FROM experience WHERE profil=:profil" ;
$this->con->executeQuery($query, array(
':profil' => array($profil, \PDO::PARAM_INT)
));
@ -66,7 +66,7 @@ class ExperienceGateway
public function deleteExperience(int $id)
{
$query = 'DELETE FROM experience WHERE id=:id'
$query = 'DELETE FROM experience WHERE id=:id';
$this->con->executeQuery($query, array(
':id' => array($id, \PDO::PARAM_INT)
));

@ -11,7 +11,7 @@ class Experience
/**
* @var Profil profil
*/
private Profil $profil;
private int $profil;
/**
* @var string Intitule
@ -40,14 +40,14 @@ class Experience
/**
* @param int $id
* @param Profil $profil
* @param int $profil
* @param string $intitule
* @param string $dateDebut
* @param string $dateFin
* @param string $nomEntreprise
* @param bool $travailActuel
*/
public function __construct(int $id, Profil $profil, string $intitule, string $dateDebut, string $dateFin, string $nomEntreprise, bool $travailActuel)
public function __construct(int $id, int $profil, string $intitule, string $dateDebut, string $dateFin, string $nomEntreprise, bool $travailActuel)
{
$this->id = $id;
$this->profil = $profil;
@ -68,6 +68,11 @@ class Experience
return $this->profil;
}
public function getProfilId(): int
{
return $this->profil->getId();
}
public function getIntitule(): string
{
return $this->intitule;

@ -1,6 +1,8 @@
<?php
namespace App\metier;
use App\metier\Alumni;
class Profil
{
/**
@ -8,6 +10,10 @@ class Profil
*/
private int $id;
/**
* @var Alumni Profil lié à l'Alumni
*/
private Alumni $alumni;
/**
* @var string CV
@ -42,6 +48,16 @@ class Profil
*/
private string $portfolioUrl;
/**
*@var array liste des formation d'un profil
*/
// private array $listeFormation;
/**
* @var array liste des expériences d'un profil
*/
// private array $listeExperience;
/**
* @param string $cv
* @param string $nom
@ -50,10 +66,12 @@ class Profil
* @param string $githubUrl
* @param string $portfolioUrl
*/
public function __construct(int $alumni,string $nom, string $prenom, string $email, ?string $image,string $cv, string $linkedinUrl, string $githubUrl, string $portfolioUrl)
public function __construct(int $idProfil, Alumni $alumni,string $nom, string $prenom, string $email, ?string $image,string $cv, string $linkedinUrl, string $githubUrl, string $portfolioUrl)
{
$this->id = $alumni;
$this->id = $idProfil;
$this->nom = $nom;
$this->alumni = $alumni;
$this->prenom = $prenom;
$this->image = $image;
$this->email = $email;
@ -61,6 +79,8 @@ class Profil
$this->linkedinUrl = $linkedinUrl;
$this->githubUrl = $githubUrl;
$this->portfolioUrl = $portfolioUrl;
// $this->listeFormation = null;
// $this->listeExperience = null;
}
@ -68,10 +88,17 @@ class Profil
{
return $this->id;
}
public function getAlmuni(): Alumni
{
return $this->alumni;
}
public function getImage(): ?string
{
return $this->image ?? 'logo.png';
}
public function getCv(): string
{
return $this->cv;

@ -2,28 +2,23 @@
namespace App\modele;
<<<<<<< HEAD
use App\gateway\AlumniGateway;
use App\gateway\Connection;
use App\gateway\ImageGateway;
use App\gateway\OffreGateway;
use App\gateway\ProfilGateway;
use App\metier\Alumni;
use mysql_xdevapi\Exception;
=======
use App\gateway\ImageManager;
use App\metier\Alumni;
use App\metier\Offre;
>>>>>>> master
use App\metier\Experience;
use App\gateway\Connection;
use App\gateway\ExperienceGateway;
class MembreModele extends UtilisateurModele
{
private $con;
protected $experienceGw;
public function __construct()
{
$this->con = new Connection(DB_HOST,DB_USER,DB_PASS);
$this->experienceGw = new ExperienceGateway($this->con);
}
/**
@ -57,10 +52,9 @@ class MembreModele extends UtilisateurModele
/**
* @description Récupérer l'expériences en fonction de l'id
*/
public function getExperienceById() : array
public function getExperienceById($idProfil) : ?array
{
$gate = new ExperiencetGateway($this->con);
$data = $gate->getExperienceFromId();
$data = $this->experienceGw->getExperienceFromId($idProfil);
$experience = array();
foreach($data as $row)
@ -81,22 +75,22 @@ class MembreModele extends UtilisateurModele
/**
* @description Récupérer les expériences de l'utilisateurs en cours
*/
public function getExperienceByProfil() : array
public function getExperienceByProfil($idProfil) : ?array
{
$gate = new ExperiencetGateway($this->con);
$data = $gate->getExperienceFromProfil();
$data = $this->experienceGw->getExperienceFromProfil($idProfil);
$experience = array();
var_dump($data);
foreach($data as $row)
{
$experience[] = new Experience(
$row['id'],
$row['profil'],
$row['intitule'],
$row['dateBegin'],
$row['dateEnd'],
$row['industryName'],
$row['currentJob']
$row['dateDebut'],
$row['dateFin'],
$row['nomEntreprise'],
$row['currentJob'],
);
}
return $experience;
@ -105,30 +99,27 @@ class MembreModele extends UtilisateurModele
/**
* @description ajouter Experience
*/
public function addExperience()
public function addExperience($idExperience, string $intitule, string $dateDeb, string $dateFin, string $nomEntreprise, string $currentJob)
{
$gate = new ExperienceGateway($this->con);
$exp = new Experience(
$gate->getNewId(),
'1', //TODO : Ajouter l'ID de l'admin connecté
$titre,
$description,
$date,
$nbPlaceMax,
$img
$this->experienceGw->getNewId(),
$idExperience,
$intitule,
$dateDeb,
$dateFin,
$nomEntreprise,
$currentJob
);
$gate->insertEvenement($evenement);
$this->experienceGw->addExperience($exp);
}
/**
* @description supprimer une expérience
*/
public function deleteExperience(int $id)
public function deleteExperience($id)
{
$gate = new ExperienceGateway($this->con);
$gate->deleteExperience($id);
$this->experienceGw->deleteExperience($id);
}
/**

@ -14,16 +14,16 @@
{% include "menu.html" %}
</header>
<div class="container mt-4">
<div>
{% if experience %}
<h1>Détails de l'Événement : {{experience.intitule}}</h1>
<div class="event-details">
<div>
<p><strong>nom de l'entreprise :</strong> {{ experience.nomEntreprise }}</p>
<p><strong>Date de début :</strong> {{ experience.dateDeb }}</p>
<p><strong>Date de fin :</strong> {{ experience.dateFin }}</p>
<p><strong>Job en cours ? :</strong> {{ experience.travailActuel }}</p>
<a href="../public/index.php?action=listerExperience">Retour</a>
<a href="{{dir}}/user/displayExperience">Retour</a>
</div>
{% else %}
<p>L'expérience n'existe pas ou n'est pas disponible.</p>

@ -27,7 +27,7 @@
<!-- Afficher boutons de connexion et d'inscription -->
{% if nom and prenom %}
<!-- Afficher bouton de déconnexion -->
<a href="index.php?action=displayExperience">Mon profil</a>
<a href="{{dir}}/user/displayExperience">Mon profil</a>
<a href="{{dir}}/user/deconnexion" class="button">Déconnexion</a>
{% else %}
<div class="login-register">

Loading…
Cancel
Save