Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 412 | Rev 444 | 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;
394 aurelien 21
	private $wikini = null;
291 jpm 22
 
23
	public function __construct(Conteneur $conteneur) {
24
		$this->conteneur = $conteneur;
294 delphine 25
		$this->nomCourant = $this->conteneur->getNomCourant();
291 jpm 26
		$this->textes = $this->conteneur->getApiTextes();
394 aurelien 27
		$this->wikini = $this->conteneur->getApiWikini();
291 jpm 28
		$this->meta = $this->conteneur->getApiMetaDonnees();
29
		$this->appUrls = $this->conteneur->getAppUrls();
30
	}
31
 
32
	public function obtenirDonnees() {
33
		$donnees = array();
34
		$donnees['wp'] = $this->getWp();
322 delphine 35
		$donnees['coste'] = $this->getCoste();
394 aurelien 36
		$donnees['wikini'] = $this->getWikini();
272 delphine 37
		return $donnees;
38
	}
291 jpm 39
 
40
	public function getBloc() {
412 delphine 41
		$donnees['titre'] = "Description de Coste";
42
		$description = $this->getCoste();
43
		if ($description['description'] == 'n') {
44
			$donnees['titre'] = "Description collaborative";
45
			$description = $this->getWikini();
409 delphine 46
		}
412 delphine 47
		$donnees['description'] = $description['description'];
291 jpm 48
		return $donnees;
49
	}
50
 
51
	private function getWp() {
52
		$wp = array();
53
		$this->textes->setProjet('wikipedia');
54
		$this->textes->setId($this->getIdWp());
55
		$wp['titre'] = $texte['titre'];
435 aurelien 56
		$wp['lien'] = $this->textes->getPageUrl();
291 jpm 57
		$wp['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('wikipedia');
328 aurelien 58
 
291 jpm 59
		return $wp;
60
	}
61
 
62
	private function getIdWp() {
294 delphine 63
		$nomSci = $this->nomCourant->getNomRetenu()->get('nom_sci');
291 jpm 64
		$idWp = str_replace(' ', '_', $nomSci);
295 jpm 65
		$idWp = urlencode($idWp);
291 jpm 66
		return $idWp;
67
	}
322 delphine 68
 
394 aurelien 69
	private function getWikini() {
70
		$wikini = array();
71
		$wikini['titre'] = 'Wikini';
72
		$referentiel = $this->conteneur->getParametre('referentiel');
73
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
74
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
75
		$wikini['description'] = $this->wikini->getTexteFormate($page_wiki, 'description');
76
		return $wikini;
77
	}
78
 
322 delphine 79
	private function getCoste() {
80
		$coste = array();
81
		$this->textes->setProjet('coste');
82
		$this->textes->setId('bdtfx.nn:'.$this->nomCourant->getNns());
83
		$texte = $this->textes->getTexte();
84
		$coste['titre'] = $texte['titre'];
85
		$coste['description'] = $texte['texte'];
86
		$this->meta->setProjet('coste');
87
		$coste['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('coste');
88
		return $coste;
89
	}
272 delphine 90
}
91
?>