Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 308 Rev 321
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 Ethnobotanique extends aControleur {
15
class Ethnobotanique extends aControleur {
16
 
16
 
17
	private $conteneur = null;
17
	private $conteneur = null;
18
	private $nomCourant = null;
18
	private $nomCourant = null;
19
	private $nomsVernaculaires = null;
19
	private $nomsVernaculaires = null;
20
 
20
 
21
	public function __construct(Conteneur $conteneur) {
21
	public function __construct(Conteneur $conteneur) {
22
		$this->conteneur = $conteneur;
22
		$this->conteneur = $conteneur;
23
		$this->nomCourant = $this->conteneur->getNomCourant();
23
		$this->nomCourant = $this->conteneur->getNomCourant();
24
		$this->nomsVernaculaires = $this->conteneur->getApiNomsVernaculaires();
24
		$this->nomsVernaculaires = $this->conteneur->getApiNomsVernaculaires();
25
		$this->meta = $this->conteneur->getApiMetaDonnees();
25
		$this->meta = $this->conteneur->getApiMetaDonnees();
26
		$this->appUrls = $this->conteneur->getAppUrls();
26
		$this->appUrls = $this->conteneur->getAppUrls();
27
	}
27
	}
28
 
28
 
29
	public function obtenirDonnees() {
29
	public function obtenirDonnees() {
30
		$donnees['nvjfl'] = $this->getNvjfl();
30
		$donnees['nvjfl'] = $this->getNvjfl();
-
 
31
		$donnees['chorologie'] = $this->getChorologie();
31
		return $donnees;
32
		return $donnees;
32
	}
33
	}
33
 
34
 
34
	private function getNvjfl() {
35
	private function getNvjfl() {
35
		$nvjfl = array();
36
		$nvjfl = array();
36
		$nt = $this->nomCourant->getNomRetenu()->get('num_taxonomique');
37
		$nt = $this->nomCourant->getNomRetenu()->get('num_taxonomique');
37
		$nomsVerna = $this->nomsVernaculaires->getRechercheComplete($nt);
38
		$nomsVerna = $this->nomsVernaculaires->getRechercheComplete($nt);
38
		$nvjfl['noms'] = $nomsVerna['resultat'];
39
		$nvjfl['noms'] = $nomsVerna['resultat'];
39
		$this->meta->setProjet('nvjfl');
40
		$this->meta->setProjet('nvjfl');
40
		$meta = $this->meta->getMetaDonnees();
41
		$meta = $this->meta->getMetaDonnees();
41
		$titreMeta = $meta[0]['titre'];
42
		$titreMeta = $meta[0]['titre'];
42
		$nvjfl['meta']['titre'] = $titreMeta;
43
		$nvjfl['meta']['titre'] = $titreMeta;
43
		$nvjfl['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('nvjfl');
44
		$nvjfl['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('nvjfl');
44
		return $nvjfl;
45
		return $nvjfl;
45
	}
46
	}
-
 
47
	
-
 
48
	private function getChorologie() {
-
 
49
 
-
 
50
		$infos_choro = $this->nomCourant->getNomSelectionne()->getInfos();
-
 
51
		$donnees_choro = array();
-
 
52
		$colonnes = array();
-
 
53
				
-
 
54
		foreach ($infos_choro as $param => $valeur) {
-
 
55
			
-
 
56
			$tableau_prefixe = explode('_', $param, 2);
-
 
57
			$prefixe = (count($tableau_prefixe) == 2) ? $tableau_prefixe[0] : '';
-
 
58
			
-
 
59
			$lieu = (count($tableau_prefixe) == 2) ? $tableau_prefixe[1] : 'France';
-
 
60
			$champs_chorologie = array('presence', 'statut_origine', 'statut_introduction', 'statut_culture');
-
 
61
			
-
 
62
			if(strpos($lieu , '.') === false && in_array($prefixe, $champs_chorologie)) {
-
 
63
				
-
 
64
				$lieu = 'France ('.$lieu.')';
-
 
65
				
-
 
66
				if ($prefixe == 'presence') {
-
 
67
					$donnees_choro['Présence'][$lieu] = $valeur;
-
 
68
				} elseif ($prefixe == 'statut_origine') {
-
 
69
					$donnees_choro['Statut d\'origine'][$lieu] = $valeur;
-
 
70
				} elseif ($prefixe == 'statut_introduction') {
-
 
71
					$donnees_choro['Statut d\'introduction'][$lieu] = $valeur;
-
 
72
				} elseif ($prefixe == 'statut_culture') {
-
 
73
					$donnees_choro['Statut de culture'][$lieu] = $valeur;
-
 
74
				}
-
 
75
				if(!in_array($lieu, $colonnes)) {
-
 
76
					$colonnes[] = $lieu;
-
 
77
				}
-
 
78
			}
-
 
79
		}
-
 
80
		foreach ($donnees_choro['Présence'] as $lieu => $valeur) {
-
 
81
			if (!isset($donnees_choro['Statut d\'origine'][$lieu])) {
-
 
82
				$donnees_choro['Statut d\'origine'][$lieu] = '';
-
 
83
			}
-
 
84
			if (!isset($donnees_choro['Statut d\'introduction'][$lieu])) {
-
 
85
				$donnees_choro['Statut d\'introduction'][$lieu] = '';
-
 
86
			}
-
 
87
			if (!isset($donnees_choro['Statut de culture'][$lieu])) {
-
 
88
				$donnees_choro['Statut de culture'][$lieu] = '';
-
 
89
			}
-
 
90
		}
-
 
91
		
-
 
92
		$donnees = array('colonnes' => $colonnes, 'donnees' => $donnees_choro);
-
 
93
		$this->meta->setProjet('bdtfx');
-
 
94
		$meta = $this->meta->getMetaDonnees();
-
 
95
		$titreMeta = $meta[0]['titre'];
-
 
96
		$donnees['meta']['titre'] = $titreMeta;
-
 
97
		$donnees['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('bdtfx');
-
 
98
		return $donnees;
-
 
99
	}
46
 
100
 
47
	public function getBloc() {
101
	public function getBloc() {
48
		$nt = $this->nomCourant->getNomRetenu()->get('num_taxonomique');
102
		$nt = $this->nomCourant->getNomRetenu()->get('num_taxonomique');
49
		$nomsVerna = $this->nomsVernaculaires->getRechercheLimitee($nt);
103
		$nomsVerna = $this->nomsVernaculaires->getRechercheLimitee($nt);
50
		$donnees['nomsVerna'] = array_slice($nomsVerna['resultat'], 0, 5);
104
		$donnees['nomsVerna'] = array_slice($nomsVerna['resultat'], 0, 5);
51
		return $donnees;
105
		return $donnees;
52
	}
106
	}
53
}
107
}
54
?>
108
?>