Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 444 Rev 448
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
		$wp['titre'] = $texte['titre'];
55
		$wp['titre'] = $texte['titre'];
56
		$wp['lien'] = $this->textes->getPageUrl();
56
		$wp['lien'] = $this->textes->getPageUrl();
57
		$wp['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('wikipedia');
57
		$wp['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('wikipedia');
58
		
58
		
59
		return $wp;
59
		return $wp;
60
	}
60
	}
61
 
61
 
62
	private function getIdWp() {
62
	private function getIdWp() {
63
		$nomSci = $this->nomCourant->getNomRetenu()->get('nom_sci');
63
		$nomSci = $this->nomCourant->getNomRetenu()->get('nom_sci');
64
		$idWp = str_replace(' ', '_', $nomSci);
64
		$idWp = str_replace(' ', '_', $nomSci);
65
		$idWp = urlencode($idWp);
65
		$idWp = urlencode($idWp);
66
		return $idWp;
66
		return $idWp;
67
	}
67
	}
68
	
68
	
69
	private function getWikini() {	
69
	private function getWikini() {	
70
		$wikini = array();
70
		$wikini = array();
71
		$wikini['titre'] = 'Wikini';
71
		$wikini['titre'] = 'Wikini';
72
		$referentiel = $this->conteneur->getParametre('referentiel');
72
		$referentiel = $this->conteneur->getParametre('referentiel');
73
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
73
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
74
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
74
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
75
		$wikini['description'] = $this->wikini->getTexteFormate($page_wiki, 'description');
75
		$wikini['description'] = $this->wikini->getTexteFormate($page_wiki, 'description');
76
		return $wikini;
76
		return $wikini;
77
	}
77
	}
78
	
78
	
79
	private function getCoste() {
79
	private function getCoste() {
80
		$coste = array();
80
		$coste = array();
81
		$this->textes->setProjet('coste');
81
		$this->textes->setProjet('coste');
82
		$this->textes->setId('bdtfx.nn:'.$this->nomCourant->getNns());
82
		$this->textes->setId('bdtfx.nn:'.$this->nomCourant->getNnr());
83
		$texte = $this->textes->getTexte();
83
		$texte = $this->textes->getTexte();
84
		$coste['titre'] = $texte['titre'];
84
		$coste['titre'] = $texte['titre'];
85
		$coste['description'] = $texte['texte'];
85
		$coste['description'] = $texte['texte'];
86
		$this->meta->setProjet('coste');
86
		$this->meta->setProjet('coste');
87
		$meta = $this->meta->getMetaDonnees();
87
		$meta = $this->meta->getMetaDonnees();
88
		$citation = $meta[0]['citation'];
88
		$citation = $meta[0]['citation'];
89
		$coste['meta']['citation'] = $citation;
89
		$coste['meta']['citation'] = $citation;
90
		$coste['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('chorodep');
90
		$coste['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('coste');
91
		return $coste;
91
		return $coste;
92
	}
92
	}
93
}
93
}
94
?>
94
?>