Line 220... |
Line 220... |
220 |
list($referentiel) = explode(':', strtolower($obs['nom_referentiel']));
|
220 |
list($referentiel) = explode(':', strtolower($obs['nom_referentiel']));
|
221 |
if($referentiel == 'bdtfx') $referentiel = 'nvjfl';
|
221 |
if($referentiel == 'bdtfx') $referentiel = 'nvjfl';
|
222 |
else return '';
|
222 |
else return '';
|
Line 223... |
Line 223... |
223 |
|
223 |
|
224 |
$cache_id = $referentiel . '-' . $obs['nt'] . '-' . $langue;
|
224 |
$cache_id = $referentiel . '-' . $obs['nt'] . '-' . $langue;
|
225 |
if(isset(self::cache['getNomCommun'][$cache_id])) {
|
225 |
if(isset(self::$cache['getNomCommun'][$cache_id])) {
|
226 |
//debug: error_log("require url_service_nom_attribution: OK ! (pour \"{$obs['nom_ret']}\")");
|
226 |
//debug: error_log("require url_service_nom_attribution: OK ! (pour \"{$obs['nom_ret']}\")");
|
227 |
return self::cache['getNomCommun'][$cache_id];
|
227 |
return self::$cache['getNomCommun'][$cache_id];
|
228 |
}
|
228 |
}
|
229 |
// pas de cache:
|
229 |
// pas de cache:
|
Line 230... |
Line 230... |
230 |
//debug: error_log("require url_service_nom_attribution pour \"{$obs['nom_ret']}\"");
|
230 |
//debug: error_log("require url_service_nom_attribution pour \"{$obs['nom_ret']}\"");
|
231 |
|
231 |
|
232 |
// pour bdtfx:
|
232 |
// pour bdtfx:
|
233 |
// /service:eflore:0.1/nvjfl/noms-vernaculaires/attributions?masque.nt=X&masque.lg=fra&retour.champs=num_statut
|
233 |
// /service:eflore:0.1/nvjfl/noms-vernaculaires/attributions?masque.nt=X&masque.lg=fra&retour.champs=num_statut
|
234 |
// /projet/services/modules/0.1/nvjfl/NomsVernaculaires.php
|
234 |
// /projet/services/modules/0.1/nvjfl/NomsVernaculaires.php
|
235 |
$url = str_replace(Array('{referentiel}', '{valeur}', '{langue}'),
|
235 |
$url = str_replace(Array('{referentiel}', '{valeur}', '{langue}'),
|
236 |
Array($referentiel, $obs['nt'], $langue),
|
236 |
Array($referentiel, $obs['nt'], $langue),
|
237 |
self::config['eflore']['url_service_nom_attribution']) .
|
237 |
self::$config['eflore']['url_service_nom_attribution']) . // TODO !
|
238 |
"&retour.champs=num_statut";
|
238 |
"&retour.champs=num_statut";
|
239 |
$noms = @json_decode(file_get_contents($url));
|
239 |
$noms = @json_decode(file_get_contents($url));
|
240 |
if(! $noms) return '';
|
240 |
if(! $noms) return '';
|
Line 241... |
Line 241... |
241 |
$noms = array_filter((array)($noms->resultat), function($item) { return ($item->num_statut == 1); });
|
241 |
$noms = array_filter((array)($noms->resultat), function($item) { return ($item->num_statut == 1); });
|
242 |
$nom = array_pop($noms)->nom_vernaculaire;
|
242 |
$nom = array_pop($noms)->nom_vernaculaire;
|
243 |
|
243 |
|
244 |
// cache
|
244 |
// cache
|
Line 245... |
Line 245... |
245 |
self::cache['getNomCommun'][$cache_id] = $nom;
|
245 |
self::$cache['getNomCommun'][$cache_id] = $nom;
|
246 |
return $nom;
|
246 |
return $nom;
|
Line 262... |
Line 262... |
262 |
list($referentiel) = explode(':', strtolower($obs['nom_referentiel']));
|
262 |
list($referentiel) = explode(':', strtolower($obs['nom_referentiel']));
|
263 |
if($referentiel == 'bdtfx') $referentiel = 'nvjfl';
|
263 |
if($referentiel == 'bdtfx') $referentiel = 'nvjfl';
|
264 |
else return '';
|
264 |
else return '';
|
Line 265... |
Line 265... |
265 |
|
265 |
|
266 |
$cache_id = $referentiel . '-' . $obs['nt'] . '-' . $langue;
|
266 |
$cache_id = $referentiel . '-' . $obs['nt'] . '-' . $langue;
|
267 |
if(isset(self::cache['getNomCommun'][$cache_id])) {
|
267 |
if(isset(self::$cache['getNomCommun'][$cache_id])) {
|
268 |
error_log("require NomsVernaculaires.php: OK ! (pour \"{$obs['nom_ret']}\")");
|
268 |
error_log("require NomsVernaculaires.php: OK ! (pour \"{$obs['nom_ret']}\")");
|
269 |
return self::cache['getNomCommun'][$cache_id];
|
269 |
return self::$cache['getNomCommun'][$cache_id];
|
270 |
}
|
270 |
}
|
271 |
// pas de cache:
|
271 |
// pas de cache:
|
Line 272... |
Line 272... |
272 |
error_log("require NomsVernaculaires.php pour \"{$obs['nom_ret']}\"");
|
272 |
error_log("require NomsVernaculaires.php pour \"{$obs['nom_ret']}\"");
|
Line 279... |
Line 279... |
279 |
if(! $noms) return '';
|
279 |
if(! $noms) return '';
|
280 |
$noms = array_filter((array)($noms->resultat), function($item) { return ($item->num_statut == 1); });
|
280 |
$noms = array_filter((array)($noms->resultat), function($item) { return ($item->num_statut == 1); });
|
281 |
$nom = array_pop($noms)->nom_vernaculaire;
|
281 |
$nom = array_pop($noms)->nom_vernaculaire;
|
Line 282... |
Line 282... |
282 |
|
282 |
|
283 |
// cache
|
283 |
// cache
|
284 |
self::cache['getNomCommun'][$cache_id] = $nom;
|
284 |
self::$cache['getNomCommun'][$cache_id] = $nom;
|
285 |
return $nom;
|
285 |
return $nom;
|
Line 286... |
Line 286... |
286 |
}
|
286 |
}
|
Line 296... |
Line 296... |
296 |
list($referentiel) = explode(':', strtolower($obs['nom_referentiel']));
|
296 |
list($referentiel) = explode(':', strtolower($obs['nom_referentiel']));
|
297 |
if($referentiel == 'bdtfx') $referentiel = 'nvjfl';
|
297 |
if($referentiel == 'bdtfx') $referentiel = 'nvjfl';
|
298 |
else return '';
|
298 |
else return '';
|
Line 299... |
Line 299... |
299 |
|
299 |
|
300 |
$cache_id = $referentiel . '-' . $obs['nt'] . '-' . $langue;
|
300 |
$cache_id = $referentiel . '-' . $obs['nt'] . '-' . $langue;
|
301 |
if(isset(self::cache['getNomCommun'][$cache_id])) {
|
301 |
if(isset(self::$cache['getNomCommun'][$cache_id])) {
|
302 |
error_log("require NomsVernaculaires.php: OK ! (pour \"{$obs['nom_ret']}\")");
|
302 |
error_log("require NomsVernaculaires.php: OK ! (pour \"{$obs['nom_ret']}\")");
|
303 |
return self::cache['getNomCommun'][$cache_id];
|
303 |
return self::$cache['getNomCommun'][$cache_id];
|
304 |
}
|
304 |
}
|
305 |
// pas de cache:
|
305 |
// pas de cache:
|
Line 306... |
Line 306... |
306 |
error_log("require NomsVernaculaires.php pour \"{$obs['nom_ret']}\"");
|
306 |
error_log("require NomsVernaculaires.php pour \"{$obs['nom_ret']}\"");
|
Line 318... |
Line 318... |
318 |
$noms = array_filter($noms['resultat'], function($item) { return ($item['num_statut'] == 1); });
|
318 |
$noms = array_filter($noms['resultat'], function($item) { return ($item['num_statut'] == 1); });
|
319 |
$premier_nom = array_pop($noms);
|
319 |
$premier_nom = array_pop($noms);
|
320 |
$nom = $premier_nom['nom_vernaculaire'];
|
320 |
$nom = $premier_nom['nom_vernaculaire'];
|
Line 321... |
Line 321... |
321 |
|
321 |
|
322 |
// cache
|
322 |
// cache
|
323 |
self::cache['getNomCommun'][$cache_id] = $nom;
|
323 |
self::$cache['getNomCommun'][$cache_id] = $nom;
|
324 |
return $nom;
|
324 |
return $nom;
|
Line 325... |
Line 325... |
325 |
}
|
325 |
}
|
326 |
|
326 |
|