offres2
Baptiste D 1 year ago
commit ef93699a64

@ -39,10 +39,7 @@ a {
padding: 10px;
text-transform: uppercase;
transition: 0.2s;
<<<<<<< HEAD
text-decoration: none;
=======
>>>>>>> master
}
.navbar-container .nav-items .nav-link:after {
@ -69,21 +66,14 @@ a {
text-transform: uppercase;
border-radius: 15px;
border: #fff 2px solid;
<<<<<<< HEAD
text-decoration: none;
=======
>>>>>>> master
}
.navbar-container .nav-items .login-register .button2{
background: #00DBFF;
color: #fff;
border-radius: 15px;
<<<<<<< HEAD
text-decoration: none;
=======
>>>>>>> master
}
.navbar-container .nav-items .login-register .button:hover {

@ -6,13 +6,9 @@ $rep = __DIR__ . '/php/';
// liste des modules à inclure
$dConfig['includes']= array('controleur/Validation.php');
//BD
$base = 'mysql:host=localhost;dbname=dbAlica';
$login = 'test';
$mdp = 'test';
static $OffersByPage = 5;
// Variables connexion à la base : à modifier en fonction de la base de chacun
define('DB_HOST', 'mysql:host=localhost;dbname=dbAlica');
define('DB_USER', 'Dev');
define('DB_PASS', 'Dev');

@ -0,0 +1,52 @@
<?php
namespace App\modele;
use App\gateway\Connection;
use App\metier\Image;
use App\gateway\ImageGateway;
class ImageModele
{
private ImageGateway $gw;
public function __construct()
{
$this->gw = new ImageGateway(new Connection(DB_HOST,DB_USER,DB_PASS));
}
public function publierImage(string $file) : Image
{
$img = new Image($this->gw->getNewId(),
$_FILES[$file]["name"],
$_FILES[$file]["size"],
$_FILES[$file]["type"],
file_get_contents($_FILES[$file]["tmp_name"]));
$this->insertImage($img);
return $img;
}
public function insertImage(Image $img)
{
$this->gw->insertImage($img);
}
public function obtenirParId(int $id)
{
$this->gw->getFromId($id);
$res = $this->gw->getResults();
return new Image($this->gw->getNewId(),$res[0]['nom'], $res[0]['taille'], $res[0]['type'], $res[0]['blob']);
}
public function obtenirToutesImages() : array
{
$this->gw->obtenirToutesImages();
$res = $this->gw->getResults();
foreach ($res as $r) {
$array[] = new Image($this->gw->getNewId(),$r['nom'], $r['taille'], $r['type'], $r['blob']);
}
return $array;
}
}

@ -0,0 +1,145 @@
<?php
namespace App\modele;
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 App\metier\Offre;
use App\metier\Image;
use mysql_xdevapi\Exception;
class OffreModele
{
private OffreGateway $offreGw;
public function __construct()
{
$this->offreGw = new OffreGateway(new Connection(DB_HOST,DB_USER,DB_PASS));
}
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;
}
public function getOffers() : array
{
$res = $this->offreGw->getOffers();
$offers = $this->CreateOffersFromGw($res);
return $offers;
}
public function getOfferFromId(int $id) : ?Offre
{
$res = $this->offreGw->getOfferFromId($id);
if($res != null)
return $this->CreateOffersFromGw($res)[0];
return null;
}
public function CreateOffersFromGw($res) : array
{
$alGw = new AlumniGateway(new Connection(DB_HOST,DB_USER,DB_PASS));
$offers=[];
foreach ($res as $row)
{
$resal = $alGw->ObtenirById($row['offreur']);
$profilGw = new ProfilGateway(new Connection(DB_HOST,DB_USER,DB_PASS));
$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'],
$alumni,
$row['titre'],
$row['description'],
$row["image"],
$row["logo"],
$row['typeContrat'],
$row['ville'],
$row["entreprise"],
$row['descriptifPoste'],
$row['profil'],
$row['experience'],
$row['niveauEtudes'],
$row['mailContact'],
$row['numero'],
$row['websiteURL'],
$row['remote'],
$date);
}
return $offers;
}
public function getOfferLimit($start, $nbOffers): array
{
$res = $this->offreGw->getOfferLimit($start, $nbOffers);
return $this->CreateOffersFromGw($res);
}
public function getNbOffers() : int
{
return $this->offreGw->getNbOffers();
}
public function getOffersWithFilters($params) : array
{
return $this->offreGw->getOffersWithFilters($params);
}
}

@ -35,11 +35,7 @@ class UtilisateurModele
public function connection(string $email, string $mdp) : ? \App\metier\Alumni
{
$dsn = "mysql:host=localhost;dbname=dbAlica";
$username = "Dev";
$password = "Dev";
$con = new \App\gateway\Connection($dsn, $username, $password);
$con = new \App\gateway\Connection(DB_HOST,DB_USER,DB_PASS);
$gate = new \App\gateway\AlumniGateway($con);
// Récupérez l'utilisateur avec l'email donné en utilisant AlumniGateway
$utilisateur = $gate->findByEmail($email);
@ -69,12 +65,8 @@ class UtilisateurModele
public function inscription(string $prenom, string $nom,string $email, string $hashpassword):? \App\metier\Alumni
{
$dsn = "mysql:host=localhost;dbname=dbAlica";
$username = "test";
$password = "test";
$role = "Membre";
$con = new \App\gateway\Connection($dsn, $username, $password);
$con = new \App\gateway\Connection(DB_HOST,DB_USER,DB_PASS);
$gate = new \App\gateway\AlumniGateway($con);
$profilGate = new \App\gateway\ProfilGateway($con);
// Insérez le nouvel utilisateur dans la base de données en utilisant AlumniGateway
@ -102,11 +94,7 @@ class UtilisateurModele
public function getUtilisateurByEmail(string $email)
{
$dsn = "mysql:host=localhost;dbname=dbAlica";
$username = "Dev";
$password = "Dev";
$con = new \App\gateway\Connection($dsn, $username, $password);
$con = new \App\gateway\Connection(DB_HOST,DB_USER,DB_PASS);
$gate = new \App\gateway\AlumniGateway($con);
// Récupérez l'utilisateur avec l'email donné en utilisant AlumniGateway
$utilisateur = $gate->findByEmail($email);

Loading…
Cancel
Save