Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev Author Line No. Line
272 delphine 1
<?php
2
// declare(encoding='UTF-8');
3
/**
4
 * Classe mère du module Liste.
5
 *
6
 * @category	PHP 5.2
7
 * @package		eflore-consultation
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
10
 * @copyright	2011 Tela-Botanica
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
12
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
13
 * @version		$Id$
14
 */
15
class Description extends aControleur {
291 jpm 16
 
17
	private $conteneur = null;
294 delphine 18
	private $nomCourant = null;
291 jpm 19
	private $textes = null;
20
	private $meta = null;
21
 
22
	public function __construct(Conteneur $conteneur) {
23
		$this->conteneur = $conteneur;
294 delphine 24
		$this->nomCourant = $this->conteneur->getNomCourant();
291 jpm 25
		$this->textes = $this->conteneur->getApiTextes();
26
		$this->meta = $this->conteneur->getApiMetaDonnees();
27
		$this->appUrls = $this->conteneur->getAppUrls();
28
	}
29
 
30
	public function obtenirDonnees() {
31
		$donnees = array();
32
		$donnees['wp'] = $this->getWp();
322 delphine 33
		$donnees['coste'] = $this->getCoste();
272 delphine 34
		return $donnees;
35
	}
291 jpm 36
 
37
	public function getBloc() {
38
		$this->textes->setProjet('wikipedia');
39
		$this->textes->setId($this->getIdWp());
40
		$this->textes->setSectionTitre('Description');
41
		$texte = $this->textes->getTexte();
42
		$donnees['texte'] = $texte['texte'];
43
		return $donnees;
44
	}
45
 
46
	private function getWp() {
47
		$wp = array();
48
		$this->textes->setProjet('wikipedia');
49
		$this->textes->setId($this->getIdWp());
50
		$texte = $this->textes->getTexte();
51
		$wp['titre'] = $texte['titre'];
52
		$wp['description'] = $texte['texte'];
53
		$this->meta->setProjet('wikipedia');
54
		$wp['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('wikipedia');
55
		return $wp;
56
	}
57
 
58
	private function getIdWp() {
294 delphine 59
		$nomSci = $this->nomCourant->getNomRetenu()->get('nom_sci');
291 jpm 60
		$idWp = str_replace(' ', '_', $nomSci);
295 jpm 61
		$idWp = urlencode($idWp);
291 jpm 62
		return $idWp;
63
	}
322 delphine 64
 
65
	private function getCoste() {
66
		$coste = array();
67
		$this->textes->setProjet('coste');
68
		$this->textes->setId('bdtfx.nn:'.$this->nomCourant->getNns());
69
		$texte = $this->textes->getTexte();
70
		$coste['titre'] = $texte['titre'];
71
		$coste['description'] = $texte['texte'];
72
		$this->meta->setProjet('coste');
73
		$coste['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('coste');
74
		return $coste;
75
	}
272 delphine 76
}
77
?>