Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 207 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
class NomChampsProjetDecorateur extends NomDecorateur {

        private $nomDecorateur = null;
        private $champs = array();
        protected $correspondances = array();

        public function __construct(NomDecorateur $nomDecorateur, Array $champs) {
                $this->nomDecorateur = $nomDecorateur;
                $this->champs = $champs;
                $this->correspondances = array_flip($this->champs);
        }

        public function traiterChampsRetour(Array $champsRetour) {
                foreach ($champsRetour as $champ) {
                        if (array_key_exists($champ, $this->correspondances)) {
                                $champBdd = $this->correspondances[$champ];
                                $champSortie = $champ;
                                if ($this->nomDecorateur->nom->verifierTag($champBdd)) {
                                        $valeur = $this->nomDecorateur->nom->getTag($champBdd);
                                        $this->nomDecorateur->nomFormate[$champSortie] = $valeur;
                                }
                        }
                }
        }

        public function ajouterChampsSupplementaires() {
                foreach ($this->champs as $champBdd => $champSortie) {
                        if ($this->nomDecorateur->nom->verifierTag($champBdd)) {
                                $valeur = $this->nomDecorateur->nom->getTag($champBdd);
                                $this->nomDecorateur->nomFormate[$champSortie] = $valeur;
                        }
                }
        }
}
?>