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 */
require_once __DIR__ . '/../src/config/config.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 */
$loader = new \Twig\Loader\FilesystemLoader(__DIR__ . '/../templates');
@ -13,5 +13,4 @@ $twig = new \Twig\Environment($loader, [
'debug' => true
]);
$cont = new \App\controleur\FrontControleur();

@ -121,16 +121,16 @@ class UtilisateurControleur
$nbOffers = 5 ;
if(isset($_GET["education"]) && Validation::validateTypeStudies($_GET["education"])) {
$niveauEtudes = $_GET["education"];
if(isset($_GET["niveauEtudes"]) && Validation::validateTypeStudies($_GET["niveauEtudes"])) {
$niveauEtudes = $_GET["niveauEtudes"];
}
if(isset($_GET["typeContrat"]) && Validation::validateTypeContract($_GET["typeContrat"])) {
$typeContrat = $_GET["typeContrat"];
}
if(isset($_GET["exp"]) && Validation::validateExperience($_GET["exp"])) {
$exp = $_GET["exp"];
if(isset($_GET["experience"]) && Validation::validateExperience($_GET["experience"])) {
$exp = $_GET["experience"];
}
if ($niveauEtudes == null && $typeContrat == null && $exp == null) {
@ -175,14 +175,20 @@ class UtilisateurControleur
$offers = $offerMdl->getOffersWithFilters($params);
}
echo "filtre :".$niveauEtudes."<br>";
/* echo "filtre :".$niveauEtudes."<br>";
echo "filtre :".$typeContrat."<br>";
echo "filtre :".$exp."<br>";
echo "filtre :".$exp."<br>";*/
echo $twig->render('OffersList.html', [
'offres' => $offers,
'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);
}
if(isset($filters['start']) && isset($filters['end']))
if(isset($filters['start']) && isset($filters['nbOffers']))
{
$query .= " LIMIT :s, :nb";
$params[':s'] = array($filters['start'], \PDO::PARAM_INT);
$params[':nb'] = array($filters['nbOffers'], \PDO::PARAM_INT);
}
$this->con->executeQuery($query, $params);
return $this->con->getResults();

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="UTF-8">
<title>Alica - Offres</title>
@ -23,19 +23,19 @@
<div class="form-group mr-3 flex-column">
<label for="typeContrat">Type de contrat :</label>
<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>
</div>
<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>
</div>
<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>
</div>
<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>
</div>
</div>
@ -43,11 +43,11 @@
<div class="form-group mr-3 flex-column">
<label for="experience">Expérience :</label>
<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>
</div>
<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>
</div>
</div>
@ -56,15 +56,15 @@
<label for="niveauEtudes">Niveau d'études :</label>
<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>
</div>
<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>
</div>
<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>
</div>
</div>
@ -72,9 +72,13 @@
</form>
</div>
</div>
<a href="index.php?action=consultOffers" class="btn btn-info">Réinitialiser les filtres</a>
</div>
<h1 id="titrePrincipal">Offres d'emploi</h1>
{% for offre in offres %}
@ -100,27 +104,30 @@
{% endfor %}
<nav style="text-align: center;">
<nav style="text-align: center;">
{% if numberPages is defined %}
{% if currentPage is defined %}
{% for i in 1..numberPages %}
{% if i == currentPage %}
<a href="index.php?action=consultOffers&page={{i}}" class="active bg-danger">{{ i }}</a>
{% else %}
<a href="index.php?action=consultOffers&page={{i}}">{{ i }}</a>
{% endif %}
{% endfor %}
{% for i in 1..numberPages %}
{% if i == currentPage %}
<!--
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 %}
<a href="index.php?action=consultOffers&page={{ i }}&{{valContrat}}{{valExp}}{{ValEtudes}}">{{ i }}</a>
{% endif %}
{% endfor %}
{% endif %}
</nav>
{% endif %}
</nav>
</nav>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>

@ -2,7 +2,7 @@
<html>
<head>
<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">
</head>
<body>

Loading…
Cancel
Save