Commit f7a511b6 authored by David Surville's avatar David Surville
Browse files

[Evolution] Ajout des attributs : supannEtablissement,...

[Evolution] Ajout des attributs : supannEtablissement, supannEtuAnneeInscription, supannEtuCursusAnnee, supannEtuDiplome, supannEtuEtape
parent a45afe81
Loading
Loading
Loading
Loading
+112 −2
Changes for src/UnicaenLdap/Entity/Base/People.php: 112 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -233,9 +233,9 @@ class People extends Entity
    /**
     * Liste des patterns spécifiques utilisés pour différents attributs
     */
    static protected $structure_pattern = '/^(?<code>[\w-]+);(?<libelle>.+)$/';
    static protected $structure_pattern = '/^(?<code>[\w\-]+);(?<libelle>.+)$/';
    static protected $secteur_disciplinaire_pattern = '/^(?<code>[\d]+);(?<libelle>.+)$/';
    static protected $role_pattern = '/^\[role=(?<role>[\w-]+)\]\[type=(?<type>[\w-]+)\]\[code=(?<code>[\w-]+)\]\[libelle=(?<libelle>.+)\]$/';
    static protected $role_pattern = '/^\[role=(?<role>[\w\-]+)\]\[type=(?<type>[\w\-]+)\]\[code=(?<code>[\w\-]+)\]\[libelle=(?<libelle>.+)\]$/';
    static protected $role_src_pattern = '/^(?<code>[\d]{4});(?<libelle>.+)$/';


@@ -1261,6 +1261,116 @@ class People extends Entity
        return $this;
    }

    /**
     * Attribut Ldap "supannEtablissement"
     *
     * @param array|string|null $value
     * @param bool $append
     * @return $this
     * @throws Exception
     * @throws LdapException
     */
    public function setSupannEtablissement($value = null, $append = false)
    {
        $value = $this->preFormat($value);
        $value = array_filter($value, function ($v) {
            return preg_match(self::$attribute_with_label_pattern, $v);
        });

        $this->appendOrNot('supannEtablissement', $value, $append);

        return $this;
    }

    /**
     * Attribut Ldap "supannEtuAnneeInscription"
     *
     * @param array|string|null $value
     * @param bool $append
     * @return $this
     * @throws Exception
     * @throws LdapException
     */
    public function setSupannEtuAnneeInscription($value = null, $append = false)
    {
        $value = $this->preFormat($value);
        $value = array_filter($value, function ($v) {
            return preg_match('/\d{4}/', $v);
        });

        $this->appendOrNot('supannEtuAnneeInscription', array_filter($value), $append);

        return $this;
    }

    /**
     * Attribut Ldap "supannEtuCursusAnnee"
     *
     * @param array|string|null $value
     * @param bool $append
     * @return $this
     * @throws Exception
     * @throws LdapException
     */
    public function setSupannEtuCursusAnnee($value = null, $append = false)
    {
        $value = $this->preFormat($value);
        $supannLabel = $this->getLabel('SUPANN');
        $value = array_map(function ($val) use ($supannLabel) {
            if (is_string($val)) {
                return preg_match("/^".$supannLabel."[\d]{4}$/", $val) ? $val : sprintf('%s%s', $supannLabel, $val);
            } else {
                return null;
            }
        }, $value);

        $this->appendOrNot('supannEtuCursusAnnee', array_filter($value), $append);

        return $this;
    }

    /**
     * Attribut Ldap "supannEtuDiplome"
     *
     * @param array|string|null $value
     * @param bool $append
     * @return $this
     * @throws Exception
     * @throws LdapException
     */
    public function setSupannEtuDiplome($value = null, $append = false)
    {
        $value = $this->preFormat($value);
        $value = array_filter($value, function ($v) {
            return preg_match(self::$attribute_with_label_pattern, $v);
        });

        $this->appendOrNot('supannEtuDiplome', $value, $append);

        return $this;
    }

    /**
     * Attribut Ldap "supannEtuEtape"
     *
     * @param array|string|null $value
     * @param bool $append
     * @return $this
     * @throws Exception
     * @throws LdapException
     */
    public function setSupannEtuEtape($value = null, $append = false)
    {
        $value = $this->preFormat($value);
        $value = array_filter($value, function ($v) {
            return preg_match(self::$attribute_with_label_pattern, $v);
        });

        $this->appendOrNot('supannEtuEtape', $value, $append);

        return $this;
    }

    /**
     * Attribut Ldap "rid"
     *
+1 −1
Changes for src/UnicaenLdap/Entity/Entity.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ abstract class Entity
    /**
     * Liste des patterns génériques utilisés pour différents attributs
     */
    static protected $attribute_with_label_pattern = '/^\{(?<etiquette>[\w-:]+)\}(?<identifiant>.+)$/';
    static protected $attribute_with_label_pattern = '/^\{(?<etiquette>[\w\-:]+)\}(?<identifiant>.+)$/';

    /**
     * Liste des patterns spécifiques utilisés pour différents attributs
+16 −0
Changes for src/UnicaenLdap/Service/AbstractService.php: 16 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -66,6 +66,13 @@ abstract class AbstractService implements
     */
    protected $code_structure_prefixe = 'HS_';

    /**
     * Préfixe utilisé pour le code des modules d'enseignement
     *
     * @var string
     */
    protected $code_module_enseignement_prefixe = 'AE_';


    /**
     * Compteur utilisé dans la recherche
@@ -139,6 +146,15 @@ abstract class AbstractService implements
        return $this->code_structure_prefixe;
    }

    /**
     * Retourne le préfixe utilisé pour les codes des modules d'enseignement
     *
     * @return string
     */
    public function getCodeModuleEnseignementPrefixe()
    {
        return $this->code_module_enseignement_prefixe;
    }

    /**
     * Retourne la liste de toutes les entités correspondantes