Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 1445 Rev 1477
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
	private function getStatuts() {
52
	private function getStatuts() {
53
		$statuts = "";
53
		$statuts = "";
54
		$projet = Config::get($this->referentiel.'.baseStatuts');
54
		$projet = Config::get($this->referentiel.'.baseStatuts');
55
		if ($projet != "") {
55
		if ($projet != "") {
56
			$nnr = $this->nomCourant->getNnr();
56
			$nnr = $this->nomCourant->getNnr();
57
			$statuts = $this->statuts->getStatuts($projet, $nnr);
57
			$statuts = $this->statuts->getStatuts($projet, $nnr);
58
			$this->meta->setProjet($projet);
58
			$this->meta->setProjet($projet);
59
			$meta = $this->meta->getMetaDonnees();
59
			$meta = $this->meta->getMetaDonnees();
60
			$statuts['meta'] = $meta[0];
60
			$statuts['meta'] = $meta[0];
61
			$statuts['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projet);
61
			$statuts['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projet);
62
		}
62
		}
63
		return $statuts;
63
		return $statuts;
64
	}
64
	}
65
	
65
	
66
	private function getStatutsZoneGeo() {
66
	private function getStatutsZoneGeo() {
67
		$statuts = "";
67
		$statuts = "";
68
		$projet = Config::get($this->referentiel.'.baseStatuts');
68
		$projet = Config::get($this->referentiel.'.baseStatuts');
69
		if ($projet != "") {
69
		if ($projet != "") {
70
			$nnr = $this->nomCourant->getNnr();
70
			$nnr = $this->nomCourant->getNnr();
71
			$reponse = $this->statuts->getStatutsZoneGeo($projet, $nnr);
71
			$reponse = $this->statuts->getStatutsZoneGeo($projet, $nnr);
-
 
72
			if (! empty($reponse)) {
72
			foreach ($reponse as $statut) {
73
				foreach ($reponse as $statut) {
73
				$statuts[$statut['type_protection']][] = $statut['zone_application'];
74
					$statuts[$statut['type_protection']][] = $statut['zone_application'];
-
 
75
				}
74
			}
76
			}
75
			$this->meta->setProjet($projet);
77
			$this->meta->setProjet($projet);
76
			$meta = $this->meta->getMetaDonnees();
78
			$meta = $this->meta->getMetaDonnees();
77
		}
79
		}
78
		return $statuts;
80
		return $statuts;
79
	}
81
	}
80
	
82
	
81
	private function getCategorieListeRouge() {
83
	private function getCategorieListeRouge() {
82
		$liste_rouge = "";
84
		$liste_rouge = "";
83
		$projet = Config::get($this->referentiel.'.baseListeRouge');
85
		$projet = Config::get($this->referentiel.'.baseListeRouge');
84
		if ($projet != "") {
86
		if ($projet != "") {
85
			$nnr = $this->nomCourant->getNnr();
87
			$nnr = $this->nomCourant->getNnr();
86
			$liste_rouge = $this->statuts->getCategorieListeRouge($projet, $nnr);
88
			$liste_rouge = $this->statuts->getCategorieListeRouge($projet, $nnr);
87
			$this->meta->setProjet($projet);
89
			$this->meta->setProjet($projet);
88
			$meta = $this->meta->getMetaDonnees();
90
			$meta = $this->meta->getMetaDonnees();
89
			$liste_rouge['meta'] = $meta[0];
91
			$liste_rouge['meta'] = $meta[0];
90
			$liste_rouge['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projet);
92
			$liste_rouge['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projet);
91
		}
93
		}
92
		return $liste_rouge;
94
		return $liste_rouge;
93
	}
95
	}
94
	
96
	
95
	private function getWikini() {
97
	private function getWikini() {
96
		$wikini = array();
98
		$wikini = array();
97
		$wikini['titre'] = 'Wikini';
99
		$wikini['titre'] = 'Wikini';
98
		$referentiel = $this->conteneur->getParametre('referentiel');
100
		$referentiel = $this->conteneur->getParametre('referentiel');
99
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
101
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
100
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
102
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
101
		$wikini['statuts_de_protection'] = $this->wikini->getTexteFormate($page_wiki, 'statuts de protection');
103
		$wikini['statuts_de_protection'] = $this->wikini->getTexteFormate($page_wiki, 'statuts de protection');
102
		return $wikini;
104
		return $wikini;
103
	}
105
	}
104
}
106
}
105
?>
107
?>