Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 843 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
163 jpm 1
<?php
2
class NomChampsProjetDecorateur extends NomDecorateur {
207 jpm 3
 
163 jpm 4
	private $nomDecorateur = null;
5
	private $champs = array();
207 jpm 6
	protected $correspondances = array();
7
 
163 jpm 8
	public function __construct(NomDecorateur $nomDecorateur, Array $champs) {
9
		$this->nomDecorateur = $nomDecorateur;
10
		$this->champs = $champs;
207 jpm 11
		$this->correspondances = array_flip($this->champs);
163 jpm 12
	}
207 jpm 13
 
14
	public function traiterChampsRetour(Array $champsRetour) {
15
		foreach ($champsRetour as $champ) {
16
			if (array_key_exists($champ, $this->correspondances)) {
17
				$champBdd = $this->correspondances[$champ];
18
				$champSortie = $champ;
19
				if ($this->nomDecorateur->nom->verifierTag($champBdd)) {
20
					$valeur = $this->nomDecorateur->nom->getTag($champBdd);
21
					$this->nomDecorateur->nomFormate[$champSortie] = $valeur;
22
				}
23
			}
24
		}
25
	}
26
 
163 jpm 27
	public function ajouterChampsSupplementaires() {
28
		foreach ($this->champs as $champBdd => $champSortie) {
29
			if ($this->nomDecorateur->nom->verifierTag($champBdd)) {
30
				$valeur = $this->nomDecorateur->nom->getTag($champBdd);
31
				$this->nomDecorateur->nomFormate[$champSortie] = $valeur;
32
			}
33
		}
34
	}
35
}
36
?>