Skip to content
Snippets Groups Projects
Select Git revision
  • e597522fbf605400988726f1ccbc80d60b1de39b
  • master default protected
  • cleanup_fixtures
  • add-openvox
  • freebsd-14
  • remove-legacy-top-scope-syntax
  • rel430
  • tests
  • revert-363-augeas-module-cleanup
  • release-4.1.0
  • puppet8
  • relax-dependencies
  • rel400
  • mode
  • puppet7
  • release-3.1.0
  • freebsd13
  • freebsd11
  • stdlib
  • centos
  • fedora
  • v5.1.0
  • v5.0.0
  • v4.5.0
  • v4.4.0
  • v4.3.0
  • v4.2.1
  • v4.2.0
  • v4.1.0
  • v4.0.0
  • v3.1.0
  • v3.0.0
  • v2.0.0
  • 1.12.0
  • 1.11.0
  • 1.10.0
  • 1.9.0
  • 1.8.0
  • 1.7.0
  • 1.6.0
  • 1.5.0
41 results

postfix-mta.pp

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    Individu.php 6.62 KiB
    <?php
    
    namespace Octopus\Entity\Db;
    
    // TODO prendre les overwrites, normalisés, phonétiques
    use DateTime;
    use Doctrine\Common\Collections\ArrayCollection;
    use UnicaenUtilisateur\Service\RechercheIndividu\RechercheIndividuResultatInterface;
    
    class Individu implements RechercheIndividuResultatInterface
    {
        /** @var integer */
        private $cIndividuChaine;
        /** @var Source */
        private $cSource;
        /** @var integer */
        private $cEtu;
        /** @var integer */
        private $cIne;
        /** @var string */
        private $sexe;
        /** @var string */
        private $prenom;
        /** @var string */
        private $prenom_ow;
        /** @var string */
        private $prenom2;
        /** @var string */
        private $prenom3;
        /** @var string */
        private $nomFamille;
        /** @var string */
        private $nomFamille_ow;
        /** @var string */
        private $nomUsage;
        /** @var string */
        private $nomUsage_ow;
        /** @var string */
        private $dateNaissance;
        /** @var string */
        private $villeNaissance;
        /** @var string */
        private $cCommuneNaissance;
        /** @var string */
        private $cDeptNaissance;
        /** @var string */
        private $cPaysNaissance;
        /** @var string */
        private $cPaysNationalite;
        /** @var string */
        private $telPersonnelle;
        /** @var string */
        private $emailPersonnelle;
        /** @var DateTime */
        private $dateModification;
    
        /** @var ArrayCollection (IndividuAffectation) */
        private $affectations;
        /** @var ArrayCollection (IndividuCompte) */
        private $comptes;
        /** @var ArrayCollection (IndividuInscription) */
        private $inscriptions;
    
        public function __construct()
        {
            $this->affectations = new ArrayCollection();
            $this->comptes = new ArrayCollection();
            $this->inscriptions = new ArrayCollection();
        }
    
    
        /**
         * @return int
         */
        public function getCIndividuChaine()
        {
            return $this->cIndividuChaine;
        }
    
    
        /**
         * @return Source
         */
        public function getCSource()
        {
            return $this->cSource;
        }
    
        /**
         * @return int
         */
        public function getCEtu()
        {
            return $this->cEtu;
        }
    
        /**
         * @return int
         */
        public function getCIne()
        {
            return $this->cIne;
        }
    
        /**
         * @return string
         */
        public function getSexe()
        {
            return $this->sexe;
        }
    
        /**
         * @return string
         */
        public function getPrenom()
        {
            return $this->prenom_ow??$this->prenom;
        }
    
        /**
         * @return string
         */
        public function getPrenom2()
        {
            return $this->prenom2;
        }
    
        /**
         * @return string
         */
        public function getPrenom3()
        {
            return $this->prenom3;
        }
    
        /**
         * @return string
         */
        public function getNomFamille()
        {
            return $this->nomFamille_ow??$this->nomFamille;
        }
    
        /**
         * @return string
         */
        public function getNomUsage()
        {
            return $this->nomUsage_ow??$this->nomFamille;
        }
    
        /**
         * @return string
         */
        public function getDateNaissance()
        {
            return $this->dateNaissance;
        }
    
        /**
         * @return string
         */
        public function getVilleNaissance()
        {
            return $this->villeNaissance;
        }
    
        /**
         * @return string
         */
        public function getCCommuneNaissance()
        {
            return $this->cCommuneNaissance;
        }
    
        /**
         * @return string
         */
        public function getCDeptNaissance()
        {
            return $this->cDeptNaissance;
        }
    
        /**
         * @return string
         */
        public function getCPaysNaissance()
        {
            return $this->cPaysNaissance;
        }
    
        /**
         * @return string
         */
        public function getCPaysNationalite()
        {
            return $this->cPaysNationalite;
        }
    
        /**
         * @return string
         */
        public function getTelPersonnelle()
        {
            return $this->telPersonnelle;
        }
    
        /**
         * @return string
         */
        public function getEmailPersonnelle()
        {
            return $this->emailPersonnelle;
        }
    
        /**
         * @return DateTime
         */
        public function getDateModification()
        {
            return $this->dateModification;
        }
    
        /**
         * @param boolean $active
         * @return IndividuAffectation[]
         */
        public function getAffectations($active = false) {
            $affectations = $this->affectations->toArray();
    
            if ($active) {
                $affectations = array_filter($affectations, function(IndividuAffectation $a) { return ($a->getDateFin() === null);});
            }
            usort($affectations, function(IndividuAffectation $a, IndividuAffectation $b) { return $a->getDateDebut() <=> $b->getDateDebut();});
            return $affectations;
        }
    
        /**
         * @return IndividuInscription[]
         */
        public function getInscriptions()
        {
            $inscriptions = $this->inscriptions->toArray();
            usort($inscriptions, function (IndividuInscription $a, IndividuInscription $b) { return $a->getAnnee() <=> $b->getAnnee();});
            return $inscriptions;
        }
    
        /**
         * @return IndividuCompte[]
         */
        public function getComptes() : array
        {
            $comptes = $this->comptes->toArray();
            array_filter($comptes, function(IndividuCompte $a) { return $a->getType()->getNom() === IndividuCompteType::INDIVIDU_COMPTE_UTILISATEUR;});
            return $comptes;
        }
    
        /**
         * @return string
         */
        public function __toString()
        {
            $texte  = $this->getPrenom();
            if ($this->getNomUsage()) $texte .= " " . $this->getNomUsage();
            if ($this->getNomUsage() != $this->getNomFamille()) {
                if ($this->getNomUsage()) $texte .= "-"; else $texte .= " ";
                $texte .= $this->getNomFamille();
            }
            return $texte;
        }
    
        /** Missing ... */
    
        public function getId()
        {
            return $this->cIndividuChaine;
        }
    
        public function getEmail(): ?string
        {
            $compteActif = null;
            /** @var IndividuCompte $compte */
            foreach ($this->comptes as $compte) {
                if ($compte->getStatut() === 1) {
                    $compteActif = $compte;
                    break;
                }
            }
            return $compteActif?->getEmail();
        }
    
        public function getUsername(string $attribut = "supannAliasLogin"): string
        {
            $compteActif = null;
            /** @var IndividuCompte $compte */
            foreach ($this->comptes as $compte) {
                if ($compte->getStatut() === 1) {
                    $compteActif = $compte;
                    break;
                }
            }
            return $compteActif->getLogin();
        }
    
        public function getDisplayname(): string
        {
            return $this->prenom_ow.' '.$this->getNomUsage()??$this->getNomFamille();
        }
    }