Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 1503 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1503 Rev 1515
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 Statut extends aControleur {
15
class Statut extends aControleur {
16
	private $conteneur = null;
16
	private $conteneur = null;
17
	private $nomCourant = null;
17
	private $nomCourant = null;
18
	private $wikini = null;
18
	private $wikini = null;
19
	private $statuts = null;
19
	private $statuts = null;
20
	private $meta;
20
	private $meta;
21
	private $referentiel = null;
21
	private $referentiel = null;
22
	private $appUrls;
22
	private $appUrls;
23
	
23
	
24
	public function __construct(Conteneur $conteneur) {
24
	public function __construct(Conteneur $conteneur) {
25
		$this->conteneur = $conteneur;
25
		$this->conteneur = $conteneur;
26
		$this->nomCourant = $this->conteneur->getNomCourant();
26
		$this->nomCourant = $this->conteneur->getNomCourant();
27
		$this->wikini = $this->conteneur->getApiWikini();
27
		$this->wikini = $this->conteneur->getApiWikini();
28
		$this->statuts = $this->conteneur->getApiStatuts();
28
		$this->statuts = $this->conteneur->getApiStatuts();
29
		$this->meta = $this->conteneur->getApiMetaDonnees();
29
		$this->meta = $this->conteneur->getApiMetaDonnees();
30
		$this->referentiel = $this->conteneur->getParametre('referentiel');
30
		$this->referentiel = $this->conteneur->getParametre('referentiel');
31
		$this->appUrls = $this->conteneur->getAppUrls();
31
		$this->appUrls = $this->conteneur->getAppUrls();
32
	}
32
	}
33
	
33
	
34
	public function getBloc() {
34
	public function getBloc() {
35
		$donnees = array();
35
		$donnees = array();
36
		$donnees['statuts'] = $this->getStatutsZoneGeo();
36
		$donnees['statuts'] = $this->getStatutsZoneGeo();
37
		if(empty($donnees['statuts'])) {
37
		if(empty($donnees['statuts'])) {
38
			$donnees['wikini'] = $this->getWikini();
38
			$donnees['wikini'] = $this->getWikini();
39
		}
39
		}
40
		$donnees['liste_rouge'] = $this->getCategorieListeRouge();
40
		$donnees['liste_rouge'] = $this->getCategorieListeRouge();
41
		return $donnees;
41
		return $donnees;
42
	}
42
	}
43
	
43
	
44
	public function obtenirDonnees() {
44
	public function obtenirDonnees() {
45
		$donnees = array();
45
		$donnees = array();
46
		$donnees['wikini'] = $this->getWikini();
46
		$donnees['wikini'] = $this->getWikini();
47
		$donnees['statuts'] = $this->getStatuts();
47
		$donnees['statuts'] = $this->getStatuts();
48
		$donnees['liste_rouge'] = $this->getCategorieListeRouge();
48
		$donnees['liste_rouge'] = $this->getCategorieListeRouge();
49
		return $donnees;
49
		return $donnees;
50
	}
50
	}
51
	
51
	
52
	public function obtenirDonneesExport() {
52
	public function obtenirDonneesExport() {
53
		$donnees = array();
53
		$donnees = array();
54
		$donnees['statuts'] = $this->getStatuts();
54
		$donnees['statuts'] = $this->getStatuts();
55
		$donnees['liste_rouge'] = $this->getCategorieListeRouge();
55
		$donnees['liste_rouge'] = $this->getCategorieListeRouge();
56
		return $donnees;
56
		return $donnees;
57
	}
57
	}
58
	
58
	
59
	private function getStatuts() {
59
	private function getStatuts() {
60
		$statuts = "";
60
		$statuts = array();
61
		$projet = Config::get($this->referentiel.'.baseStatuts');
61
		$projet = Config::get($this->referentiel.'.baseStatuts');
62
		if ($projet != "") {
62
		if ($projet != "") {
63
			$nnr = $this->nomCourant->getNnr();
63
			$nnr = $this->nomCourant->getNnr();
64
			$statuts = $this->statuts->getStatuts($projet, $nnr);
64
			$statuts = $this->statuts->getStatuts($projet, $nnr);
65
			$this->meta->setProjet($projet);
65
			$this->meta->setProjet($projet);
66
			$meta = $this->meta->getMetaDonnees();
66
			$meta = $this->meta->getMetaDonnees();
67
			$statuts['meta'] = $meta[0];
67
			$statuts['meta'] = $meta[0];
68
			$statuts['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projet);
68
			$statuts['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projet);
69
		}
69
		}
70
		return $statuts;
70
		return $statuts;
71
	}
71
	}
72
	
72
	
73
	private function getStatutsZoneGeo() {
73
	private function getStatutsZoneGeo() {
74
		$statuts = "";
74
		$statuts = array();
75
		$projet = Config::get($this->referentiel.'.baseStatuts');
75
		$projet = Config::get($this->referentiel.'.baseStatuts');
76
		if ($projet != "") {
76
		if ($projet != "") {
77
			$nnr = $this->nomCourant->getNnr();
77
			$nnr = $this->nomCourant->getNnr();
78
			$reponse = $this->statuts->getStatutsZoneGeo($projet, $nnr);
78
			$reponse = $this->statuts->getStatutsZoneGeo($projet, $nnr);
79
			if (! empty($reponse)) {
79
			if (! empty($reponse)) {
80
				foreach ($reponse as $statut) {
80
				foreach ($reponse as $statut) {
81
					$statuts[$statut['type_protection']][] = $statut['zone_application'];
81
					$statuts[$statut['type_protection']][] = $statut['zone_application'];
82
				}
82
				}
83
			}
83
			}
84
			$this->meta->setProjet($projet);
84
			$this->meta->setProjet($projet);
85
			$meta = $this->meta->getMetaDonnees();
85
			$meta = $this->meta->getMetaDonnees();
86
		}
86
		}
87
		return $statuts;
87
		return $statuts;
88
	}
88
	}
89
	
89
	
90
	private function getCategorieListeRouge() {
90
	private function getCategorieListeRouge() {
91
		$liste_rouge = "";
91
		$liste_rouge = array();
92
		$projet = Config::get($this->referentiel.'.baseListeRouge');
92
		$projet = Config::get($this->referentiel.'.baseListeRouge');
93
		if ($projet != "") {
93
		if ($projet != "") {
94
			$nnr = $this->nomCourant->getNnr();
94
			$nnr = $this->nomCourant->getNnr();
95
			$liste_rouge = $this->statuts->getCategorieListeRouge($projet, $nnr);
95
			$liste_rouge = $this->statuts->getCategorieListeRouge($projet, $nnr);
96
			$this->meta->setProjet($projet);
96
			$this->meta->setProjet($projet);
97
			$meta = $this->meta->getMetaDonnees();
97
			$meta = $this->meta->getMetaDonnees();
98
			$liste_rouge['meta'] = $meta[0];
98
			$liste_rouge['meta'] = $meta[0];
99
			$liste_rouge['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projet);
99
			$liste_rouge['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projet);
100
		}
100
		}
101
		return $liste_rouge;
101
		return $liste_rouge;
102
	}
102
	}
103
	
103
	
104
	private function getWikini() {
104
	private function getWikini() {
105
		$wikini = array();
105
		$wikini = array();
106
		$wikini['titre'] = 'Wikini';
106
		$wikini['titre'] = 'Wikini';
107
		$referentiel = $this->conteneur->getParametre('referentiel');
107
		$referentiel = $this->conteneur->getParametre('referentiel');
108
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
108
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
109
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
109
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
110
		$wikini['statuts_de_protection'] = $this->wikini->getTexteFormate($page_wiki, 'statuts de protection');
110
		$wikini['statuts_de_protection'] = $this->wikini->getTexteFormate($page_wiki, 'statuts de protection');
111
		return $wikini;
111
		return $wikini;
112
	}
112
	}
113
}
113
}
114
?>
114
?>