|
|
@ -12,6 +12,8 @@ use App\modele\OffreModele;
|
|
|
|
use App\modele\ImageModele;
|
|
|
|
use App\modele\ImageModele;
|
|
|
|
use App\TwigExtensions;
|
|
|
|
use App\TwigExtensions;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use APp\config;
|
|
|
|
|
|
|
|
|
|
|
|
class UtilisateurControleur
|
|
|
|
class UtilisateurControleur
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
@ -20,7 +22,7 @@ class UtilisateurControleur
|
|
|
|
global $twig;
|
|
|
|
global $twig;
|
|
|
|
if (!isset($_REQUEST["action"])) {
|
|
|
|
if (!isset($_REQUEST["action"])) {
|
|
|
|
//$action = NULL;
|
|
|
|
//$action = NULL;
|
|
|
|
$action = "createOfferForm";
|
|
|
|
$action = "consultOffers";
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$action = \App\config\Validation::nettoyerString($_REQUEST["action"]);
|
|
|
|
$action = \App\config\Validation::nettoyerString($_REQUEST["action"]);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -113,10 +115,45 @@ class UtilisateurControleur
|
|
|
|
$offerMdl = new OffreModele();
|
|
|
|
$offerMdl = new OffreModele();
|
|
|
|
global $twig;
|
|
|
|
global $twig;
|
|
|
|
|
|
|
|
|
|
|
|
// Nombre total de pages
|
|
|
|
$niveauEtudes=null;
|
|
|
|
$numberPages = ceil($offerMdl->getNbOffers() / 5);
|
|
|
|
$typeContrat=null;
|
|
|
|
|
|
|
|
$exp = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$nbOffers = 5 ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($_GET["education"]) && Validation::validateTypeStudies($_GET["education"])) {
|
|
|
|
|
|
|
|
$niveauEtudes = $_GET["education"];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($_GET["typeContrat"]) && Validation::validateTypeContract($_GET["typeContrat"])) {
|
|
|
|
|
|
|
|
$typeContrat = $_GET["typeContrat"];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($_GET["exp"]) && Validation::validateExperience($_GET["exp"])) {
|
|
|
|
|
|
|
|
$exp = $_GET["exp"];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($niveauEtudes == null && $typeContrat == null && $exp == null) {
|
|
|
|
|
|
|
|
$totalOffers = $offerMdl->getNbOffers();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$params = array(
|
|
|
|
|
|
|
|
'typeContrat' => $typeContrat,
|
|
|
|
|
|
|
|
'exp' => $exp,
|
|
|
|
|
|
|
|
'niveauEtudes' => $niveauEtudes,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
$offers = $offerMdl->getOffersWithFilters($params);
|
|
|
|
|
|
|
|
$totalOffers = count($offers);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$numberPages = ceil($totalOffers / 5);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($numberPages == 0 )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo $twig->render("erreur.html",['dVueErreur' => ['Aucune Offre Trouvée']]);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Gestion de la page actuelle
|
|
|
|
|
|
|
|
if (isset($_GET["page"]) && intval($_GET["page"]) != null) {
|
|
|
|
if (isset($_GET["page"]) && intval($_GET["page"]) != null) {
|
|
|
|
$page = intval($_GET["page"]);
|
|
|
|
$page = intval($_GET["page"]);
|
|
|
|
if ($page > $numberPages || $page < 1) {
|
|
|
|
if ($page > $numberPages || $page < 1) {
|
|
|
@ -125,14 +162,23 @@ class UtilisateurControleur
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$page = 1;}
|
|
|
|
$page = 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$start = intval(($page - 1) * 5);
|
|
|
|
$start = intval(($page - 1) * 5);
|
|
|
|
$end = 5;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$offers = $offerMdl->getOfferLimit($start, $end);
|
|
|
|
if ($niveauEtudes == null && $typeContrat == null && $exp == null) {
|
|
|
|
|
|
|
|
$offers = $offerMdl->getOfferLimit($start, $nbOffers);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$params['start'] = $start;
|
|
|
|
|
|
|
|
$params['nbOffers'] = 5;
|
|
|
|
|
|
|
|
$offers = $offerMdl->getOffersWithFilters($params);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "filtre :".$niveauEtudes."<br>";
|
|
|
|
|
|
|
|
echo "filtre :".$typeContrat."<br>";
|
|
|
|
|
|
|
|
echo "filtre :".$exp."<br>";
|
|
|
|
|
|
|
|
|
|
|
|
// Affichage du template avec les données
|
|
|
|
|
|
|
|
echo $twig->render('OffersList.html', [
|
|
|
|
echo $twig->render('OffersList.html', [
|
|
|
|
'offres' => $offers,
|
|
|
|
'offres' => $offers,
|
|
|
|
'numberPages' => $numberPages,
|
|
|
|
'numberPages' => $numberPages,
|
|
|
@ -175,7 +221,7 @@ class UtilisateurControleur
|
|
|
|
$taberror[] = "Email non valide !";
|
|
|
|
$taberror[] = "Email non valide !";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(!Validation::checkNumber($_POST["num"]))
|
|
|
|
if(!Validation::validateNumber($_POST["num"]))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$taberror[] = "Numero non valide !";
|
|
|
|
$taberror[] = "Numero non valide !";
|
|
|
|
//echo $twig->render("CreerOffre.html", ['errMsg' => "Numero non valide !" ]);
|
|
|
|
//echo $twig->render("CreerOffre.html", ['errMsg' => "Numero non valide !" ]);
|
|
|
@ -204,10 +250,9 @@ class UtilisateurControleur
|
|
|
|
if($saveImg1[0] && $saveImg2[0]) {
|
|
|
|
if($saveImg1[0] && $saveImg2[0]) {
|
|
|
|
$offreMdl = new OffreModele();
|
|
|
|
$offreMdl = new OffreModele();
|
|
|
|
|
|
|
|
|
|
|
|
for($i=0;$i<100;$i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
$offre = $offreMdl->publishOffer($saveImg1[1], $saveImg2[1]);
|
|
|
|
$offre = $offreMdl->publishOffers($saveImg1[1], $saveImg2[1]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
echo $twig->render("OffreDetailTest.html", ['offre' => $offre]);
|
|
|
|
echo $twig->render("OffreDetailTest.html", ['offre' => $offre]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|