|
|
@@ -5,6 +5,12 @@ require_once "libs/fnMain.php";
|
|
|
* VALIDATION DES DONNEES
|
|
|
**************************/
|
|
|
$isClassementValid = isset($_GET["classement"]) && (int) $_GET["classement"] !== 0;
|
|
|
+$isTriVilleValid = isset($_GET["v"]) && is_array($_GET["v"]) && $_GET["v"] !== [];
|
|
|
+$isTriSpeValid = isset($_GET["s"]) && is_array($_GET["s"]) && $_GET["s"] !== [];
|
|
|
+
|
|
|
+$specialitySourceDatasetAbrev = getCsvToArrayKeyValue($_SETTINGS["datasetFolder"]."/liste_specialites_abrev.csv");
|
|
|
+$specialitySourceDataset = getCsvToArrayKeyValue($_SETTINGS["datasetFolder"]."/liste_specialites.csv");
|
|
|
+$citySourceDataset = getCsvToArrayKeyValue($_SETTINGS["datasetFolder"]."/liste_villes.csv");
|
|
|
|
|
|
/**************************
|
|
|
* Affichage du formulaire
|
|
|
@@ -60,6 +66,7 @@ $isClassementValid = isset($_GET["classement"]) && (int) $_GET["classement"] !==
|
|
|
</div>
|
|
|
</nav>
|
|
|
</div>
|
|
|
+
|
|
|
<div id="rangLimier">
|
|
|
<br>
|
|
|
<h1 style="text-align: center;">Rangs Limites</h1>
|
|
|
@@ -84,6 +91,38 @@ $isClassementValid = isset($_GET["classement"]) && (int) $_GET["classement"] !==
|
|
|
<input type="text" name="classement" class="form-control rounded-pill" <?= ($isClassementValid === TRUE) ? 'value='.(int) $_GET["classement"] : "" ?>>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div class="d-flex flex-row flex-sm-wrap">
|
|
|
+ <div class="form-group align-item-center" style="margin-right: 10px;">
|
|
|
+ <label for="triSpe">Restreindre aux DES suivants : </label> <br>
|
|
|
+ <select name="s[]" id="triSpe" multiple size="7" class="form-control rounded">
|
|
|
+ <?php
|
|
|
+ if ($isTriSpeValid) { $selectedSpeId = array_flip($_GET['s']); }
|
|
|
+ foreach ($specialitySourceDataset as $speId => $speName) : ?>
|
|
|
+ <option
|
|
|
+ <?= (isset($selectedSpeId[$speId])) ? "selected " : "" ?>
|
|
|
+ value="<?= $speId ?>">
|
|
|
+ <?= $specialitySourceDatasetAbrev[$speId]." - ".$speName ?>
|
|
|
+ </option>
|
|
|
+ <?php endforeach; ?>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div class="form-group align-item-center">
|
|
|
+ <label for="triVille">Restreindre aux villes suivantes : </label> <br>
|
|
|
+ <select name="v[]" id="triVille" multiple size="7" class="form-control rounded">
|
|
|
+ <?php
|
|
|
+ if ($isTriVilleValid) { $selectedVilleId = array_flip($_GET['v']); }
|
|
|
+ foreach ($citySourceDataset as $cityId => $cityName) :
|
|
|
+ if ($cityName !== "XX") : ?>
|
|
|
+ <option
|
|
|
+ <?= (isset($selectedVilleId[$cityId])) ? "selected " : "" ?>
|
|
|
+ value="<?= $cityId ?>">
|
|
|
+ <?= $cityName ?>
|
|
|
+ </option>
|
|
|
+ <?php endif; endforeach; ?>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <i>Utiliser Ctrl/Command + Clic pour (dé)sélectionner plusieurs options sur PC/Mac</i> <br>
|
|
|
<button type="submit" class="btn btn-info rounded-pill col-sm-2" >Envoyer</button>
|
|
|
</form>
|
|
|
|
|
|
@@ -119,14 +158,18 @@ $isClassementValid = isset($_GET["classement"]) && (int) $_GET["classement"] !==
|
|
|
// $reqRL = $db->query('SELECT dataset."idChoix", annee, dataset."rangLimite" FROM dataset');
|
|
|
|
|
|
$rangLimites = $reqRL->fetchAll(PDO::FETCH_GROUP|PDO::FETCH_ASSOC);
|
|
|
-
|
|
|
- // Récupération des datasets
|
|
|
- $specialityDatasetAbrev = getCsvToArrayKeyValue($_SETTINGS["datasetFolder"]."/liste_specialites_abrev.csv");
|
|
|
- $specialityDataset = getCsvToArrayKeyValue($_SETTINGS["datasetFolder"]."/liste_specialites.csv");
|
|
|
- $cityDataset = getCsvToArrayKeyValue($_SETTINGS["datasetFolder"]."/liste_villes.csv");
|
|
|
$inputClassement = (int) $_GET["classement"];
|
|
|
|
|
|
+ //////////////////////////////////
|
|
|
// Calcul et affichage des données
|
|
|
+ //////////////////////////////////
|
|
|
+ // v2. Conversion du filtre spé/ville de l'utilisateur
|
|
|
+ // On croise l'array source de données avec les id sélectionnés via le GET (ce qui sécurise les données en plus)
|
|
|
+ // array_intersect_key(array_source, clés_à_garder)
|
|
|
+ $cityDataset = ($isTriVilleValid === TRUE) ? array_intersect_key($citySourceDataset, array_flip($_GET["v"])) : $citySourceDataset;
|
|
|
+ $specialityDatasetAbrev = ($isTriSpeValid === TRUE) ? array_intersect_key($specialitySourceDatasetAbrev, array_flip($_GET["s"])) : $specialitySourceDatasetAbrev;
|
|
|
+ $specialityDataset = ($isTriSpeValid === TRUE) ? array_intersect_key($specialitySourceDataset, array_flip($_GET['s'])) : $specialitySourceDataset;
|
|
|
+
|
|
|
// Affichage de la 1ère ligne = Titre des colonnes
|
|
|
$html .= "<table><thead><tr><th></th>";
|
|
|
foreach ($specialityDatasetAbrev as $specialityName) {
|