Subversion Repositories eFlore/Projets.eflore-projets

Rev

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

Rev Author Line No. Line
163 jpm 1
<?php
2
class NomRangDecorateur extends NomDecorateur {
3
 
4
	private $nomDecorateur = null;
5
	private $rang = null;
6
	private $bdd = null;
7
	private $ontologieHrefTpl = null;
8
 
9
	public function __construct(NomDecorateur $nomDecorateur, Bdd $bdd = null, $ontologieHrefTpl) {
10
		$this->nomDecorateur = $nomDecorateur;
11
		$this->rang = $this->nomDecorateur->nom->getTag('rang');
12
		$this->bdd = is_null($bdd) ? new Bdd() : $bdd;
13
		$this->ontologieHrefTpl = $ontologieHrefTpl;
14
	}
15
 
16
	public function ajouterCode() {
17
		$squelette = 'bdnt.rangTaxo:%s';
18
		$rangCode = sprintf($squelette, $this->rang);
19
		$this->nomDecorateur->nomFormate['rang.code'] = $rangCode;
20
	}
21
 
22
	public function ajouterHref() {
23
		$href = sprintf($this->ontologieHrefTpl, $this->rang);
24
		$this->nomDecorateur->nomFormate['rang.href'] = $href;
25
	}
26
 
27
	public function ajouterIntitule() {
28
		$resultat = $this->rechercherOntologieNomParCode($this->rang);
29
		$this->nomDecorateur->nomFormate['rang'] = $resultat['nom'];
30
	}
31
 
188 jpm 32
	// TODO : supprimer cette recherche dans la bdd de cette classe
163 jpm 33
	private function rechercherOntologieNomParCode($code) {
34
		$code = $this->bdd->proteger($code);
35
		$requete =	'SELECT nom '.
36
					'FROM bdnt_ontologies_v4_30 '.
37
					"WHERE code = $code ";
38
		$resultats = $this->bdd->recuperer($requete);
39
		return $resultats;
40
	}
41
}
42
?>