Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 163 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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