Subversion Repositories eFlore/Projets.eflore-projets

Rev

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

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