Add support of some SUPANN attributes

Add support of following SUPANN attributes:
- supannEtuDiplome
- supannEtuElementPedagogique
- supannEtuEtape
- supannEtuRegimeInscription
- supannEtuSecteurDisciplinaire
- supannEtuTypeDiplome

For each, a new specific LSattr_html & LSformElement class was added,
and a function is provided to generate then from supannEtuInscription
attribute values.
This commit is contained in:
Benjamin Renard 2021-06-11 14:17:42 +02:00
parent 11f32dea04
commit 7e68b42b4c
13 changed files with 610 additions and 1 deletions

View file

@ -961,6 +961,189 @@ function supannCheckEntityCouldBeDeleted($ldapObject) {
return true; return true;
} }
/**
* Géneration de la valeur des attributs associés à l'attribut supannEtuInscription
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @param[in] $ldapObject L'objet ldap
* @param[in] $component Le composant associés à l'attribut à généré
* @param[in] $ignore_value Valeur possible du composant qui doit être ignoré (optionnel)
*
* @retval array Les valeurs (uniques) du composant passé en paramètres trouvées dans les
* valeurs de l'attribut supannEtuInscription
*/
function generate_from_supannEtuInscription($ldapObject, $component, $ignore_value=null) {
$retval = array();
$inscriptions = $ldapObject -> getValue('supannEtuInscription');
LSlog :: get_logger('LSaddon_supann') -> debug(
"generate_from_supannEtuInscription($ldapObject, $component, $ignore_value): inscriptions = ".
varDump($inscriptions)
);
if (is_array($inscriptions)) {
foreach($inscriptions as $value) {
$inscription = supannParseCompositeValue($value);
if (
!$inscription ||
!array_key_exists($component, $inscription) ||
in_array($inscription[$component], $retval) ||
is_empty($inscription[$component]) ||
($ignore_value && $inscription[$component] == $ignore_value)
)
continue;
$retval[] = $inscription[$component];
}
}
LSlog :: get_logger('LSaddon_supann') -> debug(
"generate_from_supannEtuInscription($ldapObject, $component, $ignore_value): result = '".
implode(', ', $retval)."'"
);
return $retval;
}
/**
* Géneration de la valeur de l'attribut supannEtuDiplome à partir des valeurs
* l'attribut supannEtuInscription.
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @param[in] $ldapObject L'objet ldap
*
* @retval array Les valeurs de l'attribut supannEtuDiplome
*/
function generate_supannEtuDiplome($ldapObject) {
return generate_from_supannEtuInscription($ldapObject, 'diplome');
}
/**
* Géneration de la valeur de l'attribut supannEtuTypeDiplome à partir des valeurs
* l'attribut supannEtuInscription.
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @param[in] $ldapObject L'objet ldap
*
* @retval array Les valeurs de l'attribut supannEtuTypeDiplome
*/
function generate_supannEtuTypeDiplome($ldapObject) {
return generate_from_supannEtuInscription($ldapObject, 'typedip');
}
/**
* Géneration de la valeur de l'attribut supannEtuRegimeInscription à partir des valeurs
* l'attribut supannEtuInscription.
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @param[in] $ldapObject L'objet ldap
*
* @retval array Les valeurs de l'attribut supannEtuRegimeInscription
*/
function generate_supannEtuRegimeInscription($ldapObject) {
return generate_from_supannEtuInscription($ldapObject, 'regimeinsc', '$');
}
/**
* Géneration de la valeur de l'attribut supannEtuSecteurDisciplinaire à partir des valeurs
* l'attribut supannEtuInscription.
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @param[in] $ldapObject L'objet ldap
*
* @retval array Les valeurs de l'attribut supannEtuSecteurDisciplinaire
*/
function generate_supannEtuSecteurDisciplinaire($ldapObject) {
return generate_from_supannEtuInscription($ldapObject, 'sectdisc', '-');
}
/**
* Géneration de la valeur de l'attribut supannEtuAnneeInscription à partir des valeurs
* l'attribut supannEtuInscription.
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @param[in] $ldapObject L'objet ldap
*
* @retval array Les valeurs de l'attribut supannEtuAnneeInscription
*/
function generate_supannEtuAnneeInscription($ldapObject) {
return generate_from_supannEtuInscription($ldapObject, 'anneeinsc');
}
/**
* Géneration de la valeur de l'attribut supannEtuCursusAnnee à partir des valeurs
* l'attribut supannEtuInscription.
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @param[in] $ldapObject L'objet ldap
*
* @retval array Les valeurs de l'attribut supannEtuCursusAnnee
*/
function generate_supannEtuCursusAnnee($ldapObject) {
return generate_from_supannEtuInscription($ldapObject, 'cursusann');
}
/**
* Géneration de la valeur de l'attribut supannEtuElementPedagogique à partir des valeurs
* l'attribut supannEtuInscription.
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @param[in] $ldapObject L'objet ldap
*
* @retval array Les valeurs de l'attribut supannEtuElementPedagogique
*/
function generate_supannEtuElementPedagogique($ldapObject) {
return generate_from_supannEtuInscription($ldapObject, 'eltpedago');
}
/**
* Géneration de la valeur de l'attribut supannEtuEtape à partir des valeurs
* l'attribut supannEtuInscription.
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @param[in] $ldapObject L'objet ldap
*
* @retval array Les valeurs de l'attribut supannEtuEtape
*/
function generate_supannEtuEtape($ldapObject) {
return generate_from_supannEtuInscription($ldapObject, 'etape');
}
/**
* Géneration de la valeur de l'attribut supannEtuDateFin à partir des valeurs
* l'attribut supannEtuInscription.
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @param[in] $ldapObject L'objet ldap
*
* @retval array Les valeurs de l'attribut supannEtuDateFin
*/
function generate_supannEtuDateFin($ldapObject) {
$values = generate_from_supannEtuInscription($ldapObject, 'datefin');
LSlog :: get_logger('LSaddon_supann') -> debug(
"generate_supannEtuDateFin($ldapObject): value retrieved from datefin component = ".varDump($values)
);
$max_time = NULL;
// On garde que la plus lointaine
foreach ($values as $value) {
$time = ldapDate2Timestamp($value);
if (!$time)
continue;
if (!$max_time || $time > $max_time) {
$max_time = $time;
}
}
LSlog :: get_logger('LSaddon_supann') -> debug(
"generate_supannEtuDateFin($ldapObject): result = ".varDump($max_time)
);
return $max_time;
}
if (php_sapi_name() != 'cli') if (php_sapi_name() != 'cli')
return true; return true;
@ -968,7 +1151,7 @@ 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'); $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); $items = json_decode($data, true);
if (!is_array($items)) if (!is_array($items))
LSlog :: fatal('Fail to retreive UAI dataset from data.enseignementsup-recherche.gouv.fr'); LSlog :: get_logger('LSaddon_supann') -> fatal('Fail to retreive UAI dataset from data.enseignementsup-recherche.gouv.fr');
$codes = array(); $codes = array();
foreach($items as $item) { foreach($items as $item) {
if (!isset($item['fields']) || !isset($item['fields']['uai']) || !$item['fields']['uai']) if (!isset($item['fields']) || !isset($item['fields']['uai']) || !$item['fields']['uai'])

View file

@ -0,0 +1,32 @@
<?php
/*******************************************************************************
* Copyright (C) 2021 Easter-eggs
* https://ldapsaisie.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/
/**
* Type d'attribut HTML supannEtuDiplome
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class LSattr_html_supannEtuDiplome extends LSattr_html {
var $LSformElement_type = 'supannEtuDiplome';
}

View file

@ -0,0 +1,32 @@
<?php
/*******************************************************************************
* Copyright (C) 2021 Easter-eggs
* https://ldapsaisie.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/
/**
* Type d'attribut HTML supannEtuElementPedagogique
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class LSattr_html_supannEtuElementPedagogique extends LSattr_html {
var $LSformElement_type = 'supannEtuElementPedagogique';
}

View file

@ -0,0 +1,32 @@
<?php
/*******************************************************************************
* Copyright (C) 2021 Easter-eggs
* https://ldapsaisie.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/
/**
* Type d'attribut HTML supannEtuEtape
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class LSattr_html_supannEtuEtape extends LSattr_html {
var $LSformElement_type = 'supannEtuEtape';
}

View file

@ -0,0 +1,32 @@
<?php
/*******************************************************************************
* Copyright (C) 2021 Easter-eggs
* https://ldapsaisie.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/
/**
* Type d'attribut HTML supannEtuRegimeInscription
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class LSattr_html_supannEtuRegimeInscription extends LSattr_html {
var $LSformElement_type = 'supannEtuRegimeInscription';
}

View file

@ -0,0 +1,32 @@
<?php
/*******************************************************************************
* Copyright (C) 2021 Easter-eggs
* https://ldapsaisie.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/
/**
* Type d'attribut HTML supannEtuSecteurDisciplinaire
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class LSattr_html_supannEtuSecteurDisciplinaire extends LSattr_html {
var $LSformElement_type = 'supannEtuSecteurDisciplinaire';
}

View file

@ -0,0 +1,32 @@
<?php
/*******************************************************************************
* Copyright (C) 2021 Easter-eggs
* https://ldapsaisie.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/
/**
* Type d'attribut HTML supannEtuTypeDiplome
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class LSattr_html_supannEtuTypeDiplome extends LSattr_html {
var $LSformElement_type = 'supannEtuTypeDiplome';
}

View file

@ -0,0 +1,39 @@
<?php
/*******************************************************************************
* Copyright (C) 2021 Easter-eggs
* https://ldapsaisie.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/
LSsession :: loadLSclass('LSformElement_supannLabeledValue');
LSsession :: loadLSaddon('supann');
/**
* Element supannEtuDiplome d'un formulaire pour LdapSaisie
*
* Cette classe définis les éléments supannEtuDiplome des formulaires.
* Elle etant la classe basic LSformElement_supannLabeledValue.
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class LSformElement_supannEtuDiplome extends LSformElement_supannLabeledValue {
var $supannNomenclatureTable = 'etuDiplome';
}

View file

@ -0,0 +1,39 @@
<?php
/*******************************************************************************
* Copyright (C) 2021 Easter-eggs
* https://ldapsaisie.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/
LSsession :: loadLSclass('LSformElement_supannLabeledValue');
LSsession :: loadLSaddon('supann');
/**
* Element supannEtuElementPedagogique d'un formulaire pour LdapSaisie
*
* Cette classe définis les éléments supannEtuElementPedagogique des formulaires.
* Elle etant la classe basic LSformElement_supannLabeledValue.
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class LSformElement_supannEtuElementPedagogique extends LSformElement_supannLabeledValue {
var $supannNomenclatureTable = 'etuElementPedagogique';
}

View file

@ -0,0 +1,39 @@
<?php
/*******************************************************************************
* Copyright (C) 2021 Easter-eggs
* https://ldapsaisie.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/
LSsession :: loadLSclass('LSformElement_supannLabeledValue');
LSsession :: loadLSaddon('supann');
/**
* Element supannEtuEtape d'un formulaire pour LdapSaisie
*
* Cette classe définis les éléments supannEtuEtape des formulaires.
* Elle etant la classe basic LSformElement_supannLabeledValue.
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class LSformElement_supannEtuEtape extends LSformElement_supannLabeledValue {
var $supannNomenclatureTable = 'etuEtape';
}

View file

@ -0,0 +1,39 @@
<?php
/*******************************************************************************
* Copyright (C) 2021 Easter-eggs
* https://ldapsaisie.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/
LSsession :: loadLSclass('LSformElement_supannLabeledValue');
LSsession :: loadLSaddon('supann');
/**
* Element supannEtuRegimeInscription d'un formulaire pour LdapSaisie
*
* Cette classe définis les éléments supannEtuRegimeInscription des formulaires.
* Elle etant la classe basic LSformElement_supannLabeledValue.
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class LSformElement_supannEtuRegimeInscription extends LSformElement_supannLabeledValue {
var $supannNomenclatureTable = 'etuRegimeInscription';
}

View file

@ -0,0 +1,39 @@
<?php
/*******************************************************************************
* Copyright (C) 2021 Easter-eggs
* https://ldapsaisie.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/
LSsession :: loadLSclass('LSformElement_supannLabeledValue');
LSsession :: loadLSaddon('supann');
/**
* Element supannEtuSecteurDisciplinaire d'un formulaire pour LdapSaisie
*
* Cette classe définis les éléments supannEtuSecteurDisciplinaire des formulaires.
* Elle etant la classe basic LSformElement_supannLabeledValue.
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class LSformElement_supannEtuSecteurDisciplinaire extends LSformElement_supannLabeledValue {
var $supannNomenclatureTable = 'etuSecteurDisciplinaire';
}

View file

@ -0,0 +1,39 @@
<?php
/*******************************************************************************
* Copyright (C) 2021 Easter-eggs
* https://ldapsaisie.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/
LSsession :: loadLSclass('LSformElement_supannLabeledValue');
LSsession :: loadLSaddon('supann');
/**
* Element supannEtuTypeDiplome d'un formulaire pour LdapSaisie
*
* Cette classe définis les éléments supannEtuTypeDiplome des formulaires.
* Elle etant la classe basic LSformElement_supannLabeledValue.
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class LSformElement_supannEtuTypeDiplome extends LSformElement_supannLabeledValue {
var $supannNomenclatureTable = 'etuTypeDiplome';
}