Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 655 → Rev 656

/trunk/services/modules/0.1/bdtfx/CommunNomsTaxons.php
44,7 → 44,7
$this->remplirTableCompositionNom($val);
if (in_array($val,$this->sans_nom_sci)){
$this->requete_champ = implode(', ',$this->compo_nom);
}else {
}else {
$this->requete_champ .= ' ,'.implode(', ',$this->compo_nom);
}
break;
75,8 → 75,8
$this->parametres['ns.structure'] = 'au,an,bib';
}
}
 
 
public function verifierParametres() {
//$this->verifierParametresAPI();
 
141,7 → 141,7
$val = $this->modifierValeur($val);
$conditions[] = "$nom_champ LIKE ".$this->getBdd()->proteger($val);
}
 
} elseif ($this->parametres['recherche'] == 'floue') {
foreach ($valeur as $val) {
$val = $this->getBdd()->proteger($val);
243,15 → 243,17
* au nom_sci (annee, auteur, biblio ou addendum). */
public function remplirTableCompositionNom($valeur) {
$structure_nom = explode(',', $valeur);
 
foreach ($structure_nom as $structure) {
//avec str_replace() 'sp' est inclu dans 'ssp', et la conversion pour 'ssp' est mauvaise
$this->compo_nom[$structure] =
preg_replace(array('/^an$/', '/^au$/', '/^bib$/', '/^ad$/',
'/^sp$/', '/^gen$/', '/^ssp$/','/^fam$/','/^au_ss$/','/^bib_ss$/'),
array('annee', 'auteur', 'biblio_origine', 'nom_addendum',
'epithete_sp', 'genre', 'epithete_infra_sp','famille','auteur', 'biblio_origine'),
$structure);
}
$structure = trim($structure);
$patterns = array('/^an$/', '/^au$/', '/^bib$/', '/^ad$/', '/^sp$/', '/^gen$/', '/^ssp$/','/^fam$/',
'/^au_ss$/','/^bib_ss$/');
$champs = array('annee', 'auteur', 'biblio_origine', 'nom_addendum', 'epithete_sp', 'genre',
'epithete_infra_sp','famille','auteur', 'biblio_origine');
 
// avec str_replace() 'sp' est inclu dans 'ssp', et la conversion pour 'ssp' est mauvaise
$this->compo_nom[$structure] = preg_replace($patterns, $champs, $structure);
}
}
 
public function mettreAuFormat() {
301,9 → 303,9
$oss[] = $res;
}
}
 
}
 
if (isset($this->masque)) $masque = implode('&', $this->masque);
else $masque = 'Pas de masque';
$table_retour_oss = array($masque, $oss);
336,6 → 338,7
$retenu = 'absent';
}
$this->table_retour['retenu'] = $retenu;
// Pourquoi ce unset ? JPM - 28-03-2013
unset($this->table_retour['id']);
}
 
380,7 → 383,7
if (strrpos($champ, '.*') !== false) {
$this->afficherPointEtoile($champ, $reponse_id);
} elseif (in_array($champ, $champs_a_libeller)) {
$this->table_retour[$champ.'.libelle'] =
$this->table_retour[$champ.'.libelle'] =
(isset($reponse_id[$champ.'.libelle'])) ? $reponse_id[$champ.'.libelle'] : null;
} else {
$champ = $this->trouverChampBddCorrespondant($champ);
723,10 → 726,10
}
 
public function ajouterSignificationCode($champ, $valeur) {
$categorie = $champ;
$categorie = $champ;
if($this->termeOntologieEstEnCache($categorie, $valeur)) {
$nom_code = $this->obtenirTermeOntologieParCache($categorie, $valeur);
} else {
} else {
$champ = ($champ == 'rang') ? 'rangTaxo' : rtrim($champ, '_Co,_Ga');
if (preg_match('/^([^_-]+)(?:_|-)([^_-]+)$/', $champ, $match)) {
$champ = $match[1].ucfirst($match[2]);
832,7 → 835,7
if (isset($bib_ss)) {
$bibl = $this->tronquerBiblio($bib_ss);
//simule un 'select distinct' sur les biblio tronquées
if (!isset($this->bib_traitees[$bibl])) {
if (!isset($this->bib_traitees[$bibl])) {
$nom_complet[] = sprintf($format['bib_ss'],$bibl );
$this->bib_traitees[$bibl] = 1;
}
846,15 → 849,15
$bib = explode(',',$valeur);
}
if(strpos($bib[0],';') !== false) {
 
$bib[0] = strstr($bib[0],';');
$bib[0] = str_replace('; ','',$bib[0]);
}
return $bib[0];
}
 
 
 
public function correspondAUnCode($key) {
return (strrpos($key, '.code') !== false) || (in_array($key.'.code', $this->correspondance_champs));
}
900,7 → 903,7
$this->masque = $liste_masque;
return $masque;
}
 
private function mettreEnCacheOntologie($categorie, $valeur, $correspondance) {
if(!isset($this->ontologie[$categorie])) {
$this->ontologie[$categorie] = array();
910,11 → 913,11
}
$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];
}