Subversion Repositories eFlore/Projets.eflore-projets

Rev

Go to most recent revision | Details | 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
 
32
	private function rechercherOntologieNomParCode($code) {
33
		$code = $this->bdd->proteger($code);
34
		$requete =	'SELECT nom '.
35
					'FROM bdnt_ontologies_v4_30 '.
36
					"WHERE code = $code ";
37
		$resultats = $this->bdd->recuperer($requete);
38
		return $resultats;
39
	}
40
}
41
?>