Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 826 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
773 mathilde 1
<?php
2
/**
826 mathilde 3
 * Cette classe est le contrôleur pour l'affichage de listes dans des fenêtre fancy box.(fenêtres phytosociologie)
4
 *
5
 * @category	PHP 5.2
6
 * @package		eflore-consultation
7
 * @author		Mathilde Salthun-lassalle <mathilde@tela-botanica.org>
8
 * @copyright	2012 Tela-Botanica
9
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
10
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
11
 * @version		$Id$
773 mathilde 12
 */
13
 
14
 
802 mathilde 15
class ListeFancyBoxPhytosocio extends aControleur {
773 mathilde 16
 
17
	private $type = '';
18
	private $informations;
19
	private $appUrls;
20
	private $conteneur;
21
	private $referentiel;
22
	private $num_nom;
813 mathilde 23
	private $catminat;
773 mathilde 24
 
25
 
26
	public function __construct() {
27
		$this->capturerParametres();
28
		$this->conteneur = new Conteneur($this->parametres);
29
		$this->informations = $this->conteneur->getApiInformations();
802 mathilde 30
		$this->syntaxons = $this->conteneur->getApiSyntaxons();
773 mathilde 31
		$this->appUrls = $this->conteneur->getAppUrls();
32
	}
33
 
34
 
35
	private function capturerParametres() {
36
		if (isset($_GET['type'])) {
37
			$this->type = $_GET['type'];
38
		}
39
		if (isset($_GET['referentiel'])) {
40
			$this->referentiel = $_GET['referentiel'];
41
		}
42
		if (isset($_GET['num_nom'])) {
43
			$this->num_nom = $_GET['num_nom'];
44
		}
802 mathilde 45
		if (isset($_GET['catminat'])) {
46
			$this->catminat= trim(urldecode($_GET['catminat']));
47
		}
773 mathilde 48
	}
49
 
50
	public function executerActionParDefaut() {
51
		$this->executerLister();
52
	}
53
 
54
	public function executerLister($donnees) {
55
		header('Content-type: text/html');
56
		$html = $this->chargerListeHtml();
57
		echo $html;
58
		exit;
59
	}
60
 
61
	public function chargerListeHtml() {
62
		$donnees['liste'] = '';
63
		$html = '';
802 mathilde 64
		$squelette = dirname(__FILE__).'/squelettes/liste-fancy-box';
65
		if ($this->type == 'catminat_taxons') {
66
			$donnees = $this->getListeCatminatTaxons();
67
			$squelette .= '-taxons';
68
		} elseif ($this->type == 'catminat_synonymes') {
69
			$donnees = $this->getListeCatminatSynonymes();
70
			$squelette .= '-synonymes';
71
		} elseif ($this->type == 'catminat_ref') {
72
			$donnees = $this->getListeCatminatRef();
73
			$squelette .= '-ref';
813 mathilde 74
		} elseif ($this->type == 'catminat_taxons_sup') {
75
			$donnees = $this->getListeCatminatTaxonsSup();
76
			$squelette .= '-taxons';
802 mathilde 77
		}
78
		if ($donnees['liste'] !== '') {
773 mathilde 79
			$donnees['urls'] = $this->appUrls;
802 mathilde 80
			$html = $this->getVue($squelette, $donnees);
773 mathilde 81
		}
82
		return $html;
83
	}
84
 
85
 
802 mathilde 86
	public function getListeCatminatTaxons() {
773 mathilde 87
		$Catminat = array();
88
		$this->informations ->setProjet('baseflor');
813 mathilde 89
		$this->informations ->setDepart(0);
90
		$this->informations ->setLimite('500');
773 mathilde 91
		$this->informations ->setBdnt($this->referentiel);
92
		$this->informations ->setNum_nom($this->num_nom);
93
		$informations = $this->informations->getInformationsRelationCatminat();
94
		if($informations != ""){
802 mathilde 95
			$Catminat['liste'] = $informations['resultat'];
773 mathilde 96
			$Catminat['catminat'] = $informations['resultat'][0]['catminat_code'];
813 mathilde 97
		}
98
		return $Catminat;
99
	}
100
 
101
	public function getListeCatminatTaxonsSup() {
102
		$Catminat = array();
103
		$this->informations ->setProjet('baseflor');
104
		$this->informations ->setDepart(0);
105
		$this->informations ->setLimite('500');
106
		$this->informations ->setCatminat($this->catminat);
107
		$informations = $this->informations->getInformationsMasqueCatminat();
108
		if($informations != ""){
109
			$Catminat['liste'] = $informations['resultats'];
110
			$Catminat['catminat'] = str_replace('-','/',$this->catminat);
773 mathilde 111
		}
112
		return $Catminat;
113
	}
114
 
802 mathilde 115
	public function getListeCatminatSynonymes() {
116
		$Catminat = array();
117
		$this->syntaxons->setProjet('baseveg');
118
		$this->syntaxons->setCatminat($this->catminat);
119
		$syntaxons = $this->syntaxons->getSyntaxonsSynonymes();
120
		if (is_array($syntaxons)) {
121
			$Catminat['liste'] = $syntaxons['resultat'];
122
			$Catminat['catminat'] =  $syntaxons['resultat'][0]['code_catminat'];
123
		}
124
		return $Catminat;
125
	}
126
 
127
	public function getListeCatminatRef() {
128
		$ref = array();
129
		$this->syntaxons->setProjet('baseveg');
130
		$this->syntaxons->setCatminat($this->catminat);
131
		$syntaxons = $this->syntaxons->getSyntaxonsCatminat();
132
		if (is_array($syntaxons)) {
826 mathilde 133
			$ref['liste']['der'] = $syntaxons['resultat'][0]['ref_der_biblio'];
134
			if ($syntaxons['resultat'][0]['ref_anteriorite_deux'] != '') {
135
				$ref['liste']['anteriorites'][0] =  $syntaxons['resultat'][0]['ref_anteriorite_deux'];
136
			}
137
			if ($syntaxons['resultat'][0]['ref_anteriorite_trois'] != '') {
138
				$ref['liste']['anteriorites'][1]= $syntaxons['resultat'][0]['ref_anteriorite_trois'];
139
			}
140
			if ($syntaxons['resultat'][0]['ref_anteriorite_quatre'] != '') {
141
				$ref['liste']['anteriorites'][2] =  $syntaxons['resultat'][0]['ref_anteriorite_quatre'];
142
			}
802 mathilde 143
		}
144
		return $ref;
145
	}
146
 
773 mathilde 147
}
148
?>