Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 328 Rev 394
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Classe mère du module Liste.
4
 * Classe mère du module Liste.
5
 *
5
 *
6
 * @category	PHP 5.2
6
 * @category	PHP 5.2
7
 * @package		eflore-consultation
7
 * @package		eflore-consultation
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
10
 * @copyright	2011 Tela-Botanica
10
 * @copyright	2011 Tela-Botanica
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
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
12
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
13
 * @version		$Id$
13
 * @version		$Id$
14
 */
14
 */
15
class Description extends aControleur {
15
class Description extends aControleur {
16
 
16
 
17
	private $conteneur = null;
17
	private $conteneur = null;
18
	private $nomCourant = null;
18
	private $nomCourant = null;
19
	private $textes = null;
19
	private $textes = null;
20
	private $meta = null;
20
	private $meta = null;
-
 
21
	private $wikini = null;
21
 
22
 
22
	public function __construct(Conteneur $conteneur) {
23
	public function __construct(Conteneur $conteneur) {
23
		$this->conteneur = $conteneur;
24
		$this->conteneur = $conteneur;
24
		$this->nomCourant = $this->conteneur->getNomCourant();
25
		$this->nomCourant = $this->conteneur->getNomCourant();
25
		$this->textes = $this->conteneur->getApiTextes();
26
		$this->textes = $this->conteneur->getApiTextes();
-
 
27
		$this->wikini = $this->conteneur->getApiWikini();
26
		$this->meta = $this->conteneur->getApiMetaDonnees();
28
		$this->meta = $this->conteneur->getApiMetaDonnees();
27
		$this->appUrls = $this->conteneur->getAppUrls();
29
		$this->appUrls = $this->conteneur->getAppUrls();
28
	}
30
	}
29
 
31
 
30
	public function obtenirDonnees() {
32
	public function obtenirDonnees() {
31
		$donnees = array();
33
		$donnees = array();
32
		$donnees['wp'] = $this->getWp();
34
		$donnees['wp'] = $this->getWp();
33
		$donnees['coste'] = $this->getCoste();
35
		$donnees['coste'] = $this->getCoste();
-
 
36
		$donnees['wikini'] = $this->getWikini();
34
		return $donnees;
37
		return $donnees;
35
	}
38
	}
36
 
39
 
37
	public function getBloc() {
40
	public function getBloc() {
38
		$this->textes->setProjet('wikipedia');
41
		$this->textes->setProjet('wikipedia');
39
		$this->textes->setId($this->getIdWp());
42
		$this->textes->setId($this->getIdWp());
40
		$this->textes->setSectionTitre('Description');
43
		$this->textes->setSectionTitre('Description');
41
		$texte = $this->textes->getTexte();
44
		$texte = $this->textes->getTexte();
42
		$donnees['texte'] = $texte['texte'];
45
		$donnees['texte'] = $texte['texte'];
43
		return $donnees;
46
		return $donnees;
44
	}
47
	}
45
 
48
 
46
	private function getWp() {
49
	private function getWp() {
47
		$wp = array();
50
		$wp = array();
48
		$this->textes->setProjet('wikipedia');
51
		$this->textes->setProjet('wikipedia');
49
		$this->textes->setId($this->getIdWp());
52
		$this->textes->setId($this->getIdWp());
50
		$texte = $this->textes->getTexte();
53
		$texte = $this->textes->getTexte();
51
		$wp['titre'] = $texte['titre'];
54
		$wp['titre'] = $texte['titre'];
52
		$wp['description'] = $texte['texte'];
55
		$wp['description'] = $texte['texte'];
53
		$this->meta->setProjet('wikipedia');
56
		$this->meta->setProjet('wikipedia');
54
		
57
		
55
		// TODO: décommenter ceci et remplacer le titre en dur lorsque le service
58
		// TODO: décommenter ceci et remplacer le titre en dur lorsque le service
56
		// web wikipedia renverra les bonnes metadonnées
59
		// web wikipedia renverra les bonnes metadonnées
57
		//$meta = $this->meta->getMetaDonnees();
60
		//$meta = $this->meta->getMetaDonnees();
58
		//$titreMeta = $meta[0]['titre'];
61
		//$titreMeta = $meta[0]['titre'];
59
		$titreMeta = "Description issue de www.wikipedia.org";
62
		$titreMeta = "Description issue de www.wikipedia.org";
60
		$wp['meta']['titre'] = $titreMeta;
63
		$wp['meta']['titre'] = $titreMeta;
61
		$wp['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('wikipedia');
64
		$wp['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('wikipedia');
62
		
65
		
63
		return $wp;
66
		return $wp;
64
	}
67
	}
65
 
68
 
66
	private function getIdWp() {
69
	private function getIdWp() {
67
		$nomSci = $this->nomCourant->getNomRetenu()->get('nom_sci');
70
		$nomSci = $this->nomCourant->getNomRetenu()->get('nom_sci');
68
		$idWp = str_replace(' ', '_', $nomSci);
71
		$idWp = str_replace(' ', '_', $nomSci);
69
		$idWp = urlencode($idWp);
72
		$idWp = urlencode($idWp);
70
		return $idWp;
73
		return $idWp;
71
	}
74
	}
-
 
75
	
-
 
76
	private function getWikini() {	
-
 
77
		$wikini = array();
-
 
78
		$wikini['titre'] = 'Wikini';
-
 
79
		$referentiel = $this->conteneur->getParametre('referentiel');
-
 
80
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
-
 
81
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
-
 
82
		$wikini['description'] = $this->wikini->getTexteFormate($page_wiki, 'description');
-
 
83
		return $wikini;
-
 
84
	}
72
	
85
	
73
	private function getCoste() {
86
	private function getCoste() {
74
		$coste = array();
87
		$coste = array();
75
		$this->textes->setProjet('coste');
88
		$this->textes->setProjet('coste');
76
		$this->textes->setId('bdtfx.nn:'.$this->nomCourant->getNns());
89
		$this->textes->setId('bdtfx.nn:'.$this->nomCourant->getNns());
77
		$texte = $this->textes->getTexte();
90
		$texte = $this->textes->getTexte();
78
		$coste['titre'] = $texte['titre'];
91
		$coste['titre'] = $texte['titre'];
79
		$coste['description'] = $texte['texte'];
92
		$coste['description'] = $texte['texte'];
80
		$this->meta->setProjet('coste');
93
		$this->meta->setProjet('coste');
81
		$coste['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('coste');
94
		$coste['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('coste');
82
		return $coste;
95
		return $coste;
83
	}
96
	}
84
}
97
}
85
?>
98
?>