| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- require_once "libs/fnMain.php";
- // Page permettant d'extraire le nombre de postes proposés, choisis, laissés libres, leur rang limite
- function main(string $html)
- {
- global $_SETTINGS;
- $regex = '#norm(\d+)".+\n(\d+)<span>dispo : (\d{1,5})<br>[\s\S]+placé : (\d{1,5})<br>[\s\S]+offre : (\d{1,5})<hr>#U';
- $matches = [];
- preg_match_all($regex, $html, $matches, PREG_SET_ORDER);
- // var_dump($matches);die();
- $specialitySourceDatasetAbrev = getCsvToArrayKeyValue($_SETTINGS["datasetFolder"]."/liste_specialites_abrev.csv");
- $citySourceDatasetAbrev = getCsvToArrayKeyValue($_SETTINGS["datasetFolder"]."/raphael/liste_villes_abrev_raph.csv");
- // Génération CSV
- $strResult = "Session,Spe,CHU,Postes,Offres_Norm,Dispo,Rang_Limite,Offres_CESP<br>";
- foreach ($matches as $match) {
- // On split l'id du choix en identifiant
- $cityId = substr($match[1], 1, 2);
- $speId = substr($match[1], 3, 3);
- // On insère les données
- $strResult .= "ecn2017,"; // CHANGER LIGNE ICI POUR ANNEE
- $strResult .= $specialitySourceDatasetAbrev[$speId] . ",";
- $strResult .= $citySourceDatasetAbrev[$cityId]. ",";
- $strResult .= $match[4] . ",";
- $strResult .= $match[5] . ",";
- $strResult .= $match[3] . ",";
- $strResult .= $match[2] . ",";
- $strResult .= "0<br>";
- }
- echo $strResult;
- }
- $html = <<< 'HERE'
- // Insérer code HTML page "limites" du CNG
- HERE;
- main($html);
|