Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 1669 Rev 1684
Line 405... Line 405...
405
   			foreach ($parametres as $cle => $valeur) {
405
   			foreach ($parametres as $cle => $valeur) {
406
   				if (preg_match('/^'.$table['prefixe'].'_/', $cle)) {
406
   				if (preg_match('/^'.$table['prefixe'].'_/', $cle)) {
407
   					// Contient les noms des champs seulements
407
   					// Contient les noms des champs seulements
408
   					$tables_a_modifier[$table_id]['champs'][] = $cle;
408
   					$tables_a_modifier[$table_id]['champs'][] = $cle;
409
   					// Contient un tableau de résultats protégé pour l'inclusion en bdd
409
   					// Contient un tableau de résultats protégé pour l'inclusion en bdd
410
   					$tables_a_modifier[$table_id]['champs_valeurs_protege'][$cle] = $this->bdd->quote($valeur);
410
   					$tables_a_modifier[$table_id]['champs_valeurs_protege'][$cle] = is_null($valeur) ? 'NULL' : $this->bdd->quote($valeur);
411
   					// Contient un tableau de résultats non protégé
411
   					// Contient un tableau de résultats non protégé
412
   					$tables_a_modifier[$table_id]['champs_valeurs_brut'][$cle] = $valeur;
412
   					$tables_a_modifier[$table_id]['champs_valeurs_brut'][$cle] = $valeur;
413
   					if (preg_match('/_id_/', $cle)) {
413
   					if (preg_match('/_id_/', $cle)) {
414
   						$tables_a_modifier[$table_id]['champs_valeurs_id'][$cle] = $valeur;
414
   						$tables_a_modifier[$table_id]['champs_valeurs_id'][$cle] = $valeur;
415
   					}
415
   					}
Line 696... Line 696...
696
													'postalcode' => $data['cp'],
696
													'postalcode' => $data['cp'],
697
													'country' => $data['pays'])),
697
													'country' => $data['pays'])),
698
								 $opts ? $opts : array());
698
								 $opts ? $opts : array());
699
		}
699
		}
700
		$fullquery = 'http://nominatim.openstreetmap.org/search.php?' . http_build_query($query);
700
		$fullquery = 'http://nominatim.openstreetmap.org/search.php?' . http_build_query($query);
-
 
701
 
701
		$r = json_decode(file_get_contents($fullquery));
702
        $r = json_decode(file_get_contents($fullquery));
702
		error_log(sprintf("COEL: Nominatim request returned %d result(s) [%s]", count($r), $fullquery));
703
		error_log(sprintf("COEL: Nominatim request returned %d result(s) [%s]", count($r), $fullquery));
703
		if($r && isset($r[0])) {
704
		if($r && isset($r[0])) {
704
			$lonlat['lon'] = $r[0]->lon;
705
			$lonlat['lon'] = $r[0]->lon;
705
			$lonlat['lat'] = $r[0]->lat;
706
			$lonlat['lat'] = $r[0]->lat;
706
			return TRUE;
707
			return TRUE;