|
|
@ -1,20 +1,99 @@
|
|
|
|
<?php
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
namespace App\controleur;
|
|
|
|
namespace App\controleur;
|
|
|
|
|
|
|
|
use App\config\Validation;
|
|
|
|
|
|
|
|
use App\gateway\ImageSaver;
|
|
|
|
|
|
|
|
|
|
|
|
class MembreControleur extends UtilisateurControleur
|
|
|
|
class MembreControleur extends UtilisateurControleur
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public function __construct()
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected function deconnexion()
|
|
|
|
public function deconnexion()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
session_destroy();
|
|
|
|
session_destroy();
|
|
|
|
echo "on est passes ici";
|
|
|
|
echo "on est passes ici";
|
|
|
|
header('Location: index.php?action=accueil');
|
|
|
|
//header('Location: index.php?action=accueil');
|
|
|
|
|
|
|
|
global $twig;
|
|
|
|
|
|
|
|
$twig->render('accueil.html',[]);
|
|
|
|
exit();
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function createOfferForm()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
global $twig;
|
|
|
|
|
|
|
|
echo $twig->render("CreerOffre.html", []);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function createOffer()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
global $twig;
|
|
|
|
|
|
|
|
$taberror = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$requiredFields = ['name', 'entreprise', 'description','typeContrat', 'descriptPoste', 'profilRecherche', 'choixExp', 'education', 'mail', 'num'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$error = false;
|
|
|
|
|
|
|
|
foreach ($requiredFields as $field) {
|
|
|
|
|
|
|
|
if (empty($_POST[$field])) {
|
|
|
|
|
|
|
|
$error = true;
|
|
|
|
|
|
|
|
$taberror[] = "Le champ {$field} est requis !";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if($error)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
echo $twig->render("CreerOffre.html", ['tabError' => $taberror ]);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!Validation::verifierEmail($_POST["mail"]))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//echo $twig->render("CreerOffre.html", ['errMsg' => "Email non valide !" ]);
|
|
|
|
|
|
|
|
$taberror[] = "Email non valide !";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!Validation::validateNumber($_POST["num"]))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$taberror[] = "Numero non valide !";
|
|
|
|
|
|
|
|
//echo $twig->render("CreerOffre.html", ['errMsg' => "Numero non valide !" ]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!Validation::validateImage("image"))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(isset($_FILES['image']['name'])) {$taberror[] = "Image non valide !";}
|
|
|
|
|
|
|
|
else {$taberror[] = "Inserez une image !";}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!Validation::validateImage("logo")) {
|
|
|
|
|
|
|
|
if(isset($_FILES['logo']['name'])) {$taberror[] = "Logo non valide !";}
|
|
|
|
|
|
|
|
else {$taberror[] = "Inserez un logo !";}
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(count($taberror) > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
echo $twig->render("CreerOffre.html", ['tabError' => $taberror ]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
$saveImg1 = ImageSaver::SaveImage("image");
|
|
|
|
|
|
|
|
$saveImg2 = ImageSaver::SaveImage("logo");
|
|
|
|
|
|
|
|
if($saveImg1[0] && $saveImg2[0]) {
|
|
|
|
|
|
|
|
$mbrModel = new MembreModele();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$offre = $mbrModel->publishOffer($saveImg1[1], $saveImg2[1]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo $twig->render("OffreDetailTest.html", ['offre' => $offre]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$taberror[] = "Erreur lors de l'upload des images";
|
|
|
|
|
|
|
|
echo $twig->render("CreerOffre.html", ['tabError' => $taberror ]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected function proposerOffre()
|
|
|
|
protected function proposerOffre()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//TODO
|
|
|
|
//TODO
|
|
|
|