Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 412 Rev 435
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
	private $wikini = null;
22
 
22
 
23
	public function __construct(Conteneur $conteneur) {
23
	public function __construct(Conteneur $conteneur) {
24
		$this->conteneur = $conteneur;
24
		$this->conteneur = $conteneur;
25
		$this->nomCourant = $this->conteneur->getNomCourant();
25
		$this->nomCourant = $this->conteneur->getNomCourant();
26
		$this->textes = $this->conteneur->getApiTextes();
26
		$this->textes = $this->conteneur->getApiTextes();
27
		$this->wikini = $this->conteneur->getApiWikini();
27
		$this->wikini = $this->conteneur->getApiWikini();
28
		$this->meta = $this->conteneur->getApiMetaDonnees();
28
		$this->meta = $this->conteneur->getApiMetaDonnees();
29
		$this->appUrls = $this->conteneur->getAppUrls();
29
		$this->appUrls = $this->conteneur->getAppUrls();
30
	}
30
	}
31
 
31
 
32
	public function obtenirDonnees() {
32
	public function obtenirDonnees() {
33
		$donnees = array();
33
		$donnees = array();
34
		$donnees['wp'] = $this->getWp();
34
		$donnees['wp'] = $this->getWp();
35
		$donnees['coste'] = $this->getCoste();
35
		$donnees['coste'] = $this->getCoste();
36
		$donnees['wikini'] = $this->getWikini();
36
		$donnees['wikini'] = $this->getWikini();
37
		return $donnees;
37
		return $donnees;
38
	}
38
	}
39
 
39
 
40
	public function getBloc() {
40
	public function getBloc() {
41
		$donnees['titre'] = "Description de Coste";
41
		$donnees['titre'] = "Description de Coste";
42
		$description = $this->getCoste();
42
		$description = $this->getCoste();
43
		if ($description['description'] == 'n') {
43
		if ($description['description'] == 'n') {
44
			$donnees['titre'] = "Description collaborative";
44
			$donnees['titre'] = "Description collaborative";
45
			$description = $this->getWikini();
45
			$description = $this->getWikini();
46
		}
46
		}
47
		$donnees['description'] = $description['description'];
47
		$donnees['description'] = $description['description'];
48
		return $donnees;
48
		return $donnees;
49
	}
49
	}
50
 
50
 
51
	private function getWp() {
51
	private function getWp() {
52
		$wp = array();
52
		$wp = array();
53
		$this->textes->setProjet('wikipedia');
53
		$this->textes->setProjet('wikipedia');
54
		$this->textes->setId($this->getIdWp());
54
		$this->textes->setId($this->getIdWp());
55
		$texte = $this->textes->getTexte();
-
 
56
		$wp['titre'] = $texte['titre'];
55
		$wp['titre'] = $texte['titre'];
57
		$wp['description'] = $texte['texte'];
-
 
58
		$this->meta->setProjet('wikipedia');
-
 
59
		
-
 
60
		// TODO: décommenter ceci et remplacer le titre en dur lorsque le service
-
 
61
		// web wikipedia renverra les bonnes metadonnées
-
 
62
		//$meta = $this->meta->getMetaDonnees();
56
		$wp['lien'] = $this->textes->getPageUrl();
63
		//$titreMeta = $meta[0]['titre'];
-
 
64
		$titreMeta = "Description issue de www.wikipedia.org";
-
 
65
		$wp['meta']['titre'] = $titreMeta;
-
 
66
		$wp['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('wikipedia');
57
		$wp['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('wikipedia');
67
		
58
		
68
		return $wp;
59
		return $wp;
69
	}
60
	}
70
 
61
 
71
	private function getIdWp() {
62
	private function getIdWp() {
72
		$nomSci = $this->nomCourant->getNomRetenu()->get('nom_sci');
63
		$nomSci = $this->nomCourant->getNomRetenu()->get('nom_sci');
73
		$idWp = str_replace(' ', '_', $nomSci);
64
		$idWp = str_replace(' ', '_', $nomSci);
74
		$idWp = urlencode($idWp);
65
		$idWp = urlencode($idWp);
75
		return $idWp;
66
		return $idWp;
76
	}
67
	}
77
	
68
	
78
	private function getWikini() {	
69
	private function getWikini() {	
79
		$wikini = array();
70
		$wikini = array();
80
		$wikini['titre'] = 'Wikini';
71
		$wikini['titre'] = 'Wikini';
81
		$referentiel = $this->conteneur->getParametre('referentiel');
72
		$referentiel = $this->conteneur->getParametre('referentiel');
82
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
73
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
83
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
74
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
84
		$wikini['description'] = $this->wikini->getTexteFormate($page_wiki, 'description');
75
		$wikini['description'] = $this->wikini->getTexteFormate($page_wiki, 'description');
85
		return $wikini;
76
		return $wikini;
86
	}
77
	}
87
	
78
	
88
	private function getCoste() {
79
	private function getCoste() {
89
		$coste = array();
80
		$coste = array();
90
		$this->textes->setProjet('coste');
81
		$this->textes->setProjet('coste');
91
		$this->textes->setId('bdtfx.nn:'.$this->nomCourant->getNns());
82
		$this->textes->setId('bdtfx.nn:'.$this->nomCourant->getNns());
92
		$texte = $this->textes->getTexte();
83
		$texte = $this->textes->getTexte();
93
		$coste['titre'] = $texte['titre'];
84
		$coste['titre'] = $texte['titre'];
94
		$coste['description'] = $texte['texte'];
85
		$coste['description'] = $texte['texte'];
95
		$this->meta->setProjet('coste');
86
		$this->meta->setProjet('coste');
96
		$coste['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('coste');
87
		$coste['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('coste');
97
		return $coste;
88
		return $coste;
98
	}
89
	}
99
}
90
}
100
?>
91
?>