From 3f236c837ce9209ebea091317a058c7d69d55830 Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Mon, 21 Nov 2016 23:47:41 +0300 Subject: [PATCH] =?UTF-8?q?FIX=20=D0=BF=D0=BE=D0=B8=D1=81=D0=BA=20=D0=BF?= =?UTF-8?q?=D0=BE=20=D0=BA=D0=BE=D0=BE=D1=80=D0=B4=D0=B8=D0=BD=D0=B0=D1=82?= =?UTF-8?q?=D0=B0=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/JsonController.php | 14 ++++++++------ public/js/suggest.js | 3 +++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/controllers/JsonController.php b/controllers/JsonController.php index 8536d3e..7fdd0ef 100644 --- a/controllers/JsonController.php +++ b/controllers/JsonController.php @@ -476,6 +476,14 @@ class JsonController extends Controller if (!empty($out)) { $obj = simplexml_load_string($out); + if (isset($obj->GeoObjectCollection->metaDataProperty->GeocoderResponseMetaData->Point)) { + $coords = explode(' ', (string) $obj->GeoObjectCollection->metaDataProperty->GeocoderResponseMetaData->Point->pos); + $lat = $coords[1]; + $lng = $coords[0]; + $name = "Координаты N°" . $lat . ' E°' . $lng; + $results[] = array('value' => $name, 'data' => "/?lat=$lat&lng=$lng&zoom=13&marker=true"); + } + if (isset($obj->GeoObjectCollection->metaDataProperty->GeocoderResponseMetaData->found)) { $count = (int) $obj->GeoObjectCollection->metaDataProperty->GeocoderResponseMetaData->found; if ($count > 0) { @@ -486,12 +494,6 @@ class JsonController extends Controller $lng = $coords[0]; $results[] = array('value' => $name, 'data' => "/?lat=$lat&lng=$lng&zoom=13&marker=true"); } - } else if (isset($obj->GeoObjectCollection->metaDataProperty->GeocoderResponseMetaData->Point)) { - $coords = explode(' ', (string) $obj->GeoObjectCollection->metaDataProperty->GeocoderResponseMetaData->Point->pos); - $lat = $coords[1]; - $lng = $coords[0]; - $name = "Координаты N°" . $lat . ' E°' . $lng; - $results[] = array('value' => $name, 'data' => "/?lat=$lat&lng=$lng&zoom=13&marker=true"); } } } diff --git a/public/js/suggest.js b/public/js/suggest.js index c1a2b66..e89c350 100644 --- a/public/js/suggest.js +++ b/public/js/suggest.js @@ -40,6 +40,9 @@ function suggestKeyPress(key) if ( $('div.hover','#suggestContainer').length > 0 ) { link = $('a', $('div.hover','#suggestContainer')).attr('href'); window.location.href = link; + } else if ( $('div','#suggestContainer').length > 0 ) { + link = $('a', $('div','#suggestContainer')).attr('href'); + window.location.href = link; } else { searchAdderess(); }