Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
272 delphine 1
<?php
2
// declare(encoding='UTF-8');
3
/**
4
 * Classe mère du module Liste.
5
 *
6
 * @category	PHP 5.2
7
 * @package		eflore-consultation
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
10
 * @copyright	2011 Tela-Botanica
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
13
 * @version		$Id$
14
 */
15
class Statut extends aControleur {
985 delphine 16
	private $conteneur = null;
17
	private $nomCourant = null;
18
	private $wikini = null;
19
	private $statuts = null;
1130 aurelien 20
	private $meta;
985 delphine 21
	private $referentiel = null;
1130 aurelien 22
	private $appUrls;
985 delphine 23
 
422 delphine 24
	public function __construct(Conteneur $conteneur) {
25
		$this->conteneur = $conteneur;
26
		$this->nomCourant = $this->conteneur->getNomCourant();
27
		$this->wikini = $this->conteneur->getApiWikini();
768 aurelien 28
		$this->statuts = $this->conteneur->getApiStatuts();
1130 aurelien 29
		$this->meta = $this->conteneur->getApiMetaDonnees();
985 delphine 30
		$this->referentiel = $this->conteneur->getParametre('referentiel');
1130 aurelien 31
		$this->appUrls = $this->conteneur->getAppUrls();
422 delphine 32
	}
33
 
768 aurelien 34
	public function getBloc() {
35
		$donnees = array();
36
		$donnees['statuts'] = $this->getStatutsZoneGeo();
37
		if(empty($statuts)) {
38
			$donnees['wikini'] = $this->getWikini();
39
		}
40
		return $donnees;
41
	}
42
 
422 delphine 43
	public function obtenirDonnees() {
417 aurelien 44
		$donnees = array();
45
		$donnees['wikini'] = $this->getWikini();
768 aurelien 46
		$donnees['statuts'] = $this->getStatuts();
272 delphine 47
		return $donnees;
48
	}
417 aurelien 49
 
768 aurelien 50
	private function getStatuts() {
985 delphine 51
		$statuts = "";
52
		$projet = Config::get($this->referentiel.'.baseStatuts');
53
		if ($projet != "") {
54
			$nnr = $this->nomCourant->getNnr();
55
			$statuts = $this->statuts->getStatuts($projet, $nnr);
1130 aurelien 56
			$this->meta->setProjet($projet);
57
			$meta = $this->meta->getMetaDonnees();
58
			$statuts['meta'] = $meta[0];
59
			$statuts['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projet);
985 delphine 60
		}
768 aurelien 61
		return $statuts;
62
	}
63
 
64
	private function getStatutsZoneGeo() {
985 delphine 65
		$statuts = "";
66
		$projet = Config::get($this->referentiel.'.baseStatuts');
67
		if ($projet != "") {
68
			$nnr = $this->nomCourant->getNnr();
69
			$statuts = $this->statuts->getStatutsZoneGeo($projet, $nnr);
1130 aurelien 70
			$this->meta->setProjet($projet);
71
			$meta = $this->meta->getMetaDonnees();
72
			$statuts['meta'] = $meta[0];
73
			$statuts['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projet);
985 delphine 74
		}
768 aurelien 75
		return $statuts;
76
	}
77
 
417 aurelien 78
	private function getWikini() {
79
		$wikini = array();
80
		$wikini['titre'] = 'Wikini';
81
		$referentiel = $this->conteneur->getParametre('referentiel');
82
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
83
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
418 aurelien 84
		$wikini['statuts_de_protection'] = $this->wikini->getTexteFormate($page_wiki, 'statuts de protection');
417 aurelien 85
		return $wikini;
86
	}
272 delphine 87
}
88
?>