From a6091736691688496ef0b10813d50430de05d056 Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Sun, 6 Dec 2015 23:33:32 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=B0=D1=80=D0=BA=D0=B5=D1=80=20=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=BA=D0=B0=D1=80=D1=82=D0=B5,=20=D0=BF=D1=80=D0=B8?= =?UTF-8?q?=20=D0=B2=D1=8B=D0=B1=D0=BE=D1=80=D0=B5=20=D0=BC=D0=B5=D1=81?= =?UTF-8?q?=D1=82=D0=B0=20=D0=B2=20=D1=80=D0=B5=D0=B7=D1=83=D0=BB=D1=8C?= =?UTF-8?q?=D1=82=D0=B0=D1=82=D0=B0=D1=85=20=D0=BF=D0=BE=D0=B8=D1=81=D0=BA?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/IndexController.php | 4 ++-- controllers/JsonController.php | 4 ++-- public/js/map.js | 7 +++++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/controllers/IndexController.php b/controllers/IndexController.php index 377c561..405f115 100644 --- a/controllers/IndexController.php +++ b/controllers/IndexController.php @@ -57,8 +57,8 @@ class IndexController extends Controller App::setConfig('title', App::$defaultTitle); self::addVar('isAdmin', (int) (App::$user && App::$user->isAdmin == 1)); - self::addVar('pointLat', 0); - self::addVar('pointLng', 0); + self::addVar('pointLat', (isset($_GET['lat'])?floatval($_GET['lat']):0)); + self::addVar('pointLng', (isset($_GET['lng'])?floatval($_GET['lng']):0)); $categoryArray = array(); foreach ($category as $cat) { diff --git a/controllers/JsonController.php b/controllers/JsonController.php index bd26842..0fdaf59 100644 --- a/controllers/JsonController.php +++ b/controllers/JsonController.php @@ -491,7 +491,7 @@ class JsonController extends Controller $lat = $coords[1]; $lng = $coords[0]; $name = "Координаты N°" . $lat . ' E°' . $lng; - $results[] = array('value' => $name, 'data' => "/?lat=$lat&lng=$lng&zoom=13"); + $results[] = array('value' => $name, 'data' => "/?lat=$lat&lng=$lng&zoom=13&marker=true"); } } } @@ -517,7 +517,7 @@ class JsonController extends Controller $name = (string) $obj->results[$index]->formatted_address; $lat = (string) $obj->results[$index]->geometry->location->lat; $lng = (string) $obj->results[$index]->geometry->location->lng; - $results[] = array('value' => $name, 'data' => "/?lat=$lat&lng=$lng&zoom=13"); + $results[] = array('value' => $name, 'data' => "/?lat=$lat&lng=$lng&zoom=13&marker=true"); } } } diff --git a/public/js/map.js b/public/js/map.js index cd97d31..21887ed 100644 --- a/public/js/map.js +++ b/public/js/map.js @@ -218,6 +218,13 @@ function initPoints(useBounds) } else if ((getURLParameter('lat') != 'null') && (getURLParameter('lng') != 'null') && (getURLParameter('zoom') != 'null')) { myMap.setView([getURLParameter('lat'), getURLParameter('lng')], getURLParameter('zoom')); + + if (getURLParameter('marker') == 'true') { + L.popup() + .setLatLng([getURLParameter('lat'), getURLParameter('lng')]) + .setContent('Координаты: N°' + getURLParameter('lat').substring(0,8) + ' E°' + getURLParameter('lng').substring(0,8)) + .openOn(myMap); + } } } });