filtres recherches fonctionnels, reste à revoir la persistance du formulaire

offres2
Baptiste D 1 year ago
parent 5bf45c24b4
commit 44416aebce

BIN
.DS_Store vendored

Binary file not shown.

BIN
php/.DS_Store vendored

Binary file not shown.

@ -4,7 +4,7 @@
/** Chargement config */ /** Chargement config */
require_once __DIR__ . '/../src/config/config.php'; require_once __DIR__ . '/../src/config/config.php';
require __DIR__ . '/../vendor/autoload.php'; require __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../src/TwigExtensions.php'; require_once __DIR__ . '/../src/TwigExtensions.php'; // utile pour les images à supprimer sinon
/** Configuration twig */ /** Configuration twig */
$loader = new \Twig\Loader\FilesystemLoader(__DIR__ . '/../templates'); $loader = new \Twig\Loader\FilesystemLoader(__DIR__ . '/../templates');
@ -13,5 +13,4 @@ $twig = new \Twig\Environment($loader, [
'debug' => true 'debug' => true
]); ]);
$cont = new \App\controleur\FrontControleur(); $cont = new \App\controleur\FrontControleur();

@ -121,16 +121,16 @@ class UtilisateurControleur
$nbOffers = 5 ; $nbOffers = 5 ;
if(isset($_GET["education"]) && Validation::validateTypeStudies($_GET["education"])) { if(isset($_GET["niveauEtudes"]) && Validation::validateTypeStudies($_GET["niveauEtudes"])) {
$niveauEtudes = $_GET["education"]; $niveauEtudes = $_GET["niveauEtudes"];
} }
if(isset($_GET["typeContrat"]) && Validation::validateTypeContract($_GET["typeContrat"])) { if(isset($_GET["typeContrat"]) && Validation::validateTypeContract($_GET["typeContrat"])) {
$typeContrat = $_GET["typeContrat"]; $typeContrat = $_GET["typeContrat"];
} }
if(isset($_GET["exp"]) && Validation::validateExperience($_GET["exp"])) { if(isset($_GET["experience"]) && Validation::validateExperience($_GET["experience"])) {
$exp = $_GET["exp"]; $exp = $_GET["experience"];
} }
if ($niveauEtudes == null && $typeContrat == null && $exp == null) { if ($niveauEtudes == null && $typeContrat == null && $exp == null) {
@ -175,14 +175,20 @@ class UtilisateurControleur
$offers = $offerMdl->getOffersWithFilters($params); $offers = $offerMdl->getOffersWithFilters($params);
} }
echo "filtre :".$niveauEtudes."<br>"; /* echo "filtre :".$niveauEtudes."<br>";
echo "filtre :".$typeContrat."<br>"; echo "filtre :".$typeContrat."<br>";
echo "filtre :".$exp."<br>"; echo "filtre :".$exp."<br>";*/
echo $twig->render('OffersList.html', [ echo $twig->render('OffersList.html', [
'offres' => $offers, 'offres' => $offers,
'numberPages' => $numberPages, 'numberPages' => $numberPages,
'currentPage' => $page 'currentPage' => $page,
'typeContrat' => (($typeContrat != null ? "checked" : "")),
'experience' => (($exp != null ? "checked" : "")),
'niveauEtudes' => (($niveauEtudes != null ? "checked" : "")),
'valContrat' => (($typeContrat != null ? "&typeContrat=".$typeContrat : "")),
'valExp' => (($exp != null ? "&experience=".$exp : "")),
'valEtudes' => (($niveauEtudes != null ? "&niveauEtudes=".$niveauEtudes : ""))
]); ]);
} }

@ -114,13 +114,14 @@ class OffreGateway
$params[':lvl'] = array($niveauEtudes, \PDO::PARAM_STR); $params[':lvl'] = array($niveauEtudes, \PDO::PARAM_STR);
} }
if(isset($filters['start']) && isset($filters['end'])) if(isset($filters['start']) && isset($filters['nbOffers']))
{ {
$query .= " LIMIT :s, :nb"; $query .= " LIMIT :s, :nb";
$params[':s'] = array($filters['start'], \PDO::PARAM_INT); $params[':s'] = array($filters['start'], \PDO::PARAM_INT);
$params[':nb'] = array($filters['nbOffers'], \PDO::PARAM_INT); $params[':nb'] = array($filters['nbOffers'], \PDO::PARAM_INT);
} }
$this->con->executeQuery($query, $params); $this->con->executeQuery($query, $params);
return $this->con->getResults(); return $this->con->getResults();

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en" xmlns="http://www.w3.org/1999/html">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Alica - Offres</title> <title>Alica - Offres</title>
@ -23,19 +23,19 @@
<div class="form-group mr-3 flex-column"> <div class="form-group mr-3 flex-column">
<label for="typeContrat">Type de contrat :</label> <label for="typeContrat">Type de contrat :</label>
<div class="form-check"> <div class="form-check">
<input class="form-check-input" type="radio" name="typeContrat" id="cdd" value="CDD"> <input class="form-check-input" type="radio" name="typeContrat" id="cdd" value="CDD" {{typeContrat}}>
<label class="form-check-label" for="cdd">CDD</label> <label class="form-check-label" for="cdd">CDD</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<input class="form-check-input" type="radio" name="typeContrat" id="cdi" value="CDI"> <input class="form-check-input" type="radio" name="typeContrat" id="cdi" value="CDI" {{typeContrat}}>
<label class="form-check-label" for="cdi">CDI</label> <label class="form-check-label" for="cdi">CDI</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<input class="form-check-input" type="radio" name="typeContrat" id="alternance" value="Alternance"> <input class="form-check-input" type="radio" name="typeContrat" id="alternance" value="Alternance" {{typeContrat}}>
<label class="form-check-label" for="alternance">Alternance</label> <label class="form-check-label" for="alternance">Alternance</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<input class="form-check-input" type="radio" name="typeContrat" id="stage" value="Stage"> <input class="form-check-input" type="radio" name="typeContrat" id="stage" value="Stage" {{typeContrat}}>
<label class="form-check-label" for="stage">Stage</label> <label class="form-check-label" for="stage">Stage</label>
</div> </div>
</div> </div>
@ -43,11 +43,11 @@
<div class="form-group mr-3 flex-column"> <div class="form-group mr-3 flex-column">
<label for="experience">Expérience :</label> <label for="experience">Expérience :</label>
<div class="form-check"> <div class="form-check">
<input class="form-check-input" type="radio" name="experience" id="junior" value="Junior"> <input class="form-check-input" type="radio" name="experience" id="junior" value="Junior" {{experience}}>
<label class="form-check-label" for="junior">Junior</label> <label class="form-check-label" for="junior">Junior</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<input class="form-check-input" type="radio" name="experience" id="senior" value="Senior"> <input class="form-check-input" type="radio" name="experience" id="senior" value="Senior" {{experience}}>
<label class="form-check-label" for="senior">Senior</label> <label class="form-check-label" for="senior">Senior</label>
</div> </div>
</div> </div>
@ -56,15 +56,15 @@
<label for="niveauEtudes">Niveau d'études :</label> <label for="niveauEtudes">Niveau d'études :</label>
<div class="form-check"> <div class="form-check">
<input class="form-check-input" type="radio" name="niveauEtudes" id="bac2" value="Bac+2"> <input class="form-check-input" type="radio" name="niveauEtudes" id="bac2" value="Bac+2" {{niveauEtudes}}>
<label class="form-check-label" for="bac2">Bac+2</label> <label class="form-check-label" for="bac2">Bac+2</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<input class="form-check-input" type="radio" name="niveauEtudes" id="bac3" value="Bac+3"> <input class="form-check-input" type="radio" name="niveauEtudes" id="bac3" value="Bac+3" {{niveauEtudes}}>
<label class="form-check-label" for="bac3">Bac+3</label> <label class="form-check-label" for="bac3">Bac+3</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<input class="form-check-input" type="radio" name="niveauEtudes" id="bac5" value="Bac+5"> <input class="form-check-input" type="radio" name="niveauEtudes" id="bac5" value="Bac+5" {{niveauEtudes}}>
<label class="form-check-label" for="bac5">Bac+5</label> <label class="form-check-label" for="bac5">Bac+5</label>
</div> </div>
</div> </div>
@ -72,9 +72,13 @@
</form> </form>
</div> </div>
</div> </div>
<a href="index.php?action=consultOffers" class="btn btn-info">Réinitialiser les filtres</a>
</div> </div>
<h1 id="titrePrincipal">Offres d'emploi</h1> <h1 id="titrePrincipal">Offres d'emploi</h1>
{% for offre in offres %} {% for offre in offres %}
@ -99,22 +103,25 @@
{% endfor %} {% endfor %}
<nav style="text-align: center;">
<nav style="text-align: center;"> <nav style="text-align: center;">
{% if numberPages is defined %} {% if numberPages is defined %}
{% if currentPage is defined %} {% if currentPage is defined %}
{% for i in 1..numberPages %} {% for i in 1..numberPages %}
{% if i == currentPage %} {% if i == currentPage %}
<a href="index.php?action=consultOffers&page={{i}}" class="active bg-danger">{{ i }}</a> <!--
index.php?action=consultOffers&page={{ i }}&typeContrat={{ typeContrat }}&experience={{ experience }}&niveauEtudes={{ niveauEtudes }}
-->
<a href="index.php?action=consultOffers&page={{ i }}&{{valContrat}}{{valExp}}{{ValEtudes}}" class="active bg-danger">{{ i }}</a>
{% else %} {% else %}
<a href="index.php?action=consultOffers&page={{i}}">{{ i }}</a> <a href="index.php?action=consultOffers&page={{ i }}&{{valContrat}}{{valExp}}{{ValEtudes}}">{{ i }}</a>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endif %} {% endif %}
</nav> </nav>
</nav>
</div> </div>

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Détails de l'Offre {{ offre.getId() }}</title> <title>Détails de l'Offre {{ offre.getNom() }}</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head> </head>
<body> <body>

Loading…
Cancel
Save