Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 802 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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