Subversion Repositories eFlore/Applications.cel

Rev

Rev 1580 | Rev 1629 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1580 Rev 1613
Line 138... Line 138...
138
				$widget['donnees']['nom_sci_espece_defaut'] = $nom['nom_sci'];
138
				$widget['donnees']['nom_sci_espece_defaut'] = $nom['nom_sci'];
139
				$widget['donnees']['infos_espece'] = $this->array2js($nom, true);
139
				$widget['donnees']['infos_espece'] = $this->array2js($nom, true);
140
			}
140
			}
141
		}
141
		}
142
		if ($this->projet != 'defaut' || $this->projetASquelette()) {
142
		if ($this->projet != 'defaut' || $this->projetASquelette()) {
-
 
143
			if ($this->projet == 'florileges') {
143
			$widget['donnees']['taxons'] = $this->recupererListeTaxon();
144
				$widget['donnees']['taxons'] = $this->recupererListeNoms();
-
 
145
			} else {
-
 
146
				$widget['donnees']['taxons'] = $this->recupererListeNomsSci();
-
 
147
			}
144
			$widget['donnees']['milieux'] = $this->parserMilieux();
148
			$widget['donnees']['milieux'] = $this->parserMilieux();
145
		}
149
		}
146
		return  $widget;
150
		return  $widget;
147
	}
151
	}
Line 153... Line 157...
153
	}
157
	}
Line 154... Line 158...
154
 
158
 
155
	public function executerTaxons() {
159
	public function executerTaxons() {
156
		$widget['squelette'] = $this->projet.'_taxons';
160
		$widget['squelette'] = $this->projet.'_taxons';
157
		$widget['squelette_ext'] = '.tpl.js';
161
		$widget['squelette_ext'] = '.tpl.js';
158
		$widget['donnees'] = array();
162
		$widget['donnees'] = array();
159
		$taxons = $this->recupererListeTaxon();
-
 
160
		$taxons_tries = array();
-
 
161
		foreach ($taxons as $taxon) {
-
 
162
			$taxons_tries[$taxon['num_nom_sel']] = $taxon;
-
 
163
		}
163
		$nomsAAfficher = $this->recupererListeNomsSci();
164
		$widget['donnees']['taxons'] = json_encode($taxons_tries);
164
		$widget['donnees']['taxons'] = json_encode($nomsAAfficher);
165
		return  $widget;
165
		return  $widget;
-
 
166
	}
-
 
167
 
-
 
168
	private function recupererListeNomsSci() {
-
 
169
		$taxons = $this->recupererListeTaxon();
-
 
170
		$nomsAAfficher = array();
-
 
171
		if (is_array($taxons)) {
-
 
172
			$taxons = self::trierTableauMd($taxons, array('nom_fr' => SORT_ASC));
-
 
173
			foreach ($taxons as $taxon) {
-
 
174
				$nomsAAfficher[$taxon['num_nom_sel']] = $taxon;
-
 
175
			}
-
 
176
		}
-
 
177
		return $nomsAAfficher;
-
 
178
	}
-
 
179
 
-
 
180
	private function recupererListeNoms() {
-
 
181
		$taxons = $this->recupererListeTaxon();
-
 
182
		$nomsAAfficher = array();
-
 
183
		$nomsSpeciaux = array();
-
 
184
		if (is_array($taxons)) {
-
 
185
			foreach ($taxons as $taxon) {
-
 
186
				$nomSciTitle = $taxon['nom_ret'].
-
 
187
					($taxon['nom_fr'] != '' ? ' - '.$taxon['nom_fr'] : '' ).
-
 
188
					($taxon['nom_fr_autre'] != '' ? ' - '.$taxon['nom_fr_autre'] : '' );
-
 
189
				$nomFrTitle = $taxon['nom_sel'].
-
 
190
					($taxon['nom_ret'] != $taxon['nom_sel']? ' - '.$taxon['nom_ret'] : '' ).
-
 
191
					($taxon['nom_fr_autre'] != '' ? ' - '.$taxon['nom_fr_autre'] : '' );
-
 
192
 
-
 
193
				if ($taxon['groupe'] == 'special') {
-
 
194
					$nomsSpeciaux[] = array(
-
 
195
						'num_nom' => $taxon['num_nom_sel'],
-
 
196
						'nom_a_afficher' => $taxon['nom_fr'],
-
 
197
						'nom_a_sauver' => $taxon['nom_sel'],
-
 
198
						'nom_title' => $nomSciTitle,
-
 
199
						'nom_type' => 'nom-special');
-
 
200
				} else {
-
 
201
					$nomsAAfficher[] = array(
-
 
202
						'num_nom' => $taxon['num_nom_sel'],
-
 
203
						'nom_a_afficher' => $taxon['nom_sel'],
-
 
204
						'nom_a_sauver' => $taxon['nom_sel'],
-
 
205
						'nom_title' => $nomSciTitle,
-
 
206
						'nom_type' => 'nom-sci');
-
 
207
					$nomsAAfficher[] = array(
-
 
208
						'num_nom' => $taxon['num_nom_sel'],
-
 
209
						'nom_a_afficher' => $taxon['nom_fr'],
-
 
210
						'nom_a_sauver' => $taxon['nom_fr'],
-
 
211
						'nom_title' => $nomFrTitle,
-
 
212
						'nom_type' => 'nom-fr');
-
 
213
				}
-
 
214
			}
-
 
215
			$nomsAAfficher = self::trierTableauMd($nomsAAfficher, array('nom_a_afficher' => SORT_ASC));
-
 
216
			$nomsSpeciaux = self::trierTableauMd($nomsSpeciaux, array('nom_a_afficher' => SORT_ASC));
-
 
217
			$nomsAAfficher = array_merge($nomsAAfficher, $nomsSpeciaux);
-
 
218
		}
-
 
219
		return array('speciaux' => $nomsSpeciaux, 'sci-et-fr' => $nomsAAfficher);
Line 166... Line 220...
166
	}
220
	}
167
 
221
 
168
	private function recupererListeTaxon() {
222
	private function recupererListeTaxon() {
169
		$taxons = null;
223
		$taxons = null;
170
		$fichier_tsv = dirname(__FILE__).self::DS.'configurations'.self::DS.$this->projet.'_taxons.tsv';
224
		$fichier_tsv = dirname(__FILE__).self::DS.'configurations'.self::DS.$this->projet.'_taxons.tsv';
171
		if (file_exists($fichier_tsv) && is_readable($fichier_tsv)) {
-
 
172
			$taxons = $this->decomposerFichierTsv($fichier_tsv);
225
		if (file_exists($fichier_tsv) && is_readable($fichier_tsv)) {
173
			$taxons = self::trierTableauMd($taxons, array('nom_fr' => SORT_ASC));
226
			$taxons = $this->decomposerFichierTsv($fichier_tsv);
174
		} else {
227
		} else {
175
			$this->debug[] = "Impossible d'ouvrir le fichier '$fichier_tsv'.";
228
			$this->debug[] = "Impossible d'ouvrir le fichier '$fichier_tsv'.";
176
		}
229
		}