|
@@ -156,105 +156,8 @@ if ($isNoteValid && $isAnneeValid) {
|
|
|
</p>
|
|
</p>
|
|
|
EOF;
|
|
EOF;
|
|
|
|
|
|
|
|
- $html .= "<h3>Résultats</h3>";
|
|
|
|
|
|
|
+ require "apiDisplay.php";
|
|
|
|
|
|
|
|
- // On va récupérer tous les rangs limited dispo triés par idChoix
|
|
|
|
|
- $reqRL = $db->query('SELECT dataset."idChoix", dataset.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 = $rangMoyen;
|
|
|
|
|
-
|
|
|
|
|
- // Calcul et affichage des données
|
|
|
|
|
- // Affichage de la 1ère ligne = Titre des colonnes
|
|
|
|
|
- $html .= "<table><thead><tr><th></th>";
|
|
|
|
|
- foreach ($specialityDatasetAbrev as $specialityName) {
|
|
|
|
|
- $html .= "<th scope='col'>".$specialityName."</th>";
|
|
|
|
|
- }
|
|
|
|
|
- $html .= "</tr></thead><tbody>";
|
|
|
|
|
-
|
|
|
|
|
- // Affichage de la suite du tableau avec le calcul
|
|
|
|
|
- foreach ($cityDataset as $cityId => $cityName) {
|
|
|
|
|
- // On gère la séparation des différentes régions entre elles (représentées dans le csv villes par les lignes XX_:XX)
|
|
|
|
|
- // La notation des lignes de séparation est sous forme XX_x car si on laissait XX, la fonction getCsvToArrayKeyValue
|
|
|
|
|
- // ne retourne la position que pour la 1ère occurence de XX;XX
|
|
|
|
|
- // La manière de fix ça de manière la plus opti et sale, c'est de faire un substr et de tester les 2 premiers charactères
|
|
|
|
|
- // si ils sont égaux à XX, on fait une séparation
|
|
|
|
|
- // TODO : Faire un parseur csv qui prend en compte chaque ligne du csv dans l'ordre du fichier
|
|
|
|
|
- if (strpos($cityId, "XX") !== FALSE) {
|
|
|
|
|
- $html .= "<tr><th></th>";
|
|
|
|
|
- foreach ($specialityDatasetAbrev as $specialityName) {
|
|
|
|
|
- $html .= "<th scope='col'>".$specialityName."</th>";
|
|
|
|
|
- }
|
|
|
|
|
- $html .= "</th>";
|
|
|
|
|
- continue;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- $html .= "<tr><th scope='row'>".$cityName."</th>";
|
|
|
|
|
- foreach ($specialityDatasetAbrev AS $specialityId => $specialityName) {
|
|
|
|
|
- $idChoice = "0".$cityId.$specialityId;
|
|
|
|
|
-
|
|
|
|
|
- if (!isset($rangLimites[$idChoice])) {
|
|
|
|
|
- $nbAnneePropose = 0;
|
|
|
|
|
- $nbPossibleAnneePropose = 0;
|
|
|
|
|
- } else {
|
|
|
|
|
- $nbAnneePropose = count($rangLimites[$idChoice]);
|
|
|
|
|
- $nbPossibleAnneePropose = 0;
|
|
|
|
|
- foreach ($rangLimites[$idChoice] as $rangLimite) {
|
|
|
|
|
- if ((int) $rangLimite["rangLimite"] >= $inputClassement) {$nbPossibleAnneePropose++;}
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // Affichage de la cellule
|
|
|
|
|
- $html .= "<td class=\"";
|
|
|
|
|
- switch (TRUE) {
|
|
|
|
|
- case ($nbPossibleAnneePropose === 0 && $nbAnneePropose === 0):
|
|
|
|
|
- $html .= "never-available";
|
|
|
|
|
- break;
|
|
|
|
|
-
|
|
|
|
|
- case ($nbPossibleAnneePropose === 0):
|
|
|
|
|
- $html .= "no-choice";
|
|
|
|
|
- break;
|
|
|
|
|
-
|
|
|
|
|
- case ($nbAnneePropose > $nbPossibleAnneePropose && $nbPossibleAnneePropose === 1):
|
|
|
|
|
- $html .= "last-choice";
|
|
|
|
|
- break;
|
|
|
|
|
-
|
|
|
|
|
- case ($nbAnneePropose > $nbPossibleAnneePropose && $nbPossibleAnneePropose !== 1):
|
|
|
|
|
- $html .= "half-choices";
|
|
|
|
|
- break;
|
|
|
|
|
-
|
|
|
|
|
- case ($nbAnneePropose === $nbPossibleAnneePropose):
|
|
|
|
|
- $html .= "all-choices";
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- $html .= "\">";
|
|
|
|
|
- if ($nbPossibleAnneePropose > 0) {
|
|
|
|
|
- $html .= $nbPossibleAnneePropose;
|
|
|
|
|
- } else if ($nbPossibleAnneePropose === 0 && $nbAnneePropose !== 0) {
|
|
|
|
|
- $html .= "0";
|
|
|
|
|
- }
|
|
|
|
|
- $html .= "</td>";
|
|
|
|
|
- }
|
|
|
|
|
- $html .= "</tr>";
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- $html .= "</tbody></table><br>";
|
|
|
|
|
-
|
|
|
|
|
- // Affichage du tableau des légendes
|
|
|
|
|
- $html .= "<table><thead><th scope='col'>Abréviation</th><th scope='col'>Nom de spécialité</th></thead>";
|
|
|
|
|
-
|
|
|
|
|
- foreach ($specialityDatasetAbrev as $speId => $speAbrev) {
|
|
|
|
|
- $html .= "<tr><td>".$speAbrev."</td><td>".$specialityDataset[$speId]."</td></tr>";
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- $html .= "</table></body>";
|
|
|
|
|
-
|
|
|
|
|
- // Affichage du HTML demandé
|
|
|
|
|
- echo $html;
|
|
|
|
|
} else {
|
|
} else {
|
|
|
echo "Valeurs d'année et/ou note incorrecte.";
|
|
echo "Valeurs d'année et/ou note incorrecte.";
|
|
|
}
|
|
}
|