Mise en forme du profil

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

@ -0,0 +1,48 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 0,
"runtimeArgs": [
"-dxdebug.start_with_request=yes"
],
"env": {
"XDEBUG_MODE": "debug,develop",
"XDEBUG_CONFIG": "client_port=${port}"
}
},
{
"name": "Launch Built-in web server",
"type": "php",
"request": "launch",
"runtimeArgs": [
"-dxdebug.mode=debug",
"-dxdebug.start_with_request=yes",
"-S",
"localhost:0"
],
"program": "",
"cwd": "${workspaceRoot}",
"port": 9003,
"serverReadyAction": {
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
"uriFormat": "http://localhost:%s",
"action": "openExternally"
}
}
]
}

@ -96,12 +96,48 @@ class Validation
return false;
}
public static function validerExperience(int $idProfil, 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($idProfil) && !empty($intitule) && !empty($dateDeb) && !empty($nomEntreprise) && !empty($currendJob))
{
self::nettoyerString($intitule, $dateDeb, $nomEntreprise);
if ($currendJob == false) {
if (!empty($dateFin)) {
self::nettoyerString($dateFin);
return true;
}
return false;
} else {
if (empty($dateFin)) {
return true;
}
return false;
}
return true;
}
return false;
}
public static function validerFormation(int $idProfil, string $nom, string $ville, string $dateDeb, ?string $dateFin, bool $currendFormation)
{
if(!empty($idProfil) && !empty($nom)&& !empty($ville) && !empty($dateDeb) && !empty($currendFormation))
{
self::nettoyerString($nom, $dateDeb, $ville);
if ($currendFormation == false) {
if (!empty($dateFin)) {
self::nettoyerString($dateFin);
return true;
}
return false;
} else {
if (empty($dateFin)) {
return true;
}
return false;
}
return true;
}
return false;
}
public static function validateNumber($number) : bool

@ -115,21 +115,76 @@ class MembreControleur extends UtilisateurControleur
}
public function proposerOffre()
{
//TODO
}
public function consulterProfil()
{
//TODO
}
public function modifierProfil()
{
//TODO
}
public function signaler()
{
//TODO
echo "not implement yet";
}
public function displayProfil()
{
global $twig;
$profilModel = new MembreModele();
$profil = $profilModel->getFormationByProfil($_SESSION["id"]);
var_dump($profil);
if(isset($profil))
{
echo $twig->render("monProfil.html",['profil' => $profil]);
return;
}
}
public function displayFormation()
{
global $twig;
$formationModel = new MembreModele();
$form = $formationModel->getFormationByProfil($_SESSION["id"]);
var_dump($form);
if(isset($form))
{
echo $twig->render("detailFormation.html",['formation' => $form]);
return;
}
}
public function formationForm()
{
global $twig;
echo $twig->render("creerFormation.html", []);
}
public function addFormation()
{
global $twig;
if (!Validation::validerFormation($_SESSION["id"], $_POST["nom"], $_POST["ville"], $_POST["dateDeb"], $_POST["dateFin"], $_POST["currentFormation"])) {
$modele = new MembreModele();
$form = $modele->addExperience($_SESSION["id"], $_POST["nom"], $_POST["ville"], $_POST["dateDeb"], $_POST["dateFin"], $_POST["currentFormation"]);
var_dump($form);
$this->displayExperience($_SESSION["id"]);
echo $twig->render('creerFormation.html', ['formation' => $form]);
} else {
$dVueErreur[] ="Erreur lors de la création de la formation";
echo $twig->render("erreur.html",['dVueErreur' => $dVueErreur]);
}
}
public function deleteFormation(?array $params)
{
global $twing;
$mdl = new MembreModele();
$mdl->deleteFormation($params['id2']);
$this->displayFormation($_SESSION["id"]);
}
public function displayExperience()
@ -137,7 +192,8 @@ class MembreControleur extends UtilisateurControleur
global $twig;
$experienceModel = new MembreModele();
$exp = $experienceModel->getExperienceByProfil($_SESSION["id"]);
if($exp != NULL)
//var_dump($exp);
if(isset($exp))
{
echo $twig->render("detailExperience.html",['experience' => $exp]);
return;
@ -147,7 +203,7 @@ class MembreControleur extends UtilisateurControleur
public function experienceForm()
{
global $twig;
echo $twig->render("CreerExperience.html", []);
echo $twig->render("creerExperience.html", []);
}
public function addExperience()
@ -156,10 +212,10 @@ class MembreControleur extends UtilisateurControleur
if (!Validation::validerExperience($_SESSION["id"], $_POST["intitule"], $_POST["dateDeb"], $_POST["dateFin"], $_POST["nomEntreprise"], $_POST["currentJob"])) {
$modele = new MembreModele();
$modele->addExperience($_SESSION["id"], $_POST["intitule"], $_POST["dateDeb"], $_POST["dateFin"], $_POST["nomEntreprise"], $_POST["currentJob"]);
$exp = $modele->addExperience($_SESSION["id"], $_POST["intitule"], $_POST["dateDeb"], $_POST["dateFin"], $_POST["nomEntreprise"], $_POST["currentJob"]);
var_dump($exp);
$this->displayExperience($_SESSION["id"]);
echo $twig->render('creerExperience.html', []);
echo $twig->render('creerExperience.html', ['experience' => $exp]);
} else {
$dVueErreur[] ="Erreur lors de la création de l'évènement";
echo $twig->render("erreur.html",['dVueErreur' => $dVueErreur]);

@ -46,6 +46,8 @@ class ExperienceGateway
$this->con->executeQuery($query, array(
':profil' => array($profil, \PDO::PARAM_INT)
));
// var_dump($profil);
// var_dump($this->con->getResults());
return $this->con->getResults();
}
@ -55,7 +57,7 @@ class ExperienceGateway
$this->con->executeQuery($query, array(
':id' => array($exp->getId(), \PDO::PARAM_INT),
//':profil' => array($exp->getProfil(), \PDO::PARAM_INT),
':profil' => array(1,\PDO::PARAM_INT),
':profil' => array(33,\PDO::PARAM_INT),
':intitule' => array($exp->getIntitule(), \PDO::PARAM_STR),
':dateBegin' => array($exp->getDateDebut(), \PDO::PARAM_STR),
':dateEnd' => array($exp->getDateFin(), \PDO::PARAM_STR),

@ -0,0 +1,78 @@
<?php
namespace App\gateway;
use App\metier\Profil;
use App\metier\Formation;
class FormationGateway
{
private \App\gateway\Connection $con;
/**
* @param $con
*/
public function __construct(\App\gateway\Connection $con){
$this->con = $con;
}
public function getNewId() : int
{
$query='SELECT MAX(id) FROM Formation';
$this->con->executeQuery($query);
$res=$this->con->getResults();
return $res[0]['MAX(id)']+1;
}
public function getNbFormation(): int
{
$query = 'SELECT COUNT(*) FROM Formation';
$this->con->executeQuery($query, array());
$res = $this->con->getResults();
return intval($res[0]['COUNT(*)']);
}
public function getFormationFromId(int $id) : array
{
$query = "SELECT * FROM Formation WHERE id=:id";
$this->con->executeQuery($query, array(
':id' => array($id, \PDO::PARAM_INT)
));
return $this->con->getResults();
}
public function getFormationFromProfil(int $profil) : array
{
$query = "SELECT * FROM Formation WHERE profil=:profil" ;
$this->con->executeQuery($query, array(
':profil' => array($profil, \PDO::PARAM_INT)
));
var_dump($profil);
// var_dump($this->con->getResults());
return $this->con->getResults();
}
public function addFormation(Formation $form)
{
$query = 'INSERT INTO Formation VALUES (:id, :profil, :nom, :ville,:dateDeb, :dateFin, :currentFormation)';
$this->con->executeQuery($query, array(
':id' => array($form->getId(), \PDO::PARAM_INT),
//':profil' => array($exp->getProfil(), \PDO::PARAM_INT),
':profil' => array(33,\PDO::PARAM_INT),
':nom' => array($form->getNom(), \PDO::PARAM_STR),
':ville' => array($form->getville(), \PDO::PARAM_STR),
':dateBegin' => array($form->getDateDebut(), \PDO::PARAM_STR),
':dateEnd' => array($form->getDateFin(), \PDO::PARAM_STR),
':currentFormation' => array($form->isFormationActuelle(), \PDO::PARAM_BOOL),
));
}
public function deleteFormation(int $id)
{
$query = 'DELETE FROM Formation WHERE id=:id';
$this->con->executeQuery($query, array(
':id' => array($id, \PDO::PARAM_INT)
));
}
}

@ -63,10 +63,10 @@ class Experience
return $this->id;
}
public function getProfil(): Profil
/*public function getProfil(): Profil
{
return $this->profil;
}
}*/
public function getProfilId(): int
{

@ -11,7 +11,7 @@ class Formation
/**
* @var Profil profil
*/
private Profil $profil;
private int $profil;
/**
* @var string Nom
@ -40,14 +40,14 @@ class Formation
/**
* @param int $id
* @param Profil $profil
* @param int $profil
* @param string $nom
* @param string $ville
* @param string $dateDebut
* @param string $dateFin
* @param bool $formationActuelle
*/
public function __construct(int $id, Profil $profil, string $nom, string $ville, string $dateDebut, string $dateFin, bool $formationActuelle)
public function __construct(int $id, int $profil, string $nom, string $ville, string $dateDebut, string $dateFin, bool $formationActuelle)
{
$this->id = $id;
$this->profil = $profil;
@ -63,10 +63,17 @@ class Formation
return $this->id;
}
/*
public function getProfil(): Profil
{
return $this->profil;
}
*/
public function getProfilId(): int
{
return $this->profil->getId();
}
public function getNom(): string
{

@ -10,11 +10,6 @@ class Profil
*/
private int $id;
/**
* @var Alumni Profil lié à l'Alumni
*/
private Alumni $alumni;
/**
* @var string CV
*/
@ -66,12 +61,10 @@ class Profil
* @param string $githubUrl
* @param 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)
public function __construct(int $idProfil,string $nom, string $prenom, string $email, ?string $image,string $cv, string $linkedinUrl, string $githubUrl, string $portfolioUrl)
{
$this->id = $idProfil;
$this->nom = $nom;
$this->alumni = $alumni;
$this->prenom = $prenom;
$this->image = $image;
$this->email = $email;
@ -89,10 +82,10 @@ class Profil
return $this->id;
}
public function getAlmuni(): Alumni
/*public function getAlmuni(): Alumni
{
return $this->alumni;
}
}*/
public function getImage(): ?string
{

@ -6,19 +6,27 @@ use App\gateway\ImageManager;
use App\metier\Alumni;
use App\metier\Offre;
use App\metier\Experience;
use App\metier\Formation;
use App\metier\Profil;
use App\gateway\Connection;
use App\gateway\ExperienceGateway;
use App\gateway\FormationGateway;
use App\gateway\ProfilGateway;
class MembreModele extends UtilisateurModele
{
private $con;
protected $experienceGw;
protected $formationGw;
protected $profilGw;
public function __construct()
{
$this->con = new Connection(DB_HOST,DB_USER,DB_PASS);
$this->experienceGw = new ExperienceGateway($this->con);
$this->formationGw = new FormationGateway($this->con);
$this->profilGw = new ProfilGateway($this->con);
}
/**
@ -30,18 +38,10 @@ class MembreModele extends UtilisateurModele
return false;
}
/**
* @description ajouter formation
*/
public function addFormation() : bool
{
// TO DO
return false;
}
/**
* @description modifier formation
*
*/
public function updateFormation() : bool
{
@ -49,6 +49,28 @@ class MembreModele extends UtilisateurModele
return false;
}
public function getProfilById($idProfil) : ?array
{
$data = $this->profilGw->getProfilById($idProfil);
$profil = array();
foreach($data as $row)
{
$profil[] = new Profil(
$row['id'],
$row['nom'],
$row['prenom'],
$row['image'],
$row['email'],
$row['cv'],
$row['linkedinUrl'],
$row['githubUrl'],
$row['portfolioUrl']
);
}
return $profil;
}
/**
* @description Récupérer l'expériences en fonction de l'id
*/
@ -80,7 +102,7 @@ class MembreModele extends UtilisateurModele
$data = $this->experienceGw->getExperienceFromProfil($idProfil);
$experience = array();
var_dump($data);
// var_dump($data);
foreach($data as $row)
{
$experience[] = new Experience(
@ -90,9 +112,10 @@ class MembreModele extends UtilisateurModele
$row['dateDebut'],
$row['dateFin'],
$row['nomEntreprise'],
$row['currentJob'],
$row['currentJob']
);
}
// var_dump($experience);
return $experience;
}
@ -122,6 +145,57 @@ class MembreModele extends UtilisateurModele
$this->experienceGw->deleteExperience($id);
}
/**
* @description Récupérer les formations de l'utilisateurs en cours
*/
public function getFormationByProfil($idProfil) : ?array
{
$data = $this->formationGw->getFormationFromProfil($idProfil);
$formation = array();
var_dump($data);
foreach($data as $row)
{
$formation[] = new Formation(
$row['id'],
$row['profil'],
$row['nom'],
$row['ville'],
$row['dateDeb'],
$row['dateFin'],
$row['currentFormation']
);
}
var_dump($formation);
return $formation;
}
/**
* @description ajouter une formation
*/
public function addFormation($idExperience, string $nom, string $ville, string $dateDeb, string $dateFin, string $currentFormation)
{
$form = new Formation(
$this->experienceGw->getNewId(),
$idExperience,
$nom,
$ville,
$dateDeb,
$dateFin,
$currentFormation
);
$this->formationGw->addFormation($form);
}
/**
* @description supprimer une formation
*/
public function deleteFormation($id)
{
$this->formationGw->deleteFormation($id);
}
/**
* @description modifier experience
*/

@ -10,7 +10,7 @@
<body>
<div>
<h1>Ajouter une expérience</h1>
<form action="index.php?action=ajouterExperience" method="POST" enctype="multipart/form-data">
<form action="{{dir}}/user/addExperience" method="POST" enctype="multipart/form-data">
<div>
<label for="intitule">Intitule :</label>
@ -34,13 +34,15 @@
<div>
<label for="currentJob">Job en cours ? :</label>
<input type="radio" name="currentJob" id="currentJob" required>
<input type="checkbox" name="currentJob" id="currentJob">
</div>
<div>
<input type="submit" value="ajouter_Experience">
<input type="submit" value="addExperience">
</div>
</form>
<a href="{{dir}}/user/displayExperience">Retour</a>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>

@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ajouter une foramtion</title>
<link rel="stylesheet" href="">
</head>
<body>
<div>
<h1>Ajouter une formation</h1>
<form action="{{dir}}/user/addFormation" method="POST" enctype="multipart/form-data">
<div>
<label for="nom">Nom :</label>
<input type="text" id="nom" name="nom" required>
</div>
<div>
<label for="ville">Ville :</label>
<input type="text" id="ville" name="ville" required>
</div>
<div>
<label for="dateDeb">Date de début :</label>
<input type="date" id="dateDeb" name="dateDeb" required>
</div>
<div>
<label for="dateFin">Date de fin :</label>
<input type="date" id="dateFin" name="dateFin">
</div>
<div>
<label for="currentFormation">Job en cours ? :</label>
<input type="checkbox" name="currentFormation" id="currentFormation">
</div>
<div>
<input type="submit" value="addFormation">
</div>
</form>
<a href="{{dir}}/user/displayFormation">Retour</a>
</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>

@ -3,32 +3,30 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
{% if experience %}
<title>{{experience.intitule}}</title>
{% endif %}
<title>Experience</title>
<link rel="stylesheet" href="">
</head>
<body>
<header>
{% include "menu.html" %}
</header>
<div>
{% if experience %}
<h1>Détails de l'Événement : {{experience.intitule}}</h1>
{% for exp in experience %}
<h2>Détails de l'Événement : {{exp.getIntitule()}}</h2>
<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="{{dir}}/user/displayExperience">Retour</a>
<p><strong>nom de l'entreprise :</strong> {{ exp.getNomEntreprise() }}</p>
<p><strong>Date de début :</strong> {{ exp.getDateDebut() }}</p>
<p><strong>Date de fin :</strong> {{ exp.getDateFin }}</p>
<p><strong>Job en cours ? :</strong> {{ exp.isTravailActuel() }}</p>
</div>
{% endfor %}
{% else %}
<p>L'expérience n'existe pas ou n'est pas disponible.</p>
<p>Aucune expérience n'a été ajouté</p>
{% endif %}
</div>
<div>
<a href="{{dir}}/user/experienceForm">Ajouter Experience</a>
<br>
<a href="{{dir}}/user/displayExperience">Retour</a>
</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>

@ -0,0 +1,35 @@
<!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>Formation</title>
<link rel="stylesheet" href="">
</head>
<body>
<div>
{% if formation %}
{% for form in formation %}
<h2>Détails de la formation : {{form.getNom()}}</h2>
<div>
<p><strong>ville :</strong> {{ form.getVille() }}</p>
<p><strong>Date de début :</strong> {{ form.getDateDebut() }}</p>
<p><strong>Date de fin :</strong> {{ form.getDateFin }}</p>
<p><strong>Formation en cours ? :</strong> {{ form.isFormationActuelle() }}</p>
</div>
{% endfor %}
{% else %}
<p>Aucune formation n'a été ajouté.</p>
{% endif %}
</div>
<div>
<a href="{{dir}}/user/FormationForm">Ajouter Formation</a>
<br>
<a href="{{dir}}/user/displayFormation">Retour</a>
</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>

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

@ -0,0 +1,50 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
{% if profil %}
<title>{profil.getNom()} {profil.getprenom()} </title>
{% endif %}
<link rel="stylesheet" href="">
</head>
<body>
<header>
{% include "menu.html" %}
</header>
<div>
{% if profil %}
<h1>Profil de : {{ profil.nom }} {{ profil.prenom }}</h1>
<div>
<p><strong>Nom :</strong> {{ profil.nom }}</p>
<p><strong>Prenom :</strong> {{ profil.prenom }}</p>
<p><strong> :</strong> </p>
<p><strong> :</strong> </p>
<!-- Modification du profil -->
<a href="{{dir}}/user/displayProfil">Modifier profil</a>
</div>
{% else %}
<p>Error Profil</p>
{% endif %}
</div>
<div>
<!-- Partie expérience de l'utilisateur -->
{% include "detailExperience.html" %}
</div>
<div>
<!-- Partie formation de l'utilisateur -->
{% include "detailFormation.html" %}
</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