Skip to content
Snippets Groups Projects
Select Git revision
  • fb1c50d88a42672b490d3dad7c1ad18e18eaa01b
  • master default protected
  • ll-workflow
  • alc-scindage-donnees-pj
  • b24
  • FJ_LL_Tbl_Contrat
  • alc-docker-node
  • ll-apiplatform
  • php84
  • ll-rgpd
  • b23
  • alc-filtre-type-intervenant
  • ll-sans-mdb5
  • formules-ancienne-infra
  • ll-formules
  • alc-intervenant-dmep
  • ll-suppr-v_vol-s
  • b20
  • ll-postgresql
  • b23.0.1
  • b22
  • 24.8
  • 24.7
  • 24.6
  • 24.5
  • 24.4
  • 24.3
  • 24.2
  • 24.1
  • 24.0
  • 23.15
  • 24.0-beta19
  • 24.0-beta18
  • 24.0-beta17
  • 24.0-beta16
  • 24.0-beta15
  • 24.0-beta14
  • 24.0-beta13
  • 23.14
  • 24.0-beta12
  • 24.0-beta11
41 results

DataGen.php

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();
        }
    }