mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-22 09:59:06 +01:00
LSaddon::supann: add generate_supann_codeEtablissement_uai_nomenclature CLI command
This commit is contained in:
parent
60eca6967c
commit
6b4bc036e3
1 changed files with 26 additions and 0 deletions
|
@ -572,3 +572,29 @@ function supannCheckEntityCouldBeDeleted($ldapObject) {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (php_sapi_name() != 'cli')
|
||||||
|
return true;
|
||||||
|
|
||||||
|
function cli_generate_supann_codeEtablissement_uai_nomenclature($command_args) {
|
||||||
|
$data = file_get_contents('https://data.enseignementsup-recherche.gouv.fr/explore/dataset/fr-esr-principaux-etablissements-enseignement-superieur/download?format=json');
|
||||||
|
$items = json_decode($data, true);
|
||||||
|
if (!is_array($items))
|
||||||
|
LSlog :: fatal('Fail to retreive UAI dataset from data.enseignementsup-recherche.gouv.fr');
|
||||||
|
$codes = array();
|
||||||
|
foreach($items as $item) {
|
||||||
|
if (!isset($item['fields']) || !isset($item['fields']['uai']) || !$item['fields']['uai'])
|
||||||
|
continue;
|
||||||
|
$codes[$item['fields']['uai']] = $item['fields']['uo_lib'];
|
||||||
|
}
|
||||||
|
var_export($codes);
|
||||||
|
}
|
||||||
|
|
||||||
|
LScli :: add_command(
|
||||||
|
'generate_supann_codeEtablissement_uai_nomenclature',
|
||||||
|
'cli_generate_supann_codeEtablissement_uai_nomenclature',
|
||||||
|
'Generate Supann codeEtablissement UAI nomenclature',
|
||||||
|
false, // usage args
|
||||||
|
false, // long desc
|
||||||
|
false // need LDAP connection
|
||||||
|
);
|
||||||
|
|
Loading…
Reference in a new issue