Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 715 Rev 741
Line 28... Line 28...
28
	private $service = null;
28
	private $service = null;
29
	private $squelette = null;
29
	private $squelette = null;
30
	private $squelette_dossier = null;
30
	private $squelette_dossier = null;
31
	private $flux = array();
31
	private $flux = array();
32
	private $criteres = array(
32
	private $criteres = array(
33
		'auteur' => 'identifiant', 
33
		'utilisateur' => 'identifiant', 
34
		'commune' => 'location', 
34
		'commune' => 'location', 
35
		'departement' => 'id_location',
35
		'dept' => 'id_location',
36
		'taxon' => 'nom_ret',
36
		'taxon' => 'nom_ret',
37
		'commentaire' => 'commentaire',
37
		'commentaire' => 'commentaire',
38
		'date' => 'date_observation',
38
		'date' => 'date_observation',
39
		'projet' => 'mots-cles');
39
		'projet' => 'mots-cles');
Line 349... Line 349...
349
		return $requete;
349
		return $requete;
350
	}
350
	}
Line 351... Line 351...
351
	
351
	
352
	private function creerSousRequeteMotsCles($mot_cle) {
352
	private function creerSousRequeteMotsCles($mot_cle) {
353
		$requete = 'mots_cles like "inexistant" OR';
353
		$requete = 'mots_cles like "inexistant" OR';
354
		if (preg_match('/.*,.*/', $mot_cle)) {
354
		if (preg_match('/.*OU.*/', $mot_cle)) {
355
			$requete = $this->creerSousRequeteMotsClesOu($mot_cle);
355
			$requete = $this->creerSousRequeteMotsClesOu($mot_cle);
356
		} else if (preg_match('/.*ET.*/', $mot_cle)) {
356
		} else if (preg_match('/.*ET.*/', $mot_cle)) {
357
			$requete = $this->creerSousRequeteMotsClesEt($mot_cle);
357
			$requete = $this->creerSousRequeteMotsClesEt($mot_cle);
358
		} else {		
358
		} else {		
Line 373... Line 373...
373
		return $requete;
373
		return $requete;
374
	}
374
	}
Line 375... Line 375...
375
	
375
	
376
	private function creerSousRequeteMotsClesOu($mot_cle) {	
376
	private function creerSousRequeteMotsClesOu($mot_cle) {	
377
		$requete = 'mots_cles like "inexistant" OR';	
377
		$requete = 'mots_cles like "inexistant" OR';	
378
		$tab_mots_cles = explode(',', $mot_cle);
378
		$tab_mots_cles = explode('OU', $mot_cle);
379
		$where = '';
379
		$where = '';
380
		foreach ($tab_mots_cles as $mot) {
380
		foreach ($tab_mots_cles as $mot) {
381
			$where .= 'cmc_id_mot_cle_general = '.$this->bdd->quote($this->encoderMotCle($mot)).' OR ';
381
			$where .= 'cmc_id_mot_cle_general = '.$this->bdd->quote($this->encoderMotCle(trim($mot))).' OR ';
382
		}
382
		}
Line 383... Line 383...
383
		$where = rtrim($where,' OR ');
383
		$where = rtrim($where,' OR ');
384
		
384
		
Line 404... Line 404...
404
		
404
		
405
		$tab_mots_cles = explode("ET", $mot_cle); 
405
		$tab_mots_cles = explode("ET", $mot_cle); 
406
		foreach ($tab_mots_cles as $mot) {
406
		foreach ($tab_mots_cles as $mot) {
407
			$champs .= "$i.cmc_id_mot_cle_utilisateur as $i , ";
407
			$champs .= "$i.cmc_id_mot_cle_utilisateur as $i , ";
408
			$table .= "cel_mots_cles_obs $i , ";
408
			$table .= "cel_mots_cles_obs $i , ";
409
			$where .= "$i.cmc_id_mot_cle_general = ".$this->bdd->quote($this->encoderMotCle($mot)).' AND ';
409
			$where .= "$i.cmc_id_mot_cle_general = ".$this->bdd->quote($this->encoderMotCle(trim($mot))).' AND ';
410
			if ($i !== "a") {
410
			if ($i !== "a") {
411
				$where .= " $i.cmc_id_proprietaire = ".$j.".cmc_id_proprietaire AND ";
411
				$where .= " $i.cmc_id_proprietaire = ".$j.".cmc_id_proprietaire AND ";
412
				$j++;
412
				$j++;
413
			}
413
			}
Line 485... Line 485...
485
	}
485
	}
Line 486... Line 486...
486
	
486
	
487
	private function construireDonneesCommunesAuFlux($observations) {
487
	private function construireDonneesCommunesAuFlux($observations) {
488
		$donnees = $this->getFlux($this->service);
488
		$donnees = $this->getFlux($this->service);
-
 
489
		$donnees['guid'] = $this->getUrlServiceBase();
489
		$donnees['guid'] = $this->getUrlServiceBase();
490
		$donnees['titre'] = 'Flux des observations du CEL';
490
		$donnees['lien_service'] = $this->creerUrlService();
491
		$donnees['lien_service'] = $this->creerUrlService();
491
		$donnees['lien_cel'] = $this->config['settings']['baseURLAbsolu'];
492
		$donnees['lien_cel'] = $this->config['settings']['baseURLAbsolu'];
492
		$donnees['editeur'] = $this->config['settings']['editeur'];
493
		$donnees['editeur'] = $this->config['settings']['editeur'];
493
		$derniere_info_en_date = reset($observations);
494
		$derniere_info_en_date = reset($observations);