Subversion Repositories eFlore/Projets.eflore-projets

Rev

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

Rev 206 Rev 208
1
<?php
1
<?php
2
class NomDetailsGenerique implements NomDetails {
2
class NomDetailsGenerique implements NomDetails {
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;
7
	private $nomFormateur = null;
8
	private $versions = null;
-
 
9
	private $detailsHrefTpl = null;
-
 
10
	private $ontologieHrefTpl = null;
-
 
11
 
-
 
12
	private $nom = array();
8
	private $nom = array();
13
	private $champsProjet = 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;
11
		$this->ressources = $ressources;
17
		$this->parametres = $parametres;
-
 
18
		$this->bdd = $bdd;
-
 
19
	}
-
 
20
 
-
 
21
	public function setProjet($projet) {
12
		$this->parametres = $parametres;
22
		$this->projet = $projet;
-
 
23
	}
-
 
24
 
-
 
25
	public function setVersions($versions) {
-
 
26
		$this->versions = $versions;
-
 
27
	}
-
 
28
 
-
 
29
	public function setChampsProjet($champsProjet) {
13
		$this->nomDao = $nomDao;
30
		$this->champsProjet = $champsProjet;
-
 
31
	}
-
 
32
 
-
 
33
	public function setDetailsHrefTpl($tpl) {
-
 
34
		$this->detailsHrefTpl = $tpl;
-
 
35
	}
-
 
36
 
-
 
37
	public function setOntologieHrefTpl($tpl) {
-
 
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();
43
		$retour = $this->formaterDetails($infos);
19
		$retour = $this->formaterDetails();
44
		return $retour;
20
		return $retour;
45
	}
21
	}
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);
-
 
64
		return $resultats;
-
 
65
	}
-
 
66
 
22
 
67
	private function formaterDetails($infos) {
-
 
68
		$nomAFormater = new NomDO($infos);
-
 
69
		$formateur = new NomFormateur($nomAFormater);
23
	private function formaterDetails() {
70
		$formateur->setBdd($this->bdd);
-
 
71
		$formateur->setChampsProjet($this->champsProjet);
-
 
72
		$formateur->setDetailsHrefTpl($this->detailsHrefTpl);
-
 
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;
77
	}
28
	}
78
}
29
}
79
?>
30
?>