Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 206 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 206 Rev 208
Line 1... Line 1...
1
<?php
1
<?php
2
class NomDetailsGenerique implements NomDetails {
2
class NomDetailsGenerique implements NomDetails {
Line 3... Line 3...
3
 
3
 
4
	private $parametres = null;
4
	private $parametres = null;
5
	private $ressources = null;
5
	private $ressources = null;
6
	private $bdd = null;
6
	private $nomDao = null;
7
	private $projet = null;
-
 
8
	private $versions = null;
-
 
9
	private $detailsHrefTpl = null;
-
 
10
	private $ontologieHrefTpl = null;
-
 
11
 
7
	private $nomFormateur = null;
12
	private $nom = array();
-
 
Line 13... Line 8...
13
	private $champsProjet = array();
8
	private $nom = array();
14
 
9
 
15
	public function __construct(Ressources $ressources, Parametres $parametres, Bdd $bdd) {
10
	public function __construct(Ressources $ressources, Parametres $parametres, NomDAO $nomDao, NomFormateur $nomFormateur) {
16
		$this->ressources = $ressources;
-
 
17
		$this->parametres = $parametres;
-
 
18
		$this->bdd = $bdd;
-
 
19
	}
-
 
20
 
11
		$this->ressources = $ressources;
21
	public function setProjet($projet) {
-
 
22
		$this->projet = $projet;
-
 
23
	}
-
 
24
 
-
 
25
	public function setVersions($versions) {
-
 
26
		$this->versions = $versions;
-
 
27
	}
-
 
28
 
12
		$this->parametres = $parametres;
29
	public function setChampsProjet($champsProjet) {
-
 
30
		$this->champsProjet = $champsProjet;
-
 
31
	}
-
 
32
 
-
 
33
	public function setDetailsHrefTpl($tpl) {
-
 
34
		$this->detailsHrefTpl = $tpl;
-
 
35
	}
-
 
36
 
-
 
37
	public function setOntologieHrefTpl($tpl) {
13
		$this->nomDao = $nomDao;
Line 38... Line 14...
38
		$this->ontologieHrefTpl = $tpl;
14
		$this->nomFormateur = $nomFormateur;
39
	}
15
	}
40
 
16
 
41
	public function consulter() {
17
	public function consulter() {
42
		$infos = $this->rechercherInfosNom();
18
		$this->nom = $this->nomDao->rechercherInfosNom();
Line 43... Line -...
43
		$retour = $this->formaterDetails($infos);
-
 
44
		return $retour;
-
 
45
	}
-
 
46
 
-
 
47
	private function getTable() {
-
 
48
		$versions = $this->versions->getVersions();
-
 
49
		return $this->projet.'_v'.end($versions);
-
 
50
	}
-
 
51
 
-
 
52
	private function rechercherInfosNom() {
-
 
53
		$table = $this->getTable();
-
 
54
		$detailsId = $this->ressources->getDetailsId();
-
 
55
		$detailsId = $this->bdd->proteger($detailsId);
-
 
56
		$requete =
-
 
57
			'SELECT ns.*,  '.
-
 
58
			'	nr.nom_sci AS nr_nom_sci, nb.nom_sci AS nb_nom_sci '.
-
 
59
			"FROM $table AS ns ".
-
 
60
			"	LEFT JOIN $table AS nr ON (ns.num_nom_retenu = nr.num_nom) ".
-
 
61
			"	LEFT JOIN $table AS nb ON (ns.basionyme = nb.num_nom) ".
-
 
62
			"WHERE ns.num_nom = $detailsId ";
-
 
63
		$resultats = $this->bdd->recuperer($requete);
19
		$retour = $this->formaterDetails();
64
		return $resultats;
-
 
65
	}
-
 
66
 
20
		return $retour;
67
	private function formaterDetails($infos) {
-
 
68
		$nomAFormater = new NomDO($infos);
-
 
69
		$formateur = new NomFormateur($nomAFormater);
-
 
70
		$formateur->setBdd($this->bdd);
21
	}
71
		$formateur->setChampsProjet($this->champsProjet);
22
 
72
		$formateur->setDetailsHrefTpl($this->detailsHrefTpl);
23
	private function formaterDetails() {
73
		$formateur->setOntologieHrefTpl($this->ontologieHrefTpl);
24
		$this->nomFormateur->setNomAFormater($this->nom);
74
		$formateur->setChampsRetour($this->parametres->getListe('retour.champs'));
25
		$this->nomFormateur->setChampsRetour($this->parametres->getListe('retour.champs'));
75
		$details = $formateur->formaterDetails();
26
		$details = $this->nomFormateur->formaterDetails();
76
		return $details;
27
		return $details;