From 4e05436a39f2953561114cafa239eee2af0649dd Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Thu, 20 Nov 2014 21:27:47 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D0=BE=D1=80=D0=B4=D0=B8=D0=BD?= =?UTF-8?q?=D0=B0=D1=82=D1=8B=20=D0=BF=D1=80=D0=B8=20=D0=B8=D0=BD=D0=B8?= =?UTF-8?q?=D1=86=D0=B8=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?=D0=BA=D0=B0=D1=80=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ground/controllers/IndexController.php | 6 ++++++ public/js/map.js | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ground/controllers/IndexController.php b/ground/controllers/IndexController.php index 9ef6f9b..38ac110 100644 --- a/ground/controllers/IndexController.php +++ b/ground/controllers/IndexController.php @@ -64,6 +64,9 @@ class IndexController extends Controller App::setConfig('title', $res['pointsCount'] . ' или даже больше поводов не сидеть дома'); self::addVar('pointsCount', $res['pointsCount']); + self::addVar('pointLat', 0); + self::addVar('pointLng', 0); + if (isset($_GET['point']) && $_GET['point'] && is_numeric($_GET['point'])) { $id = (int) $_GET['point']; @@ -75,6 +78,9 @@ class IndexController extends Controller $point->descriptionHtml .= ' #wikipoints'; $og = Helper::buildOG($point); + + self::addVar('pointLat', $point->lat); + self::addVar('pointLng', $point->lng); } else if (isset($_GET['point']) && $_GET['point'] && strtolower($_GET['point']) == 'random') { $og = array(); diff --git a/public/js/map.js b/public/js/map.js index 37b23db..8b720da 100644 --- a/public/js/map.js +++ b/public/js/map.js @@ -29,7 +29,12 @@ categories.im = L.icon({ ymaps.ready(function () { lat = ymaps.geolocation.latitude; lng = ymaps.geolocation.longitude; - init(lat, lng); + + if (pointLat == pointLng) { + init(lat, lng); + } else { + init(pointLat, pointLng); + } points.im = L.marker([lat, lng], {icon: categories.im, title: 'Вы здесь'}); points.im.addTo(myMap);