alexis-rendu
Baptiste D 1 year ago
parent a32a224099
commit 6aa6dabb26

@ -2,7 +2,7 @@
namespace App\controleur; namespace App\controleur;
use App\config\Validation; use App\config\Validation;
use App\gateway\ImageSaver; use App\gateway\ImageManager;
use App\modele\MembreModele; use App\modele\MembreModele;
class MembreControleur extends UtilisateurControleur class MembreControleur extends UtilisateurControleur
@ -69,8 +69,8 @@ class MembreControleur extends UtilisateurControleur
} }
else{ else{
$saveImg1 = ImageSaver::SaveImage("image"); $saveImg1 = ImageManager::SaveImage("image");
$saveImg2 = ImageSaver::SaveImage("logo"); $saveImg2 = ImageManager::SaveImage("logo");
if($saveImg1[0] && $saveImg2[0]) { if($saveImg1[0] && $saveImg2[0]) {
$mbrModel = new MembreModele(); $mbrModel = new MembreModele();
@ -92,7 +92,7 @@ class MembreControleur extends UtilisateurControleur
global $twig; global $twig;
if (isset($_FILES["image"])) { if (isset($_FILES["image"])) {
$img = ImageSaver::SaveImage('image'); $img = ImageManager::SaveImage('image');
if (!Validation::validerEvenement($_POST["titre"], $_POST["description"], $_POST["date"], $_POST["nbPlaceMax"], $img[1])) { if (!Validation::validerEvenement($_POST["titre"], $_POST["description"], $_POST["date"], $_POST["nbPlaceMax"], $img[1])) {
$mdl = new UtilisateurModele(); $mdl = new UtilisateurModele();

@ -3,7 +3,7 @@
namespace App\controleur; namespace App\controleur;
use App\config\Validation; use App\config\Validation;
use App\gateway\ImageSaver; use App\gateway\ImageManager;
use App\metier\Alumni; use App\metier\Alumni;
use App\modele\OffreModele; use App\modele\OffreModele;
use App\modele\UtilisateurModele; use App\modele\UtilisateurModele;

@ -1,7 +1,7 @@
<?php <?php
namespace App\gateway; namespace App\gateway;
class ImageSaver class ImageManager
{ {
public static function getId() : int public static function getId() : int
@ -27,4 +27,15 @@ class ImageSaver
return $return; return $return;
} }
} }
public function deleteImg(string $img) : bool
{
$path = "public/uploads/$img";
if (file_exists($path)) {
unlink($path);
return true;
} else {
return false;
}
}
} }

@ -136,5 +136,14 @@ class OffreGateway
return intval($res[0]['COUNT(*)']); return intval($res[0]['COUNT(*)']);
} }
public function deleteOffer($id)
{
$query = 'DELETE FROM OFFRE WHERE id=:i';
$this->con->executeQuery($query,array(
':i' => array($id,\PDO::PARAM_INT)
)
);
}
} }

@ -116,5 +116,10 @@ class MembreModele extends UtilisateurModele
} }
public function deleteOffer(Offre $o)
{
}
} }

@ -235,10 +235,6 @@ class UtilisateurModele
$profilGw = new ProfilGateway(new Connection(DB_HOST,DB_USER,DB_PASS)); $profilGw = new ProfilGateway(new Connection(DB_HOST,DB_USER,DB_PASS));
$resProfl = $profilGw->getProfilById($resal[0]['id']); $resProfl = $profilGw->getProfilById($resal[0]['id']);
echo
var_dump($resal);
$alumni = new Alumni(intval($resal[0]['id']),$resal[0]['mail'],$resal[0]['mdp'],$resal[0]['role'],$resProfl[0]['nom'],$resProfl[0]["prenom"]); $alumni = new Alumni(intval($resal[0]['id']),$resal[0]['mail'],$resal[0]['mdp'],$resal[0]['role'],$resProfl[0]['nom'],$resProfl[0]["prenom"]);
$date = \DateTime::createFromFormat('Y-m-d', $row['date']); $date = \DateTime::createFromFormat('Y-m-d', $row['date']);

Loading…
Cancel
Save