diff --git a/php/src/TwigExtensions.php b/php/src/TwigExtensions.php deleted file mode 100644 index 64fe288..0000000 --- a/php/src/TwigExtensions.php +++ /dev/null @@ -1,24 +0,0 @@ -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); - } - -} \ No newline at end of file