mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-26 11:52:59 +01:00
SUPANN : Ajout du support de l'attribut supannRoleEntite
This commit is contained in:
parent
dc5648272e
commit
b59fcddb77
7 changed files with 521 additions and 1 deletions
|
@ -35,6 +35,9 @@ define('LS_SUPANN_FIRSTNAME_ATTR','givenName');
|
||||||
// Type de LSobject correspondant aux entites SUPANN
|
// Type de LSobject correspondant aux entites SUPANN
|
||||||
define('LS_SUPANN_LSOBJECT_ENTITE_TYPE','LSsupannEntite');
|
define('LS_SUPANN_LSOBJECT_ENTITE_TYPE','LSsupannEntite');
|
||||||
|
|
||||||
|
// Format d'affichage du nom courts d'une entites SUPANN
|
||||||
|
define('LS_SUPANN_LSOBJECT_ENTITE_FORMAT_SHORTNAME','%{ou}');
|
||||||
|
|
||||||
// DN de l'entite SUPANN correspondant à l'etablissement
|
// DN de l'entite SUPANN correspondant à l'etablissement
|
||||||
define('LS_SUPANN_ETABLISSEMENT_DN','supannCodeEntite=XXX,ou=structures,dc=univ,dc=fr');
|
define('LS_SUPANN_ETABLISSEMENT_DN','supannCodeEntite=XXX,ou=structures,dc=univ,dc=fr');
|
||||||
|
|
||||||
|
@ -42,4 +45,217 @@ define('LS_SUPANN_ETABLISSEMENT_DN','supannCodeEntite=XXX,ou=structures,dc=univ,
|
||||||
// Exemple : 0753742K
|
// Exemple : 0753742K
|
||||||
define('LS_SUPANN_ETABLISSEMENT_UAI','0753742K');
|
define('LS_SUPANN_ETABLISSEMENT_UAI','0753742K');
|
||||||
|
|
||||||
|
// Table de données des roles generiques
|
||||||
|
$GLOBALS['supannRoleGenerique'] = array (
|
||||||
|
"D00" => "MINISTRE",
|
||||||
|
"D01" => "DIRECTEUR DU CABINET",
|
||||||
|
"D02" => "DIRECTEUR ADJOINT DU CABINET",
|
||||||
|
"D10" => "DIRECTEUR AC",
|
||||||
|
"D11" => "DELEGUE AC",
|
||||||
|
"D12" => "DELEGUE REGIONAL A LA RECH. ET TECHN.",
|
||||||
|
"D21" => "DIRECTEUR DE RECHERCHE",
|
||||||
|
"D22" => "DIRECTEUR SCIENTIFIQUE",
|
||||||
|
"D23" => "DIRECTEUR DE PROJET",
|
||||||
|
"D30" => "Directeur",
|
||||||
|
"D32" => "Directeur des études",
|
||||||
|
"D34" => "Directeur de la Recherche",
|
||||||
|
"D35" => "Doyen",
|
||||||
|
"D40" => "SOUS-DIRECTEUR",
|
||||||
|
"D60" => "DIRECTEUR DE DEPARTEMENT",
|
||||||
|
"D70" => "DOYEN DE L'IGEN",
|
||||||
|
"D71" => "DOYEN DE L'IGB",
|
||||||
|
"D80" => "DIRECTEUR GENERAL AC",
|
||||||
|
"D81" => "DIR GEN AC, SECRETAIRE GENERAL ADJOINT",
|
||||||
|
"D90" => "HAUT FONCTIONNAIRE DE DEFENSE",
|
||||||
|
"F01" => "CHEF DU CABINET",
|
||||||
|
"F02" => "CHEF ADJOINT DU CABINET",
|
||||||
|
"F10" => "CHEF DE SERVICE",
|
||||||
|
"F11" => "CHEF DE SERVICE ADJOINT AU DIRECTEUR",
|
||||||
|
"F12" => "CHEF DU SERVICE DE l'IGAENR",
|
||||||
|
"F20" => "CHEF DE MISSION",
|
||||||
|
"F21" => "CHEF DE LA MISSION",
|
||||||
|
"F22" => "CHEF DE SERVICE ADJOINT AU DIR GEN",
|
||||||
|
"F30" => "CHEF DE DIVISION",
|
||||||
|
"F40" => "CHEF DE DEPARTEMENT",
|
||||||
|
"F42" => "chef des services administratifs",
|
||||||
|
"F50" => "CHEF DE CENTRE",
|
||||||
|
"F60" => "CHEF DE BUREAU",
|
||||||
|
"F61" => "CHEF DE CELLULE",
|
||||||
|
"F62" => "CHEF DU CABINET DU SECRETAIRE GENERAL",
|
||||||
|
"F70" => "CHEF D'EXPLOITATION",
|
||||||
|
"F71" => "CHEF D'EQUIPE",
|
||||||
|
"F73" => "CHEF DU SERVICE INTERIEUR",
|
||||||
|
"F74" => "CHEF DE SECTION",
|
||||||
|
"F75" => "CHEF DE SITE",
|
||||||
|
"F76" => "CHEF DE CUISINE",
|
||||||
|
"H10" => "CHARGE DU SERVICE",
|
||||||
|
"H11" => "CHARGE DE SOUS-DIRECTION",
|
||||||
|
"H20" => "CHARGE DE MISSION AUPRES DU MINISTRE",
|
||||||
|
"H30" => "CHARGE DE MISSION AUPRES DU DIR CAB",
|
||||||
|
"H40" => "CHARGE DE MISSION",
|
||||||
|
"H70" => "CHARGE DU SECRETARIAT DU DIRECTEUR",
|
||||||
|
"H75" => "CHARGE DU SECRETERIAT DU DRRT",
|
||||||
|
"H80" => "CHARGE DE GESTION ADMINIS. ET COMPTABLE",
|
||||||
|
"J01" => "ADJOINT AU CHEF DE CABINET",
|
||||||
|
"J04" => "ADJOINT AU DIRECTEUR GENERAL AC",
|
||||||
|
"J05" => "ADJOINT AU DIRECTEUR",
|
||||||
|
"J06" => "ADJOINT AU DELEGUE AC",
|
||||||
|
"J07" => "ADJOINT AU DRRT",
|
||||||
|
"J10" => "ADJOINT AU CHEF DE SERVICE",
|
||||||
|
"J11" => "ADJOINT AU CHARGE DU SERVICE",
|
||||||
|
"J12" => "ADJOINT AU SOUS-DIRECTEUR",
|
||||||
|
"J13" => "ADJOINT AU CHARGE DE SOUS-DIRECTION",
|
||||||
|
"J20" => "ADJOINT AU CHEF DE MISSION",
|
||||||
|
"J21" => "ADJOINT AU CHEF DE LA MISSION",
|
||||||
|
"J30" => "ADJOINT AU CHEF DE DIVISION",
|
||||||
|
"J31" => "ADJOINT AU CHEF DE DEPARTEMENT",
|
||||||
|
"J32" => "ADJOINT AU DIRECTEUR DE DEPARTEMENT",
|
||||||
|
"J33" => "ADJOINT AU CHEF DE CENTRE",
|
||||||
|
"J34" => "ADJOINT AU CHEF DE BUREAU",
|
||||||
|
"J35" => "A CHEF AU CHEF DE SECTION",
|
||||||
|
"J36" => "ADJOINT AU CHEF DE CELLULE",
|
||||||
|
"J40" => "ADJOINT AU RESPONSABLE DE CELLULE",
|
||||||
|
"J41" => "ADJOINT AU RESPONSABLE DE L'UNITE",
|
||||||
|
"J42" => "ADJOINT AU RESPONSABLE DE POLE",
|
||||||
|
"J50" => "ADJOINT AU RESPONSABLE D'ATELIER",
|
||||||
|
"J60" => "Directeur adjoint",
|
||||||
|
"J61" => "Chef de service adjoint",
|
||||||
|
"J62" => "Directeur des études adjoint",
|
||||||
|
"J63" => "Directeur de la Recherche adjoint",
|
||||||
|
"J63" => "Directeur scientifique adjoint",
|
||||||
|
"M01" => "COLLABORATEUR EXTERIEUR",
|
||||||
|
"N00" => "CONSEILLER AUPRES DU MINISTRE",
|
||||||
|
"N01" => "CONSEILLER",
|
||||||
|
"N02" => "CONSEILLER DU CABINET",
|
||||||
|
"N03" => "CONSEILLER TECHNIQUE DU CABINET",
|
||||||
|
"N10" => "CONSEILLER D'ETABLISSEMENTS",
|
||||||
|
"N11" => "CONSEILLER PEDAGOGIQUE",
|
||||||
|
"N20" => "CONSEILLER TECHNIQUE",
|
||||||
|
"N50" => "COORDONNATEUR",
|
||||||
|
"P00" => "PRESIDENT",
|
||||||
|
"P01" => "PRESIDENT D'ASSOCIATION",
|
||||||
|
"P10" => "VICE-PRESIDENT",
|
||||||
|
"P50" => "SECRETAIRE GENERAL",
|
||||||
|
"P51" => "Secrétaire Général adjoint",
|
||||||
|
"P60" => "SECRETAIRE GENERAL AC",
|
||||||
|
"P70" => "Administrateur",
|
||||||
|
"P71" => "Administrateur provisoire",
|
||||||
|
"R00" => "RESPONSABLE",
|
||||||
|
"R01" => "RESPONSABLE DE CELLULE",
|
||||||
|
"R02" => "RESPONSABLE DE DEPARTEMENT",
|
||||||
|
"R10" => "RESPONSABLE DE MISSION",
|
||||||
|
"R20" => "RESPONSABLE DE POLE",
|
||||||
|
"R21" => "RESPONSABLE DE SECTEUR",
|
||||||
|
"R22" => "RESPONSABLE D'UNITE",
|
||||||
|
"R30" => "RESPONSABLE DE SERVICES TECHNIQUES",
|
||||||
|
"R31" => "RESPONSABLE EPI",
|
||||||
|
"R33" => "RESPONSABLE D'ATELIER",
|
||||||
|
"R40" => "Responsable admnistratif",
|
||||||
|
"R41" => "Responsable de diplôme",
|
||||||
|
"R42" => "Responsable pédagogique",
|
||||||
|
"R43" => "Responsable de programme",
|
||||||
|
"R80" => "RESPONSABLE UGARH",
|
||||||
|
"R81" => "ADJOINT(E) RESP UGARH",
|
||||||
|
"S01" => "Encadrant Tuteur",
|
||||||
|
"S10" => "Membre titulaire, Membre",
|
||||||
|
"S11" => "Membre suppléant",
|
||||||
|
"S12" => "Membre consultatif",
|
||||||
|
"S13" => "Participant",
|
||||||
|
"S14" => "Représentant / Représentant étudiant",
|
||||||
|
"S15" => "Délégué",
|
||||||
|
"S16" => "Correspondant",
|
||||||
|
"S17" => "Coordonnateur scientifique",
|
||||||
|
"S20" => "Partenaire",
|
||||||
|
"S21" => "Personnalité extérieure",
|
||||||
|
"T01" => "ASSISTANT DE SERVICE SOCIAL",
|
||||||
|
"T02" => "INFIRMIER",
|
||||||
|
"T12" => "AMINISTRATEUR DE DONNEES",
|
||||||
|
"T13" => "HUISSIER",
|
||||||
|
"T14" => "AGENT D'ACCUEIL",
|
||||||
|
"T15" => "HOTESSE D'ACCUEIL",
|
||||||
|
"T16" => "AGENT TECHNIQUE",
|
||||||
|
"T17" => "CHARGE DE COM, REL PUBLIQUE OU PRESSE",
|
||||||
|
"T18" => "ALLOCATAIRE D'EMPLOIS",
|
||||||
|
"T19" => "ANALYSTE",
|
||||||
|
"T22" => "ASSISTANT DE DIRECTION",
|
||||||
|
"T24" => "ASSISTANT TECHNIQUE",
|
||||||
|
"T25" => "CHARGE D'ETUDES",
|
||||||
|
"T26" => "CHEF DE PROJET",
|
||||||
|
"T27" => "CHEF DE PROJET INFORMATIQUE",
|
||||||
|
"T29" => "CONCEPTEUR REDACTEUR SITE WEB",
|
||||||
|
"T30" => "CONDUCTEUR AUTOMOBILE",
|
||||||
|
"T31" => "CONSEILLER SCIENTIFIQUE ET TECHNIQUE",
|
||||||
|
"T32" => "CONTROLEUR DE GESTION",
|
||||||
|
"T34" => "CORRESPONDANT INFORMATIQUE",
|
||||||
|
"T35" => "DEVELOPPEUR D'APPLICATIONS",
|
||||||
|
"T36" => "DOCUMENTALISTE - ARCHIVISTE",
|
||||||
|
"T37" => "GESTIONNAIRE",
|
||||||
|
"T39" => "GESTIONNAIRE DE PARC INF & TELECOM",
|
||||||
|
"T40" => "GESTIONNAIRE GRH",
|
||||||
|
"T41" => "GESTIONNAIRE DE RESTAURANT ADMINISTRATIF",
|
||||||
|
"T42" => "GESTIONNAIRE FINANCIER",
|
||||||
|
"T43" => "INFOGRAPHISTE - MAQUETTISTE (PAO)",
|
||||||
|
"T44" => "INFORMATICIEN BUREAUTIQUE",
|
||||||
|
"T45" => "INFORMATICIEN D'EXPLOITATION",
|
||||||
|
"T46" => "INFORMATICIEN SYSTEMES ET RESEAUX",
|
||||||
|
"T47" => "INGENIEUR PEDAGOGIQUE OU EN FORM PROF",
|
||||||
|
"T48" => "MECANICIEN",
|
||||||
|
"T49" => "OPERATEUR",
|
||||||
|
"T50" => "OUVRIER",
|
||||||
|
"T51" => "AGENT DE PREMIERE INTERVENTION",
|
||||||
|
"T52" => "PERSONNEL DE RESTAURATION",
|
||||||
|
"T54" => "REDACTEUR",
|
||||||
|
"T55" => "REPROGRAPHISTE",
|
||||||
|
"T56" => "RESPONSABLE PRODUCTION ET SYSTEMES",
|
||||||
|
"T57" => "SECRETAIRE",
|
||||||
|
"T58" => "SECRETAIRE PARTICULIER",
|
||||||
|
"T59" => "SECRETAIRE MEDICAL",
|
||||||
|
"T60" => "CHARGE DE MARCHES PUBLICS",
|
||||||
|
"T61" => "CHARGE DE GESTION FINANCIERE",
|
||||||
|
"T62" => "CHARGE DE PROGRAMMATION BUDGETAIRE",
|
||||||
|
"T63" => "TECHNICIEN CONSEIL HYGIENE ET SECURITE",
|
||||||
|
"T64" => "TECHNICIEN EXPLOITATION- MAINTENANCE",
|
||||||
|
"T65" => "AGENT COMPTABLE",
|
||||||
|
"T66" => "GESTIONNAIRE D'ETABLISSEMENT",
|
||||||
|
"T80" => "Maîtrise d'ouvrage des SI",
|
||||||
|
"T81" => "Maîtrise' d'œuvre des SI",
|
||||||
|
"T82" => "AQSSI",
|
||||||
|
"T83" => "RSSI",
|
||||||
|
"T84" => "CSSI (Correspondant/Chargé de SSI)",
|
||||||
|
"X00" => "MEDIATEUR",
|
||||||
|
"X01" => "MEDECIN",
|
||||||
|
"X10" => "EXPERT PEDAGOGIQUE",
|
||||||
|
"X11" => "EXPERT CREDIT IMPOT RECHERCHE",
|
||||||
|
"X30" => "CHAUFFEUR UTILITAIRE",
|
||||||
|
"X31" => "CHAUFFEUR DE MINISTRE",
|
||||||
|
"X32" => "CHAUFFEUR DU CABINET",
|
||||||
|
"X33" => "CHAUFFEUR DE DIRECTION",
|
||||||
|
"X40" => "CONTROLEUR FINANCIER",
|
||||||
|
"X50" => "JURISTE",
|
||||||
|
"X51" => "Correspondant I&L",
|
||||||
|
"X60" => "SECRETAIRE DE CABINET",
|
||||||
|
"X70" => "ACMO H&S",
|
||||||
|
"X71" => "Chargé de service de prévention H&S",
|
||||||
|
"X80" => "Assesseur"
|
||||||
|
);
|
||||||
|
|
||||||
|
$GLOBALS['supannTypeEntite'] = array (
|
||||||
|
"S101" => "Conseil d'Administration",
|
||||||
|
"S312" => "Centre de recherche"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Table de tranduction des roles dans les entites
|
||||||
|
$GLOBALS['supannTranslateRoleEntiteValueDirectory'] = array(
|
||||||
|
"SUPANN" => array (
|
||||||
|
"role" => $GLOBALS['supannRoleGenerique'],
|
||||||
|
"type" => $GLOBALS['supannTypeEntite']
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Table des fonctions de tranduction des roles dans les entites
|
||||||
|
$GLOBALS['supannTranslateFunctionDirectory'] = array(
|
||||||
|
"no" => array(
|
||||||
|
"code" => "supanGetEntiteNameById"
|
||||||
|
)
|
||||||
|
);
|
||||||
?>
|
?>
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 851 B |
|
@ -29,7 +29,9 @@ LSerror :: defineError('SUPANN_SUPPORT_01',
|
||||||
LSerror :: defineError('SUPANN_SUPPORT_02',
|
LSerror :: defineError('SUPANN_SUPPORT_02',
|
||||||
_("SUPANN Support : The LSobject type %{type} does not exist. Can't work with entities..")
|
_("SUPANN Support : The LSobject type %{type} does not exist. Can't work with entities..")
|
||||||
);
|
);
|
||||||
|
LSerror :: defineError('SUPANN_SUPPORT_03',
|
||||||
|
_("SUPANN Support : The global array %{array} is not defined.")
|
||||||
|
);
|
||||||
|
|
||||||
// Autres erreurs
|
// Autres erreurs
|
||||||
LSerror :: defineError('SUPANN_01',
|
LSerror :: defineError('SUPANN_01',
|
||||||
|
@ -53,6 +55,7 @@ LSerror :: defineError('SUPANN_02',
|
||||||
'LS_SUPANN_LASTNAME_ATTR',
|
'LS_SUPANN_LASTNAME_ATTR',
|
||||||
'LS_SUPANN_FIRSTNAME_ATTR',
|
'LS_SUPANN_FIRSTNAME_ATTR',
|
||||||
'LS_SUPANN_LSOBJECT_ENTITE_TYPE',
|
'LS_SUPANN_LSOBJECT_ENTITE_TYPE',
|
||||||
|
'LS_SUPANN_LSOBJECT_ENTITE_FORMAT_SHORTNAME',
|
||||||
'LS_SUPANN_ETABLISSEMENT_UAI',
|
'LS_SUPANN_ETABLISSEMENT_UAI',
|
||||||
'LS_SUPANN_ETABLISSEMENT_DN'
|
'LS_SUPANN_ETABLISSEMENT_DN'
|
||||||
);
|
);
|
||||||
|
@ -64,6 +67,19 @@ LSerror :: defineError('SUPANN_02',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$MUST_DEFINE_ARRAY= array(
|
||||||
|
'supannRoleGenerique',
|
||||||
|
'supannTypeEntite',
|
||||||
|
'supannTranslateRoleEntiteValueDirectory',
|
||||||
|
'supannTranslateFunctionDirectory',
|
||||||
|
);
|
||||||
|
foreach($MUST_DEFINE_ARRAY as $array) {
|
||||||
|
if ( !isset($GLOBALS[$array]) || !is_array($GLOBALS[$array])) {
|
||||||
|
LSerror :: addErrorCode('SUPANN_SUPPORT_01',$array);
|
||||||
|
$retval=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( defined('LS_SUPANN_LSOBJECT_ENTITE_TYPE') ) {
|
if ( defined('LS_SUPANN_LSOBJECT_ENTITE_TYPE') ) {
|
||||||
if ( ! LSsession :: loadLSobject( LS_SUPANN_LSOBJECT_ENTITE_TYPE ) ) {
|
if ( ! LSsession :: loadLSobject( LS_SUPANN_LSOBJECT_ENTITE_TYPE ) ) {
|
||||||
LSerror :: addErrorCode('SUPANN_SUPPORT_02', LS_SUPANN_LSOBJECT_ENTITE_TYPE);
|
LSerror :: addErrorCode('SUPANN_SUPPORT_02', LS_SUPANN_LSOBJECT_ENTITE_TYPE);
|
||||||
|
@ -219,4 +235,145 @@ LSerror :: defineError('SUPANN_02',
|
||||||
return $retval;
|
return $retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse une valeur composite SUPANN
|
||||||
|
*
|
||||||
|
* Exemple de valeur :
|
||||||
|
*
|
||||||
|
* [key1=value][key2=value][key3=value]
|
||||||
|
*
|
||||||
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
||||||
|
*
|
||||||
|
* @param[in] $val La valeur composite
|
||||||
|
*
|
||||||
|
* @retval array Un tableau contenant key->value ou false en cas d'erreur
|
||||||
|
**/
|
||||||
|
function supannParseCompositeValue($val) {
|
||||||
|
if (preg_match_all('/\[([^=]*)=([^\]]*)\]/',$val,$matches)) {
|
||||||
|
$parseValue=array();
|
||||||
|
for($i=0;$i<count($matches[0]);$i++) {
|
||||||
|
$parseValue[$matches[1][$i]]=$matches[2][$i];
|
||||||
|
}
|
||||||
|
return $parseValue;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne une eventuelle fonction de traduction d'une valeur
|
||||||
|
* en fonction de son label et de sa cle.
|
||||||
|
*
|
||||||
|
* Utilise la table $GLOBALS['supannTranslateFunctionDirectory']
|
||||||
|
*
|
||||||
|
* @param[in] $label Le label de la valeur
|
||||||
|
* @param[in] $key La cle de la valeur
|
||||||
|
*
|
||||||
|
* @retval string|false Le nom de la fonction de traduction ou false
|
||||||
|
**/
|
||||||
|
function supannTranslateRoleEntiteFunction($label,$key) {
|
||||||
|
if (isset($GLOBALS['supannTranslateFunctionDirectory'][$label][$key])) {
|
||||||
|
return $GLOBALS['supannTranslateFunctionDirectory'][$label][$key];
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne le nom court d'une entite en fonction de son identifiant
|
||||||
|
*
|
||||||
|
* Fonction utilise comme fonction de traduction dans la fonction
|
||||||
|
* supannTranslateRoleEntiteValue()
|
||||||
|
*
|
||||||
|
* @param[in] $label Le label de la valeur
|
||||||
|
* @param[in] $key La cle de la valeur
|
||||||
|
* @param[in] $value La valeur : l'identifiant de l'entite (supannCodeEntite)
|
||||||
|
*
|
||||||
|
* @retval string Le nom de l'entite
|
||||||
|
**/
|
||||||
|
function supanGetEntiteNameById($label,$key,$value) {
|
||||||
|
if (LSsession::loadLSobject(LS_SUPANN_LSOBJECT_ENTITE_TYPE)) {
|
||||||
|
$type=LS_SUPANN_LSOBJECT_ENTITE_TYPE;
|
||||||
|
$e = new $type();
|
||||||
|
$list=$e -> listObjectsName("(supannCodeEntite=$value)",NULL,array(),LS_SUPANN_LSOBJECT_ENTITE_FORMAT_SHORTNAME);
|
||||||
|
if (count($list)==1) {
|
||||||
|
return array(
|
||||||
|
'translated' => array_pop($list),
|
||||||
|
'label' => $label
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return array(
|
||||||
|
'translated' => getFData(__("%{value} (unrecognized value)"),$value),
|
||||||
|
'label' => $label
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse une valeur a etiquette SUPANN
|
||||||
|
*
|
||||||
|
* Exemple de valeur :
|
||||||
|
*
|
||||||
|
* {SUPANN}S410
|
||||||
|
*
|
||||||
|
* @param[in] $val La valeur
|
||||||
|
*
|
||||||
|
* @retval array Un tableau cle->valeur contenant label et value ou False
|
||||||
|
**/
|
||||||
|
function supannParseLabeledValue($value) {
|
||||||
|
if (preg_match('/^\{([^\}]*)\}(.*)$/',$value,$m)) {
|
||||||
|
return array(
|
||||||
|
'label'=>$m[1],
|
||||||
|
'value'=>$m[2]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Traduit une valeur en fonction de sa cle extrait d'un attribut
|
||||||
|
* supannRoleEntite.
|
||||||
|
*
|
||||||
|
* @param[in] $key La cle
|
||||||
|
* @param[in] $value La valeur
|
||||||
|
*
|
||||||
|
* @retval array Un tableau cle->valeur contenant label et translated ou False
|
||||||
|
**/
|
||||||
|
function supannTranslateRoleEntiteValue($key,$value) {
|
||||||
|
$label='no';
|
||||||
|
$pl=supannParseLabeledValue($value);
|
||||||
|
if ($pl) {
|
||||||
|
$label=$pl['label'];
|
||||||
|
$value=$pl['value'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Translate by method
|
||||||
|
if (supannTranslateRoleEntiteFunction($label,$key)) {
|
||||||
|
$func = supannTranslateRoleEntiteFunction($label,$key);
|
||||||
|
if (function_exists($func)) {
|
||||||
|
try {
|
||||||
|
return $func($label,$key,$value);
|
||||||
|
}
|
||||||
|
catch (Exception $e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Translate by directory
|
||||||
|
elseif (isset($GLOBALS['supannTranslateRoleEntiteValueDirectory'][$label][$key][$value])) {
|
||||||
|
return array(
|
||||||
|
'translated' => $GLOBALS['supannTranslateRoleEntiteValueDirectory'][$label][$key][$value],
|
||||||
|
'label' => $label
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return array(
|
||||||
|
'label' => $label,
|
||||||
|
'translated' => $value
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (C) 2007 Easter-eggs
|
||||||
|
* http://ldapsaisie.labs.libre-entreprise.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 supannRoleEntite
|
||||||
|
*
|
||||||
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
||||||
|
*/
|
||||||
|
class LSattr_html_supannRoleEntite extends LSattr_html {
|
||||||
|
|
||||||
|
var $LSformElement_type = 'supannRoleEntite';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
|
@ -0,0 +1,77 @@
|
||||||
|
<?php
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (C) 2007 Easter-eggs
|
||||||
|
* http://ldapsaisie.labs.libre-entreprise.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');
|
||||||
|
LSsession :: loadLSaddon('supann');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Element supannRoleEntite d'un formulaire pour LdapSaisie
|
||||||
|
*
|
||||||
|
* Cette classe définis les éléments supannRoleEntite des formulaires.
|
||||||
|
* Elle étant la classe basic LSformElement.
|
||||||
|
*
|
||||||
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
class LSformElement_supannRoleEntite extends LSformElement {
|
||||||
|
|
||||||
|
var $template = 'LSformElement_supannRoleEntite.tpl';
|
||||||
|
var $fieldTemplate = 'LSformElement_supannRoleEntite_field.tpl';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne les infos d'affichage de l'élément
|
||||||
|
*
|
||||||
|
* Cette méthode retourne les informations d'affichage de l'élement
|
||||||
|
*
|
||||||
|
* @retval array
|
||||||
|
*/
|
||||||
|
function getDisplay(){
|
||||||
|
$return = $this -> getLabelInfos();
|
||||||
|
|
||||||
|
$parseValues=array();
|
||||||
|
foreach($this -> values as $val) {
|
||||||
|
$keyValue=supannParseCompositeValue($val);
|
||||||
|
if ($keyValue) {
|
||||||
|
$parseValue=array();
|
||||||
|
foreach($keyValue as $key => $value) {
|
||||||
|
$parseValue[$key]=array(
|
||||||
|
'value' => $value
|
||||||
|
);
|
||||||
|
$tr=supannTranslateRoleEntiteValue($key,$value);
|
||||||
|
if ($tr) {
|
||||||
|
if($tr['translated'])
|
||||||
|
$parseValue[$key]['translated']=$tr['translated'];
|
||||||
|
if($tr['label'])
|
||||||
|
$parseValue[$key]['label']=$tr['label'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$parseValues[]=$parseValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$return['html'] = $this -> fetchTemplate(NULL,array('parseValues' => $parseValues));
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
|
@ -0,0 +1,23 @@
|
||||||
|
<ul class='LSform{if $multiple && !$freeze} LSformElement_multiple'{/if}' id='{$attr_name}'>
|
||||||
|
{if $parseValues}
|
||||||
|
{foreach from=$parseValues item=parseValue}
|
||||||
|
{if $parseValue.role.translated}{assign var=role value=$parseValue.role.translated}{else}{assign var=role value=$parseValue.role.value}{/if}
|
||||||
|
{if $parseValue.role.label!="no"}{assign var=label_role value=$parseValue.role.label}{else}{assign var=label_role value=""}{/if}
|
||||||
|
{if $parseValue.type.translated}{assign var=type value=$parseValue.type.translated}{else}{assign var=type value=$parseValue.type.value}{/if}
|
||||||
|
{if $parseValue.type.label!="no"}{assign var=label_type value=$parseValue.type.label}{else}{assign var=label_type value=""}{/if}
|
||||||
|
{if $parseValue.code.translated}{assign var=code value=$parseValue.code.translated}{else}{assign var=code value=$parseValue.code.value}{/if}
|
||||||
|
{if $parseValue.code.label!="no"}{assign var=label_code value=$parseValue.code.label}{else}{assign var=label_code value=""}{/if}
|
||||||
|
<li>{include file=$fieldTemplate}</li>
|
||||||
|
{foreachelse}
|
||||||
|
{assign var=value value=""}
|
||||||
|
<li>{include file=$fieldTemplate}</li>
|
||||||
|
{/foreach}
|
||||||
|
{else}
|
||||||
|
{foreach from=$values item=value}
|
||||||
|
<li>{include file=$fieldTemplate}</li>
|
||||||
|
{foreachelse}
|
||||||
|
{assign var=value value=""}
|
||||||
|
<li>{include file=$fieldTemplate}</li>
|
||||||
|
{/foreach}
|
||||||
|
{/if}
|
||||||
|
</ul>
|
|
@ -0,0 +1,13 @@
|
||||||
|
{if $freeze}
|
||||||
|
{if $value or $parseValue}
|
||||||
|
{if $parseValue}
|
||||||
|
<span class='LSformElement_supannRoleEntite'>{if $label_role}<img src='{$LS_IMAGES_DIR}/LSformElement_supannRoleEntite_label_{$label_role}.png' alt='[{$label_role}]' title='{$label_role}' /> {/if}<span title='{$parseValue.role.value}'>{$role}</span> : {if $label_code}<img src='{$LS_IMAGES_DIR}/LSformElement_supannRoleEntite_label_{$label_code}.png' alt='[{$label_code}]' title='{$label_code}' /> {/if}<span title='{$parseValue.code.value}'>{$code}</span> ({if $label_type}<img src='{$LS_IMAGES_DIR}/LSformElement_supannRoleEntite_label_{$label_type}.png' alt='[{$label_type}]' title='{$label_type}' /> {/if}<span title='{$parseValue.type.value}'>{$type}</span>)</span>
|
||||||
|
{else}
|
||||||
|
<span class='LSformElement_supannRoleEntite_unparsed'>{$value}</span>
|
||||||
|
{/if}
|
||||||
|
{else}
|
||||||
|
{$noValueTxt}
|
||||||
|
{/if}
|
||||||
|
{else}
|
||||||
|
<input type='text' name='{$attr_name}[]' class='LSformElement_text' value="{$value}" autocomplete="off"/>
|
||||||
|
{/if}
|
Loading…
Reference in a new issue