Subversion Repositories eFlore/Projets.eflore-projets

Rev

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

Rev 563 Rev 608
Line 271... Line 271...
271
			case 'noms-vernaculaires/id/champ'		: $reponse = $this->formaterNomsVernaculairesIdChamp($resultat);	break;
271
			case 'noms-vernaculaires/id/champ'		: $reponse = $this->formaterNomsVernaculairesIdChamp($resultat);	break;
272
			default									:																	break;
272
			default									:																	break;
273
		}
273
		}
274
		return $reponse;
274
		return $reponse;
275
	}
275
	}
276
 
276
	
277
	public function formaterNomsVernaculaires($resultat) {
277
	public function ajouterJsonEnTeteNV() {
278
		//on remplit la table $table_retour_json['entete']
-
 
279
		$table_retour_json['entete']['masque'] = $this->recupererMasque();
278
		$table_retour_json['masque'] = $this->recupererMasque();
280
		$table_retour_json['entete']['depart'] = $this->limite_requete['depart'];
279
		$table_retour_json['depart'] = $this->limite_requete['depart'];
281
		$table_retour_json['entete']['limite'] = $this->limite_requete['limite'];
280
		$table_retour_json['limite'] = $this->limite_requete['limite'];
282
		$table_retour_json['entete']['total']  = $this->total_resultat;
281
		$table_retour_json['total']  = $this->total_resultat;
283
		$url = $this->formulerUrl($this->total_resultat, '/noms-vernaculaires');
282
		$url = $this->formulerUrl($this->total_resultat, '/noms-vernaculaires');
284
		if (isset($url['precedent']) && $url['precedent'] != '') { $table_retour_json['entete']['href.precedent'] = $url['precedent']; }
283
		if (isset($url['precedent']) && $url['precedent'] != '') {
285
		if (isset($url['suivant']) && $url['suivant']   != '') { $table_retour_json['entete']['href.suivant']   = $url['suivant']; }
-
 
286
		
-
 
287
		//on remplit la table $table_retour_json['resultat']
284
			$table_retour_json['href.precedent'] = $url['precedent'];
288
		if (isset($this->parametres['masque.nv'])) {
-
 
289
			$resultat = $this->trierRechercheFloue($this->parametres['masque.nv'], $resultat, 'nom_vernaculaire');
-
 
290
		}
285
		}
291
		if (isset($this->parametres['masque'])) {
286
		if (isset($url['suivant']) && $url['suivant']   != '') {
292
			$resultat = $this->trierRechercheFloue($this->parametres['masque'], $resultat, 'nom_vernaculaire');
287
			$table_retour_json['href.suivant']   = $url['suivant'];
293
		}
288
		}
-
 
289
		return $table_retour_json;
-
 
290
	}
-
 
291
	
-
 
292
	public function ajouterJsonResultatNV($resultat) {
294
		foreach ($resultat as $tab) {
293
		foreach ($resultat as $tab) {
295
			foreach ($tab as $key => $valeur) {
294
			foreach ($tab as $key => $valeur) {
296
				if ($valeur != '') {
295
				if ($valeur != '') {
297
					switch ($key) {
296
					switch ($key) {
298
						case 'id'				: $num = $valeur;								break;
297
						case 'id'				: $num = $valeur;								break;
299
						case 'nom_vernaculaire'	: $this->table_retour['nom'] = $valeur;			break;
298
						case 'nom_vernaculaire'	: $this->table_retour['nom'] = $valeur;			break;
300
						default					:												break;
299
						default					:												break;
301
					}
300
					}
302
				}
301
				}
303
			}
302
			}
304
			if ($this->retour_format == 'max') $this->table_retour['href'] = $this->ajouterHref('noms-vernaculaires', $num);
303
		    if ($this->retour_format == 'max') $this->table_retour['href'] = $this->ajouterHref('noms-vernaculaires', $num);
305
			$resultat_json[$num] = $this->table_retour;
304
			$resultat_json[$num] = $this->table_retour;
306
			$this->table_retour = array();
305
			$this->table_retour = array();
307
		}
306
		}
-
 
307
		return  $resultat_json;
-
 
308
	}
Line -... Line 309...
-
 
309
 
-
 
310
	
-
 
311
	public function formaterNomsVernaculaires($resultat) {
-
 
312
		$table_retour_json['entete'] = $this->ajouterJsonEnTeteNV();
308
 
313
		$resultat = $this->hierarchiserResultat($resultat);
309
		$table_retour_json['resultat'] = $resultat_json;
314
		$table_retour_json['resultat'] = $this->ajouterJsonResultatNV($resultat);
310
		return $table_retour_json;
315
		return $table_retour_json;
Line -... Line 316...
-
 
316
	}
-
 
317
	
-
 
318
	public function hierarchiserResultat($resultat) {
-
 
319
		//tri recherche floue
-
 
320
		if (isset($this->parametres['masque.nv'])) {
-
 
321
			$resultat = $this->trierRechercheFloue($this->parametres['masque.nv'], $resultat, 'nom_vernaculaire');
-
 
322
		}
-
 
323
		if (isset($this->parametres['masque'])) {
-
 
324
			$resultat = $this->trierRechercheFloue($this->parametres['masque'], $resultat, 'nom_vernaculaire');
-
 
325
		}
-
 
326
		return $resultat;
311
	}
327
	}
312
	
328
	
313
	public function recupererMasque() {
329
	public function recupererMasque() {
314
		$tab_masque = array();
330
		$tab_masque = array();
315
		foreach ($this->parametres as $param=>$valeur) {
331
		foreach ($this->parametres as $param=>$valeur) {