correction bug vue offres & ajout lien vers détail fonctionnel

offres2
Baptiste D 1 year ago
parent 3e12d5be53
commit e32653bace

@ -18,7 +18,7 @@ class UtilisateurControleur
global $twig; global $twig;
if (!isset($_REQUEST["action"])) { if (!isset($_REQUEST["action"])) {
//$action = NULL; //$action = NULL;
$action = "creerOffre"; $action = "consultOffers";
} else { } else {
$action = \App\config\Validation::nettoyerString($_REQUEST["action"]); $action = \App\config\Validation::nettoyerString($_REQUEST["action"]);
} }
@ -33,8 +33,8 @@ class UtilisateurControleur
case "inscription": case "inscription":
$this->inscription(); $this->inscription();
break; break;
case "consulterOffres": case "consultOffers":
$this->consulterOffres(); $this->consultOffers();
break; break;
case "consulterProfilLimite": case "consulterProfilLimite":
$this->consulterProfilLimite(); $this->consulterProfilLimite();
@ -103,15 +103,15 @@ class UtilisateurControleur
//TODO //TODO
} }
protected function consulterOffres() protected function consultOffers()
{ {
$offreMdl = new OffreModele(); $offerMdl = new OffreModele();
global $twig; global $twig;
$twig->addExtension(new TwigExtensions()); // Ajouter l'extension personnalisée à l'environnement Twig $twig->addExtension(new TwigExtensions()); // Ajouter l'extension personnalisée à l'environnement Twig
$offres = $offreMdl->getOffers(); $offers = $offerMdl->getOffers();
echo $twig->render('offreDetail.html', []);
//echo $twig->render('offres.html', ['offres' => $offres]); echo $twig->render('offres.html', ['offres' => $offers]);
} }
protected function creerOffre() protected function creerOffre()
@ -129,7 +129,7 @@ class UtilisateurControleur
} }
} }
if (isset($_FILES['image'])) { if (isset($_FILES['image'])) {
$typesMime = array('image/jpeg', 'image/png', 'image/gif', 'image/bmp'); $typesMime = array('image/jpeg', 'image/png', 'image/gif', 'image/bmp','image/webp');
$file = $_FILES['image']['tmp_name']; $file = $_FILES['image']['tmp_name'];
@ -178,6 +178,7 @@ class UtilisateurControleur
if($offre != NULL) if($offre != NULL)
{ {
echo $twig->render("OffreDetailTest.html",['offre' => $offre]); echo $twig->render("OffreDetailTest.html",['offre' => $offre]);
return;
} }
} }

@ -185,7 +185,7 @@ class Offre
return $this->description; return $this->description;
} }
public function getImgId(): int public function Id(): int
{ {
return $this->img->getId(); return $this->img->getId();
} }

@ -67,8 +67,8 @@ class OffreModele
public function getOffers() : array public function getOffers() : array
{ {
$res = $this->offreGw->getOffers(); $res = $this->offreGw->getOffers();
$offres[] = $this->CreateOffers($res); $offers = $this->CreateOffers($res);
return $offres; return $offers;
} }
@ -89,16 +89,16 @@ class OffreModele
$alGw = new AlumniGateway(new Connection("mysql:host=localhost;dbname=dbAlica", "test", "test")); $alGw = new AlumniGateway(new Connection("mysql:host=localhost;dbname=dbAlica", "test", "test"));
$imgGw = new ImageGateway(new Connection("mysql:host=localhost;dbname=dbAlica", "test", "test")); $imgGw = new ImageGateway(new Connection("mysql:host=localhost;dbname=dbAlica", "test", "test"));
$offres=[]; $offers=[];
foreach ($res as $row) foreach ($res as $row)
{ {
$res = $imgGw->obtenirParId($row['image']); $imgRaw = $imgGw->obtenirParId($row['image']);
$img = new Image(intval($res[0]["id"]),$res[0]['nom'], $res[0]['taille'], $res[0]['type'], $res[0]['blob']); $img = new Image(intval($imgRaw[0]["id"]),$imgRaw[0]['nom'], $imgRaw[0]['taille'], $imgRaw[0]['type'], $imgRaw[0]['blob']);
$resal = $alGw->ObtenirParId($row['offreur']); $resal = $alGw->ObtenirParId($row['offreur']);
$alumni = new Alumni($resal[0]['id'],$resal[0]['mail'],$resal[0]['mdp'],$resal[0]['role']); $alumni = new Alumni($resal[0]['id'],$resal[0]['mail'],$resal[0]['mdp'],$resal[0]['role']);
$offres[]=new Offre($row['id'], $offers[]=new Offre($row['id'],
$alumni, $alumni,
$row['titre'], $row['titre'],
$row['description'], $row['description'],
@ -115,7 +115,9 @@ class OffreModele
$row['websiteURL'], $row['websiteURL'],
$row['remote']); $row['remote']);
} }
return $offres;
return $offers;
} }

@ -64,7 +64,8 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<button type="button" class="btn btn-outline-primary btn-sm mb-2 custom-button">En savoir plus ></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 ></button>
</div> </div>
</div> </div>
</div> </div>

Loading…
Cancel
Save