Subversion Repositories eFlore/Projets.eflore-projets

Rev

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

Rev 607 Rev 629
Line 27... Line 27...
27
	  (ex id=12, basionyme num 25 est un synonyme) dans le service taxon */
27
	  (ex id=12, basionyme num 25 est un synonyme) dans le service taxon */
28
	protected $service_href = null;
28
	protected $service_href = null;
29
	protected $erreursParametres = null;
29
	protected $erreursParametres = null;
30
	protected $sans_nom_sci = array('gen','sp','ssp','fam','au_ss','bib_ss');
30
	protected $sans_nom_sci = array('gen','sp','ssp','fam','au_ss','bib_ss');
31
	private $bib_traitees = array();
31
	private $bib_traitees = array();
-
 
32
	private $ontologie = array();
Line 32... Line 33...
32
 
33
 
Line 33... Line 34...
33
//+------------------------------- PARAMÈTRES ---------------------------------------------------------------+
34
//+------------------------------- PARAMÈTRES ---------------------------------------------------------------+
34
 
35
 
Line 75... Line 76...
75
		}
76
		}
76
	}
77
	}
Line 77... Line 78...
77
	
78
	
78
	
79
	
Line 79... Line 80...
79
	public function verifierParametres() {
80
	public function verifierParametres() {
80
		$this->verifierParametresAPI();
81
		//$this->verifierParametresAPI();
81
 
82
 
82
		$this->verifierParametre('recherche', 'stricte|floue|etendue');
83
		$this->verifierParametre('recherche', 'stricte|floue|etendue|complete');
Line 83... Line 84...
83
		$this->verifierParametre('ns.format', 'htm|txt');
84
		$this->verifierParametre('ns.format', 'htm|txt');
84
		$this->verifierParametre('retour.format', 'min|max|oss|perso');
85
		$this->verifierParametre('retour.format', 'min|max|oss|perso');
85
		$this->verifierParametreAvecValeurMultipe('ns.structure', 'an|au|bib|ad|gen|sp|ssp|fam|au_ss|bib_ss');
86
		$this->verifierParametreAvecValeurMultipe('ns.structure', 'an|au|bib|ad|gen|sp|ssp|fam|au_ss|bib_ss');
86
 
87
 
87
		if (count($this->erreursParametres) > 0) {
88
		/*if (count($this->erreursParametres) > 0) {
Line 88... Line 89...
88
			$m = 'Erreur dans votre requête : '.implode('<br/>', $this->erreursParametres);
89
			$m = 'Erreur dans votre requête : '.implode('<br/>', $this->erreursParametres);
89
			$this->renvoyerErreur(RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $m);
90
			$this->renvoyerErreur(RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $m);
90
		}
91
		}*/
Line 720... Line 721...
720
			}
721
			}
721
		}
722
		}
722
	}
723
	}
Line 723... Line 724...
723
 
724
 
-
 
725
	public function ajouterSignificationCode($champ, $valeur) {
-
 
726
		$categorie = $champ;	
-
 
727
		if($this->termeOntologieEstEnCache($categorie, $valeur)) {
-
 
728
			$nom_code = $this->obtenirTermeOntologieParCache($categorie, $valeur);
724
	public function ajouterSignificationCode($champ, $valeur) {
729
		} else {		
725
		$champ = ($champ == 'rang') ? 'rangTaxo' : rtrim($champ, '_Co,_Ga');
730
			$champ = ($champ == 'rang') ? 'rangTaxo' : rtrim($champ, '_Co,_Ga');
726
		if (preg_match('/^([^_-]+)(?:_|-)([^_-]+)$/', $champ, $match)) {
731
			if (preg_match('/^([^_-]+)(?:_|-)([^_-]+)$/', $champ, $match)) {
727
			$champ = $match[1].ucfirst($match[2]);
732
				$champ = $match[1].ucfirst($match[2]);
728
		}
733
			}
729
		$url = Config::get('url_ontologie').$champ.':'.$valeur.'/nom';
734
			$url = Config::get('url_ontologie').$champ.':'.$valeur.'/nom';
730
		$res = $this->consulterHref($url); //dans commun.php
735
			$res = $this->consulterHref($url); //dans commun.php
731
		$nom_code = $valeur;
736
			$nom_code = $valeur;
732
		if (is_object($res)) {
737
			if (is_object($res)) {
-
 
738
				$nom_code = $res->nom;
-
 
739
			}
733
			$nom_code = $res->nom;
740
			$this->mettreEnCacheOntologie($categorie, $valeur, $nom_code);
734
		}
741
		}
735
		return $nom_code;
742
		return $nom_code;
Line 736... Line 743...
736
	}
743
	}
Line 891... Line 898...
891
            }
898
            }
892
        }
899
        }
893
        $this->masque = $liste_masque;
900
        $this->masque = $liste_masque;
894
        return $masque;
901
        return $masque;
895
	}
902
	}
-
 
903
	
-
 
904
	private function mettreEnCacheOntologie($categorie, $valeur, $correspondance) {
-
 
905
		if(!isset($this->ontologie[$categorie])) {
-
 
906
			$this->ontologie[$categorie] = array();
-
 
907
		}
-
 
908
		if(!isset($this->ontologie[$categorie][$valeur])) {
-
 
909
			$this->ontologie[$categorie][$valeur] = array();
-
 
910
		}
-
 
911
		$this->ontologie[$categorie][$valeur] = $correspondance;
-
 
912
	}
-
 
913
	
-
 
914
	private function termeOntologieEstEnCache($categorie, $valeur) {
-
 
915
		return array_key_exists($categorie, $this->ontologie) && array_key_exists($valeur, $this->ontologie[$categorie]);
-
 
916
	}
-
 
917
	
-
 
918
	private function obtenirTermeOntologieParCache($categorie, $valeur) {
-
 
919
		return $this->ontologie[$categorie][$valeur];
-
 
920
	}
896
}
921
}
897
?>
922
?>
898
923