29,6 → 29,7 |
protected $erreursParametres = null; |
protected $sans_nom_sci = array('gen','sp','ssp','fam','au_ss','bib_ss'); |
private $bib_traitees = array(); |
private $ontologie = array(); |
|
//+------------------------------- PARAMÈTRES ---------------------------------------------------------------+ |
|
77,17 → 78,17 |
|
|
public function verifierParametres() { |
$this->verifierParametresAPI(); |
//$this->verifierParametresAPI(); |
|
$this->verifierParametre('recherche', 'stricte|floue|etendue'); |
$this->verifierParametre('recherche', 'stricte|floue|etendue|complete'); |
$this->verifierParametre('ns.format', 'htm|txt'); |
$this->verifierParametre('retour.format', 'min|max|oss|perso'); |
$this->verifierParametreAvecValeurMultipe('ns.structure', 'an|au|bib|ad|gen|sp|ssp|fam|au_ss|bib_ss'); |
|
if (count($this->erreursParametres) > 0) { |
/*if (count($this->erreursParametres) > 0) { |
$m = 'Erreur dans votre requête : '.implode('<br/>', $this->erreursParametres); |
$this->renvoyerErreur(RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $m); |
} |
}*/ |
} |
|
public function verifierParametresAPI() { |
722,16 → 723,22 |
} |
|
public function ajouterSignificationCode($champ, $valeur) { |
$champ = ($champ == 'rang') ? 'rangTaxo' : rtrim($champ, '_Co,_Ga'); |
if (preg_match('/^([^_-]+)(?:_|-)([^_-]+)$/', $champ, $match)) { |
$champ = $match[1].ucfirst($match[2]); |
$categorie = $champ; |
if($this->termeOntologieEstEnCache($categorie, $valeur)) { |
$nom_code = $this->obtenirTermeOntologieParCache($categorie, $valeur); |
} else { |
$champ = ($champ == 'rang') ? 'rangTaxo' : rtrim($champ, '_Co,_Ga'); |
if (preg_match('/^([^_-]+)(?:_|-)([^_-]+)$/', $champ, $match)) { |
$champ = $match[1].ucfirst($match[2]); |
} |
$url = Config::get('url_ontologie').$champ.':'.$valeur.'/nom'; |
$res = $this->consulterHref($url); //dans commun.php |
$nom_code = $valeur; |
if (is_object($res)) { |
$nom_code = $res->nom; |
} |
$this->mettreEnCacheOntologie($categorie, $valeur, $nom_code); |
} |
$url = Config::get('url_ontologie').$champ.':'.$valeur.'/nom'; |
$res = $this->consulterHref($url); //dans commun.php |
$nom_code = $valeur; |
if (is_object($res)) { |
$nom_code = $res->nom; |
} |
return $nom_code; |
} |
|
893,5 → 900,23 |
$this->masque = $liste_masque; |
return $masque; |
} |
|
private function mettreEnCacheOntologie($categorie, $valeur, $correspondance) { |
if(!isset($this->ontologie[$categorie])) { |
$this->ontologie[$categorie] = array(); |
} |
if(!isset($this->ontologie[$categorie][$valeur])) { |
$this->ontologie[$categorie][$valeur] = array(); |
} |
$this->ontologie[$categorie][$valeur] = $correspondance; |
} |
|
private function termeOntologieEstEnCache($categorie, $valeur) { |
return array_key_exists($categorie, $this->ontologie) && array_key_exists($valeur, $this->ontologie[$categorie]); |
} |
|
private function obtenirTermeOntologieParCache($categorie, $valeur) { |
return $this->ontologie[$categorie][$valeur]; |
} |
} |
?> |