Compare commits

...

5 Commits

Author SHA1 Message Date
Baptiste D e4d480b28f test
1 year ago
Baptiste D bd7f228d1f fix conflicts je crois
1 year ago
Baptiste D ef93699a64 test
1 year ago
Baptiste D 6f82697826 modif offres
1 year ago
Baptiste D b4127bb330 modification image saver gestion cas image nom existant
1 year ago

@ -1,6 +1,3 @@
<IfModule mod_rewrite.c> RewriteEngine on
RewriteEngine On
RewriteBase /php/public/
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L] RewriteRule . index.php [L]
</IfModule>

@ -0,0 +1,15 @@
<?php
/** PC IUT - PHP 8.1 */
/** Chargement config */
require_once __DIR__ . '/src/config/config.php';
require __DIR__ . '/vendor/autoload.php';
/** Configuration twig */
$loader = new \Twig\Loader\FilesystemLoader(__DIR__ . '/templates');
$twig = new \Twig\Environment($loader, [
'cache' => false,
'debug' => true
]);
$twig->addExtension(new \Twig\Extension\DebugExtension());
$cont = new \App\controleur\FrontControleur();

@ -1,16 +0,0 @@
<?php
/** PC IUT - PHP 8.1 */
/** Chargement config */
require_once __DIR__ . '/../src/config/config.php';
require __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../src/TwigExtensions.php'; // utile pour les images à supprimer sinon
/** Configuration twig */
$loader = new \Twig\Loader\FilesystemLoader(__DIR__ . '/../templates');
$twig = new \Twig\Environment($loader, [
'cache' => false,
'debug' => true
]);
$twig->addExtension(new \Twig\Extension\DebugExtension());
$cont = new \App\controleur\FrontControleur();

@ -1,24 +0,0 @@
<?php
namespace App;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
class TwigExtensions extends AbstractExtension
{
public function getFilters()
{
return [
new TwigFilter('base64', [$this, 'twig_base64_filter']),
];
}
public function twig_base64_filter($source)
{
if ($source !== null) {
return base64_encode($source);
}
return '';
}
}

@ -2,23 +2,29 @@
namespace App\controleur; namespace App\controleur;
use App\config;
use App\config\Validation; use App\config\Validation;
use App\gateway\Connection;
use App\gateway\ImageSaver; use App\gateway\ImageSaver;
use App\modele\OffreModele; use App\gateway\OffreGateway;
use App\modele\UtilisateurModele; use App\modele\UtilisateurModele;
use App\config;
class UtilisateurControleur class UtilisateurControleur
{ {
private \App\modele\UtilisateurModele $userModel;
public function __construct() public function __construct()
{ {
global $twig; global $twig;
$this->userModel = new \App\modele\UtilisateurModele();
if (!isset($_REQUEST["action"])) { if (!isset($_REQUEST["action"])) {
//$action = NULL; //$action = NULL;
$action = "listerEvenement"; $action = "consultOffers";
} else { } else {
$action = Validation::nettoyerString($_REQUEST["action"]); $action = \App\config\Validation::nettoyerString($_REQUEST["action"]);
} }
switch ($action) { switch ($action) {
case NULL: case NULL:
@ -33,6 +39,7 @@ class UtilisateurControleur
break; break;
case "inscription": case "inscription":
$this->inscription(); $this->inscription();
break; break;
case "consultOffers": case "consultOffers":
$this->consultOffers(); $this->consultOffers();
@ -49,24 +56,10 @@ class UtilisateurControleur
case "displayOffer": case "displayOffer":
$this->displayOffer(); $this->displayOffer();
break; break;
case "listerEvenement":
$this->listerEvenement();
break;
case "creerEvenement":
$this->creerEvenement();
break;
case "supprimerEvenement":
$this->supprimerEvenement();
break;
case "avoirDetailEvenement":
$this->avoirDetailEvenement();
break;
case "rechercherEvenement":
$this->rechercherEvenement();
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]);
} }
} }
@ -115,20 +108,6 @@ class UtilisateurControleur
} }
$nouvelUtilisateur = $userModel->inscription($prenom,$nom,$email, $hash); $nouvelUtilisateur = $userModel->inscription($prenom,$nom,$email, $hash);
// <<<<<<< HEAD
// // Validez les données d'inscription, par exemple, vérifiez si l'email est unique
// // Vous pouvez également effectuer d'autres validations nécessaires
// $userModel = new \App\modele\UtilisateurModele();
// $nouvelUtilisateur = $userModel->inscription($email, $motDePasse);
// // Si l'inscription a réussi, redirigez l'utilisateur vers une page de confirmation
// // Vous pouvez également gérer les erreurs ici en cas d'échec de l'inscription
// if ($nouvelUtilisateur instanceof \App\metier\Alumni) {
// // L'inscription a réussi, redirigez l'utilisateur vers une page de confirmation
// // par exemple :
// =======
if ($nouvelUtilisateur instanceof \App\metier\Alumni) { if ($nouvelUtilisateur instanceof \App\metier\Alumni) {
header('Location: index.php?action=inscription_success'); header('Location: index.php?action=inscription_success');
exit(); exit();
@ -165,17 +144,25 @@ class UtilisateurControleur
//TODO //TODO
} }
/**
* @return void
* @brief Affiche la liste des offres d'emploi
*/
protected function consultOffers() protected function consultOffers()
{ {
$offerMdl = new OffreModele();
global $twig; global $twig;
$niveauEtudes=null; $niveauEtudes=null;
$typeContrat=null; $typeContrat=null;
$exp = null; $exp = null;
// number of offers by pages
$nbOffers = 5 ; $nbOffers = 5 ;
/** validation of entry's : */
if(isset($_GET["niveauEtudes"]) && Validation::validateTypeStudies($_GET["niveauEtudes"])) { if(isset($_GET["niveauEtudes"]) && Validation::validateTypeStudies($_GET["niveauEtudes"])) {
$niveauEtudes = $_GET["niveauEtudes"]; $niveauEtudes = $_GET["niveauEtudes"];
} }
@ -189,26 +176,30 @@ class UtilisateurControleur
} }
if ($niveauEtudes == null && $typeContrat == null && $exp == null) { if ($niveauEtudes == null && $typeContrat == null && $exp == null) {
$totalOffers = $offerMdl->getNbOffers(); $totalOffers = $this->userModel->getNbOffers();
} else { } else {
$params = array( $params = array(
'typeContrat' => $typeContrat, 'typeContrat' => $typeContrat,
'exp' => $exp, 'exp' => $exp,
'niveauEtudes' => $niveauEtudes, 'niveauEtudes' => $niveauEtudes,
); );
$offers = $offerMdl->getOffersWithFilters($params); $offers = $this->userModel->getOffersWithFilters($params);
$totalOffers = count($offers); $totalOffers = count($offers);
} }
// get the current pages to display
$numberPages = ceil($totalOffers / 5); $numberPages = ceil($totalOffers / 5);
if($numberPages == 0 ) if($numberPages == 0 )
{ {
echo $twig->render("erreur.html",['dVueErreur' => ['Aucune Offre Trouvée']]); echo $twig->render("OffersList.html",['dVueErreur' => ['Aucune Offre Trouvée']]);
return; return;
} }
// validate the page number
if (isset($_GET["page"]) && intval($_GET["page"]) != null) { if (isset($_GET["page"]) && intval($_GET["page"]) != null) {
$page = intval($_GET["page"]); $page = intval($_GET["page"]);
if ($page > $numberPages || $page < 1) { if ($page > $numberPages || $page < 1) {
@ -220,16 +211,19 @@ class UtilisateurControleur
$page = 1; $page = 1;
} }
$start = intval(($page - 1) * 5); $start = intval(($page - 1) * 5);
if ($niveauEtudes == null && $typeContrat == null && $exp == null) { if ($niveauEtudes == null && $typeContrat == null && $exp == null) {
$offers = $offerMdl->getOfferLimit($start, $nbOffers); $offers = $this->userModel->getOfferLimit($start, $nbOffers);
} else { } else {
$params['start'] = $start; $params['start'] = $start;
$params['nbOffers'] = 5; $params['nbOffers'] = 5;
$offers = $offerMdl->getOffersWithFilters($params); $offers = $this->userModel->getOffersWithFilters($params);
} }
/* echo "filtre :".$niveauEtudes."<br>"; /* echo "filtre :".$niveauEtudes."<br>";
echo "filtre :".$typeContrat."<br>"; echo "filtre :".$typeContrat."<br>";
echo "filtre :".$exp."<br>";*/ echo "filtre :".$exp."<br>";*/
@ -247,12 +241,18 @@ class UtilisateurControleur
]); ]);
} }
// display the form to create an offer
protected function createOfferForm() protected function createOfferForm()
{ {
global $twig; global $twig;
echo $twig->render("CreerOffre.html", []); echo $twig->render("CreerOffre.html", []);
} }
// create offer
protected function createOffer() protected function createOffer()
{ {
global $twig; global $twig;
@ -260,6 +260,8 @@ class UtilisateurControleur
$requiredFields = ['name', 'entreprise', 'description','typeContrat', 'descriptPoste', 'profilRecherche', 'choixExp', 'education', 'mail', 'num']; $requiredFields = ['name', 'entreprise', 'description','typeContrat', 'descriptPoste', 'profilRecherche', 'choixExp', 'education', 'mail', 'num'];
// validate required fields
$error = false; $error = false;
foreach ($requiredFields as $field) { foreach ($requiredFields as $field) {
if (empty($_POST[$field])) { if (empty($_POST[$field])) {
@ -273,6 +275,8 @@ class UtilisateurControleur
return; return;
} }
// validate entrys
if(!Validation::verifierEmail($_POST["mail"])) if(!Validation::verifierEmail($_POST["mail"]))
{ {
//echo $twig->render("CreerOffre.html", ['errMsg' => "Email non valide !" ]); //echo $twig->render("CreerOffre.html", ['errMsg' => "Email non valide !" ]);
@ -297,6 +301,8 @@ class UtilisateurControleur
return; return;
} }
// if errors display the form with errors
if(count($taberror) > 0) if(count($taberror) > 0)
{ {
echo $twig->render("CreerOffre.html", ['tabError' => $taberror ]); echo $twig->render("CreerOffre.html", ['tabError' => $taberror ]);
@ -306,10 +312,8 @@ class UtilisateurControleur
$saveImg1 = ImageSaver::SaveImage("image"); $saveImg1 = ImageSaver::SaveImage("image");
$saveImg2 = ImageSaver::SaveImage("logo"); $saveImg2 = ImageSaver::SaveImage("logo");
if($saveImg1[0] && $saveImg2[0]) { if($saveImg1[0] && $saveImg2[0]) {
$offreMdl = new OffreModele();
$offre = $this->userModel->publishOffer($saveImg1[1], $saveImg2[1]);
$offre = $offreMdl->publishOffer($saveImg1[1], $saveImg2[1]);
echo $twig->render("OffreDetailTest.html", ['offre' => $offre]); echo $twig->render("OffreDetailTest.html", ['offre' => $offre]);
} }
@ -321,14 +325,14 @@ class UtilisateurControleur
} }
} }
// display offers
public function displayOffer() public function displayOffer()
{ {
global $twig; global $twig;
if (isset($_GET["id"]) && intval($_GET["id"]) != null) if (isset($_GET["id"]) && intval($_GET["id"]) != null)
{ {
$offreMdl = new OffreModele(); $offre = $this->userModel->getOfferFromId(intval($_GET["id"]));
$offre = $offreMdl->getOfferFromId(intval($_GET["id"]));
if($offre != NULL) if($offre != NULL)
{ {
echo $twig->render("OffreDetailTest.html",['offre' => $offre]); echo $twig->render("OffreDetailTest.html",['offre' => $offre]);
@ -339,65 +343,4 @@ class UtilisateurControleur
echo $twig->render("erreur.html", ['dVueErreur' => $dVueErreur]); echo $twig->render("erreur.html", ['dVueErreur' => $dVueErreur]);
} }
protected function listerEvenement()
{
$mdl = new UtilisateurModele();
$evenements = $mdl->getEvenement();
global $twig;
echo $twig->render('evenement.html', ['evenements' => $evenements]);
}
protected function creerEvenement()
{
global $twig;
if (isset($_FILES["image"])) {
$img = ImageSaver::SaveImage('image');
if (!Validation::validerEvenement($_POST["titre"], $_POST["description"], $_POST["date"], $_POST["nbPlaceMax"], $img[1])) {
$mdl = new UtilisateurModele();
$mdl->ajouterEvenement($_POST["titre"], $_POST["description"], $_POST["date"], $_POST["nbPlaceMax"], $img[1]);
$this->listerEvenement();
} 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', []);
}
}
protected function supprimerEvenement()
{
$mdl = new UtilisateurModele();
$mdl->deleteEvenement($_GET["id"]);
$this->listerEvenement();
}
protected function avoirDetailEvenement()
{
$mdl = new UtilisateurModele();
$evenement = $mdl->getEvenementById($_GET["id"]);
global $twig;
echo $twig->render('detailEvenement.html', ['evenement' => $evenement]);
}
protected function rechercherEvenement()
{
$mdl = new UtilisateurModele();
$evenements = $mdl->getEvenement();
if(isset($_POST["recherche"]) AND !empty($_POST["recherche"]))
{
$recherche = Validation::nettoyerString($_POST["recherche"]);
$evenements = $mdl->getEvenementByTitre($recherche);
}
global $twig;
echo $twig->render('evenement.html', ['evenements' => $evenements]);
}
} }

@ -4,8 +4,6 @@ use PDO;
use App\metier\Alumni; use App\metier\Alumni;
use App\metier\Role; use App\metier\Role;
use App\metier\Alumni;
class AlumniGateway class AlumniGateway
{ {
private \App\gateway\Connection $con; private \App\gateway\Connection $con;

@ -1,74 +0,0 @@
<?php
namespace App\gateway;
use App\metier\Image;
use PDO;
class ImageGateway
{
private Connection $con;
/**
* @param $con
*/
public function __construct(Connection $con)
{
$this->con = $con;
}
public function insertImage(Image $img)
{
$query = "INSERT INTO Image (`nom`, `taille`, `type`, `blob`) VALUES ( :n, :t, :ty, :b)";
$this->con->executeQuery($query, array(
':n' => array($img->getName(), PDO::PARAM_STR),
':t' => array($img->getTaille(), PDO::PARAM_STR),
':ty' => array($img->getType(), PDO::PARAM_STR),
':b' => array($img->getBlob(), PDO::PARAM_STR)
));
}
public function delete(int $id)
{
$query = 'DELETE FROM Image WHERE id=:i';
$this->con->executeQuery($query, array(
':i' => array($id, PDO::PARAM_INT)
));
}
public function getFromId(int $id) : array
{
$query = 'SELECT * FROM Image WHERE id=:i';
$this->con->executeQuery($query, array(
':i' => array($id, PDO::PARAM_INT)
));
return $this->con->getResults();
}
public function getNewId() : int
{
$query = 'SELECT MAX(id) FROM Image';
$this->con->executeQuery($query);
$res = $this->con->getResults();
if ($res[0]['MAX(id)'] === null) {
return 1;
}
return intval($res[0]['MAX(id)'])+1;
}
public function obtenirToutesImages()
{
$query = 'SELECT * FROM Image';
$this->con->executeQuery($query);
$res = $this->con->getResults();
$array = [];
foreach ($res as $r) {
$array[] = new Image($this->getNewId(),$r['nom'], $r['taille'], $r['type'], $r['blob']);
}
return $array;
}
}
?>

@ -14,12 +14,25 @@ class ImageSaver
try { try {
$return = []; $return = [];
$name = substr($_FILES[$filename]["name"], 0, 45); $originalName = $_FILES[$filename]["name"];
$name = substr($originalName, 0, 45);
$name = self::getId() . $name; $name = self::getId() . $name;
move_uploaded_file($_FILES[$filename]['tmp_name'], "../public/uploads/$name"); $uploadDir = "public/uploads/";
$targetPath = $uploadDir . $name;
$counter = 1;
while (file_exists($targetPath)) {
$name = self::getId() . $counter . $originalName;
$targetPath = $uploadDir . $name;
$counter++;
}
move_uploaded_file($_FILES[$filename]['tmp_name'], $targetPath);
$return[] = true; $return[] = true;
$return[] = $name; $return[] = $name;
return $return; return $return;
} catch (\Exception $e) { } catch (\Exception $e) {
$return[] = false; $return[] = false;
@ -27,4 +40,5 @@ class ImageSaver
return $return; return $return;
} }
} }
} }

@ -1,63 +0,0 @@
<?php
namespace App\metier;
class Image
{
private int $id;
private string $name;
private string $taille;
private string $type;
private string $blob;
/**
* @param int $id
* @param string $name
* @param string $taille
* @param string $type
* @param string $blob
*/
public function __construct(int $id, string $name, string $taille, string $type, string $blob)
{
$this->id = $id;
$this->name = $name;
$this->taille = $taille;
$this->type = $type;
$this->blob = $blob;
}
public function getName(): string
{
return $this->name;
}
public function getTaille(): string
{
return $this->taille;
}
public function getType(): string
{
return $this->type;
}
public function getBlob(): string
{
return $this->blob;
}
public function getId() : string
{
return $this->id;
}
public function toString() : string {
return "Image : " . $this->name . " " . $this->taille . " " . $this->type . " blob " . $this->blob;
}
}

@ -2,9 +2,20 @@
namespace App\modele; namespace App\modele;
use App\gateway\Connection;
use App\gateway\OffreGateway;
use App\metier\Alumni;
use App\metier\Offre;
class MembreModele extends UtilisateurModele class MembreModele extends UtilisateurModele
{ {
private OffreGateway $offreGw;
public function __construct()
{
$this->offreGw = new OffreGateway(new Connection("mysql:host=localhost;dbname=dbAlica", "Dev", "Dev"));
}
/** /**
* @description modifier photo de profil * @description modifier photo de profil
@ -15,6 +26,8 @@ class MembreModele extends UtilisateurModele
return false; return false;
} }
/** /**
* @description ajouter formation * @description ajouter formation
*/ */
@ -62,6 +75,53 @@ class MembreModele extends UtilisateurModele
// TO DO // TO DO
return false; return false;
} }
public function publishOffer(string $img,string $logo)
{
$desc = $_POST["description"];
$descposte = $_POST["descriptPoste"];
$nom = $_POST["name"];
$ville = $_POST["ville"];
$entreprise = $_POST["entreprise"];
$profilRecherche = $_POST["profilRecherche"];
$mail = $_POST["mail"];
$num = $_POST["num"];
$site = $_POST["site"];
$exp = $_POST["choixExp"];
$typeContrat = $_POST["typeContrat"];
$niveauEtudes = $_POST["education"];
$date = new \DateTime();
if(isset($_POST["fullRemote"]))
{
$remote = true;
}
else $remote = false;
// à la place de NULL passer id utilisateur créateur offre
$offre = new Offre($this->offreGw->getNewId(),
new Alumni("test.mail@icloud.fr","password","admin","prenom","nom"),
$nom,
$desc,
$img,
$logo,
$typeContrat,
$ville,
$entreprise,
$descposte,
$profilRecherche,
$exp,
$niveauEtudes,
$mail,
$num,
$site,
$remote,
$date);
$this->offreGw->addOffers($offre);
return $offre;
}

@ -1,18 +1,29 @@
<?php <?php
namespace App\modele; namespace App\modele;
use App\gateway\AlumniGateway;
use App\gateway\Connection; use App\gateway\Connection;
use App\gateway\EvenementGateway; use App\gateway\OffreGateway;
use App\metier\Evenement; use App\gateway\ProfilGateway;
use App\metier\Alumni;
use App\metier\Offre;
class UtilisateurModele class UtilisateurModele
{ {
private $con; /**
* @description Charger le flux d'activiter
* @return array flux
*/
public function LoadFeed() : array
{
// TO DO
return [];
}
private OffreGateway $offreGw;
public function __construct() public function __construct()
{ {
$this->con = new Connection(DB_HOST,DB_USER,DB_PASS); $this->offreGw = new OffreGateway(new Connection("mysql:host=localhost;dbname=dbAlica", "Dev", "Dev"));
} }
/** /**
@ -60,6 +71,14 @@ class UtilisateurModele
$profilGate = new \App\gateway\ProfilGateway($con); $profilGate = new \App\gateway\ProfilGateway($con);
// Insérez le nouvel utilisateur dans la base de données en utilisant AlumniGateway // Insérez le nouvel utilisateur dans la base de données en utilisant AlumniGateway
if ($gate->insert($email, $hashpassword, $role)) { if ($gate->insert($email, $hashpassword, $role)) {
// <<<<<<< HEAD
// // L'insertion a réussi, retournez le nouvel utilisateur
// $nouvelUtilisateur = new \App\metier\Alumni($email, $hashpassword, $role);
// return $nouvelUtilisateur;
// } else {
// // L'insertion a échoué, renvoyez un utilisateur vide pour indiquer l'échec
// return new \App\metier\Alumni(null, null, null);
// =======
$alumni = $gate->getID($email); $alumni = $gate->getID($email);
if($profilGate->insert($alumni,$nom, $prenom,$email)){ if($profilGate->insert($alumni,$nom, $prenom,$email)){
// L'insertion a réussi, retournez le nouvel utilisateur // L'insertion a réussi, retournez le nouvel utilisateur
@ -88,92 +107,129 @@ class UtilisateurModele
} }
} }
public function getEvenement() : array public function getOffers() : array
{ {
$gate = new EvenementGateway($this->con); $res = $this->offreGw->getOffers();
$offers = $this->CreateOffersFromGw($res);
return $offers;
}
$data = $gate->getAllEvenement(); public function getOfferFromId(int $id) : ?Offre
{
$res = $this->offreGw->getOfferFromId($id);
if($res != null)
return $this->CreateOffersFromGw($res)[0];
return null;
}
$evenement = array(); public function CreateOffersFromGw($res) : array
{
$alGw = new AlumniGateway(new Connection("mysql:host=localhost;dbname=dbAlica", "test", "test"));
foreach($data as $row) $offers=[];
foreach ($res as $row)
{ {
$evenement[] = new Evenement( $resal = $alGw->ObtenirById($row['offreur']);
$profilGw = new ProfilGateway(new Connection("mysql:host=localhost;dbname=dbAlica", "Dev", "Dev"));
$resProfl = $profilGw->getProfilById($row['offreur']);
$alumni = new Alumni($resal[0]['mail'],$resal[0]['mdp'],$resal[0]['role'],$resProfl[0]['nom'],$resProfl[0]["prenom"]);
$date = \DateTime::createFromFormat('Y-m-d', $row['date']);
$offers[]=new Offre(
$row['id'], $row['id'],
$row['organisateur'], $alumni,
$row['titre'], $row['titre'],
$row['description'], $row['description'],
$row['date'], $row["image"],
$row['nbPlaceMax'], $row["logo"],
$row['image'] $row['typeContrat'],
); $row['ville'],
$row["entreprise"],
$row['descriptifPoste'],
$row['profil'],
$row['experience'],
$row['niveauEtudes'],
$row['mailContact'],
$row['numero'],
$row['websiteURL'],
$row['remote'],
$date);
} }
return $evenement;
}
public function ajouterEvenement(string $titre, string $description, string $date, int $nbPlaceMax, string $img)
{
$gate = new EvenementGateway($this->con);
$evenement = new Evenement(
$gate->getNewId(),
'1', //TODO : Ajouter l'ID de l'admin connecté
$titre,
$description,
$date,
$nbPlaceMax,
$img
);
$gate->insertEvenement($evenement); return $offers;
} }
public function deleteEvenement(int $id) public function getOfferLimit($start, $nbOffers): array
{ {
$gate = new EvenementGateway($this->con); $res = $this->offreGw->getOfferLimit($start, $nbOffers);
$gate->deleteEvenement($id); return $this->CreateOffersFromGw($res);
} }
public function getEvenementById(int $id) : Evenement public function getNbOffers() : int
{ {
$gate = new EvenementGateway($this->con); return $this->offreGw->getNbOffers();
}
$data = $gate->findById($id);
$evenement = new Evenement(
$data[0]['id'],
$data[0]['organisateur'],
$data[0]['titre'],
$data[0]['description'],
$data[0]['date'],
$data[0]['nbPlaceMax'],
$data[0]['image']
);
return $evenement; public function getOffersWithFilters($params) : array
{
return $this->offreGw->getOffersWithFilters($params);
} }
public function getEvenementByTitre(string $titre) : array
public function publishOffer(string $img,string $logo)
{ {
$gate = new EvenementGateway($this->con); $desc = $_POST["description"];
$descposte = $_POST["descriptPoste"];
$nom = $_POST["name"];
$ville = $_POST["ville"];
$entreprise = $_POST["entreprise"];
$profilRecherche = $_POST["profilRecherche"];
$mail = $_POST["mail"];
$num = $_POST["num"];
$site = $_POST["site"];
$exp = $_POST["choixExp"];
$typeContrat = $_POST["typeContrat"];
$niveauEtudes = $_POST["education"];
$date = new \DateTime();
if(isset($_POST["fullRemote"]))
{
$remote = true;
}
else $remote = false;
$data = $gate->findByTitle($titre); // à la place de NULL passer id utilisateur créateur offre
$offre = new Offre($this->offreGw->getNewId(),
new Alumni("test.mail@icloud.fr","password","admin","prenom","nom"),
$nom,
$desc,
$img,
$logo,
$typeContrat,
$ville,
$entreprise,
$descposte,
$profilRecherche,
$exp,
$niveauEtudes,
$mail,
$num,
$site,
$remote,
$date);
$evenement = array(); $this->offreGw->addOffers($offre);
foreach($data as $row) return $offre;
{
$evenement[] = new Evenement(
$row['id'],
$row['organisateur'],
$row['titre'],
$row['description'],
$row['date'],
$row['nbPlaceMax'],
$row['image']
);
} }
return $evenement;
}
} }

@ -5,7 +5,7 @@
<title>Alica - Offres</title> <title>Alica - Offres</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link rel="stylesheet" href="css/offres.css"> <link rel="stylesheet" href="public/css/offres.css">
</head> </head>
<body> <body>
<header> <header>
@ -14,13 +14,13 @@
<div class="container mt-4 d-flex align-content-center "> <div class="container mt-4 d-flex align-content-center ">
<div> <div>
<a href="index.php?action=createOfferForm" type="button" class="btn btn-outline-success mb-4">Publier une offre</a> <a href="?action=createOfferForm" type="button" class="btn btn-outline-success mb-4">Publier une offre</a>
</div> </div>
<div class="container mt-4"> <div class="container mt-4">
<div class="d-flex flex-column align-items-center"> <div class="d-flex flex-column align-items-center">
<form action="index.php" method="get" class="form-inline flex-wrap mb-4"> <form action="?consultOffer" method="get" class="form-inline flex-wrap mb-4">
<h2 class="mr-3">Filtrer les offres</h2> <h2 class="mr-3">Filtrer les offres</h2>
<div class="form-group mr-3 flex-column justify-content-left"> <div class="form-group mr-3 flex-column justify-content-left">
@ -79,7 +79,7 @@
</div> </div>
<div> <div>
<a href="index.php?action=consultOffers" class="btn btn-info">Réinitialiser les filtres</a> <a href="?action=consultOffers" class="btn btn-info">Réinitialiser les filtres</a>
</div> </div>
</div> </div>
@ -87,13 +87,19 @@
<h1 id="titrePrincipal">Offres d'emploi</h1> <h1 id="titrePrincipal">Offres d'emploi</h1>
{% if dVueErreur is defined %}
{% for value in dVueErreur %}
<p>{{value}}</p>
{% endfor %}
{% endif %}
<div class="col-md-8 offset-md-2"> <div class="col-md-8 offset-md-2">
{% for offre in offres %} {% for offre in offres %}
<article class="mb-4"> <article class="mb-4">
<div class="row1"> <div class="row1">
<img src="uploads/{{offre.getLogo()}}" class="img-fluid rounded" alt="logo"> <!-- Ajoutez la classe "rounded" pour arrondir les coins --> <img src="public/uploads/{{offre.getLogo()}}" class="img-fluid rounded" alt="logo"> <!-- Ajoutez la classe "rounded" pour arrondir les coins -->
<h4>{{ offre.getNom() }}</h4> <h4>{{ offre.getNom() }}</h4>
</div> </div>
<div class="row2"> <div class="row2">
@ -102,11 +108,11 @@
</div> </div>
<div class="row3"> <div class="row3">
<img src="assets/location.png" alt="location"> <img src="public/assets/location.png" alt="location">
<p>{{offre.getVille()}}</p> <p>{{offre.getVille()}}</p>
</div> </div>
<button type="button" class="btn btn-outline-primary btn-sm mb-2 custom-button" <button type="button" class="btn btn-outline-primary btn-sm mb-2 custom-button"
onclick="window.location.href = 'index.php?action=displayOffer&id={{offre.getId()}}';">En savoir plus > onclick="window.location.href = '?action=displayOffer&id={{offre.getId()}}';">En savoir plus >
</button> </button>
</article> </article>
@ -121,9 +127,9 @@
<!-- <!--
index.php?action=consultOffers&page={{ i }}&typeContrat={{ typeContrat }}&experience={{ experience }}&niveauEtudes={{ niveauEtudes }} index.php?action=consultOffers&page={{ i }}&typeContrat={{ typeContrat }}&experience={{ experience }}&niveauEtudes={{ niveauEtudes }}
--> -->
<a href="index.php?action=consultOffers&page={{ i }}&{{valContrat}}{{valExp}}{{ValEtudes}}" class="active bg-danger">{{ i }}</a> <a href="?action=consultOffers&page={{ i }}&{{valContrat}}{{valExp}}{{ValEtudes}}" class="active bg-danger">{{ i }}</a>
{% else %} {% else %}
<a href="index.php?action=consultOffers&page={{ i }}&{{valContrat}}{{valExp}}{{ValEtudes}}">{{ i }}</a> <a href="?action=consultOffers&page={{ i }}&{{valContrat}}{{valExp}}{{ValEtudes}}">{{ i }}</a>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}

@ -17,8 +17,8 @@
<ul class="list-group"> <ul class="list-group">
<!-- Add an image related to the offer --> <!-- Add an image related to the offer -->
<li class="list-group-item"></li><img src="uploads/{{offre.getLogo()}}" alt="Logo" class="img-thumbnail" style="max-height: 50px; max-width: 50px;"</li> <li class="list-group-item"></li><img src="public/uploads/{{offre.getLogo()}}" alt="Logo" class="img-thumbnail" style="max-height: 50px; max-width: 50px;"</li>
<li class="list-group-item"><img src="uploads/{{offre.getImg()}}" alt="Offer Image" class="img-fluid"></li> <li class="list-group-item"><img src="public/uploads/{{offre.getImg()}}" alt="Offer Image" class="img-fluid"></li>
<!--<li class="list-group-item"><strong>ID:</strong> {{ offre.getId() }}</li> --> <!--<li class="list-group-item"><strong>ID:</strong> {{ offre.getId() }}</li> -->
<li class="list-group-item"><strong>Offreur:</strong> {{ offre.getOffreur().getNom() }}</li> <li class="list-group-item"><strong>Offreur:</strong> {{ offre.getOffreur().getNom() }}</li>
<li class="list-group-item"><strong>Nom de l'offre:</strong> {{ offre.getNom() }}</li> <li class="list-group-item"><strong>Nom de l'offre:</strong> {{ offre.getNom() }}</li>
@ -37,7 +37,7 @@
<li class="list-group-item"> <li class="list-group-item">
<strong>Full Remote :</strong> <strong>Full Remote :</strong>
{% if offre.isRemote() %} {% if offre.isRemote() %}
Oui
{% else %} {% else %}
Non Non
{% endif %} {% endif %}

@ -3,7 +3,7 @@
<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" />
<link rel="stylesheet" type="text/css" href="css/accueil.css"> <link rel="stylesheet" type="text/css" href="/css/accueil.css">
<title>Alica - Accueil</title> <title>Alica - Accueil</title>
</head> </head>

@ -4,7 +4,7 @@
<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" />
<title>Alica - Connexion</title> <title>Alica - Connexion</title>
<link rel="stylesheet" type="text/css" href="../public/css/connexion.css"> <link rel="stylesheet" type="text/css" href="public/css/connexion.css">
</head> </head>
<body> <body>
<div class="container"> <div class="container">
@ -37,7 +37,7 @@
</form> </form>
<div class="CadreInput"> <div class="CadreInput">
<div class="box"> <div class="box">
<form action="../public/index.php?action=inscription" method="POST"> <form action="/?action=inscription" method="POST">
<input type="submit" class="other" value="S'inscrire"> <input type="submit" class="other" value="S'inscrire">
</form> </form>
</div> </div>

@ -3,7 +3,7 @@
<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" />
<link rel="stylesheet" type="text/css" href="../public/css/erreur.css"> <link rel="stylesheet" type="text/css" href="public/css/erreur.css">
<title>Alica - Erreur</title> <title>Alica - Erreur</title>
</head> </head>
@ -21,8 +21,6 @@
<p>{{value}}</p> <p>{{value}}</p>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
<form action="../public/index.php" method="POST"> <a href=".">Retourner à l'accueil<a/>
<input type="submit" value="Retourner à l'accueil">
</form>
</body> </body>
</html> </html>

@ -4,7 +4,7 @@
<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" />
<title>Alica - Inscription</title> <title>Alica - Inscription</title>
<link rel="stylesheet" type="text/css" href="../public/css/inscription.css"> <link rel="stylesheet" type="text/css" href="public/css/inscription.css">
</head> </head>
<body> <body>
<div class="container"> <div class="container">
@ -62,7 +62,7 @@
</form> </form>
<div class="CadreInput"> <div class="CadreInput">
<div class="box"> <div class="box">
<form action="../public/index.php?action=connection" method="POST"> <form action="/?action=connection" method="POST">
<input class="other" type="submit" value="Se connecter"> <input class="other" type="submit" value="Se connecter">
</form> </form>
</div> </div>

@ -15,7 +15,7 @@
</div> </div>
<script> <script>
setTimeout(function () { setTimeout(function () {
window.location.href = "../public/index.php?action=connection"; window.location.href = "../index.php";
}, 5000); }, 5000);
</script> </script>

@ -1,13 +1,13 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="fr"> <html lang="fr">
<head> <head>
<link rel="stylesheet" type="text/css" href="css/menu.css"> <link rel="stylesheet" type="text/css" href="public/css/menu.css">
</head> </head>
<nav class="navbar-container"> <nav class="navbar-container">
<div class="logo-container"> <div class="logo-container">
<a href="index.php"> <a href=".">
<img src="assets/logo.png" alt="Logo" height="70px"> <img src="public/assets/logo.png" alt="Logo" height="70px">
</a> </a>
</div> </div>
<div class="bars"> <div class="bars">
@ -19,18 +19,18 @@
<li class="nav-link"><a href="#">A propos</a></li> <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="#">Evenements</a></li>
<li class="nav-link"><a href="index.php?action=consultOffers">Offres</a></li> <li class="nav-link"><a href="?action=consultOffers">Offres</a></li>
<li class="nav-link"><a href="#">Nous contacter</a></li> <li class="nav-link"><a href="#">Nous contacter</a></li>
</ul> </ul>
<ul class="nav-items"> <ul class="nav-items">
<!-- Afficher boutons de connexion et d'inscription --> <!-- Afficher boutons de connexion et d'inscription -->
{% if nom and prenom %} {% if nom and prenom %}
<!-- Afficher bouton de déconnexion --> <!-- Afficher bouton de déconnexion -->
<a href="index.php?action=deconnexion" class="button">Déconnexion</a> <a href="../?action=deconnexion" class="button">Déconnexion</a>
{% else %} {% else %}
<div class="login-register"> <div class="login-register">
<a href="index.php?action=connection" class="button">Connexion</a> <a href="/?action=connection" class="button">Connexion</a>
<a href="index.php?action=inscription" class="button button2">Inscription</a> <a href="/?action=inscription" class="button button2">Inscription</a>
</div> </div>
{% endif %} {% endif %}

@ -12,9 +12,9 @@
</header> </header>
<div id="titleDiv" class="jumbotron text-center"> <div id="titleDiv" class="jumbotron text-center">
<img src="assets/michelin.png" alt="Logo" height="70px"> <img src="public/assets/michelin.png" alt="Logo" height="70px">
<h1>Developpeur Fullstack</h1> <h1>Developpeur Fullstack</h1>
<img src="assets/location.png"> <img src="public/assets/location.png">
<p>Paris</p> <p>Paris</p>
<div id="key" class="row justify-content-center"> <div id="key" class="row justify-content-center">

Loading…
Cancel
Save