Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 294 | Rev 322 | 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();
272 delphine 33
		return $donnees;
34
	}
291 jpm 35
 
36
	public function getBloc() {
37
		$this->textes->setProjet('wikipedia');
38
		$this->textes->setId($this->getIdWp());
39
		$this->textes->setSectionTitre('Description');
40
		$texte = $this->textes->getTexte();
41
		$donnees['texte'] = $texte['texte'];
42
		return $donnees;
43
	}
44
 
45
	private function getWp() {
46
		$wp = array();
47
		$this->textes->setProjet('wikipedia');
48
		$this->textes->setId($this->getIdWp());
49
		$texte = $this->textes->getTexte();
50
		$wp['titre'] = $texte['titre'];
51
		$wp['description'] = $texte['texte'];
52
		$this->meta->setProjet('wikipedia');
53
		$wp['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('wikipedia');
54
		return $wp;
55
	}
56
 
57
	private function getIdWp() {
294 delphine 58
		$nomSci = $this->nomCourant->getNomRetenu()->get('nom_sci');
291 jpm 59
		$idWp = str_replace(' ', '_', $nomSci);
295 jpm 60
		$idWp = urlencode($idWp);
291 jpm 61
		return $idWp;
62
	}
272 delphine 63
}
64
?>