diff --git a/controllers/JsonController.php b/controllers/JsonController.php index d0b9733..205713f 100644 --- a/controllers/JsonController.php +++ b/controllers/JsonController.php @@ -591,6 +591,12 @@ class JsonController extends Controller App::error404(); } + if ($trip->json) { + header('Content-Type: application/json'); + print $trip->json; + die; + } + $res = array( 'name' => $trip->name, 'time' => $trip->createdAt, @@ -642,7 +648,14 @@ class JsonController extends Controller $res['tracks'] = $resTracks; - self::renderPartial('json.php', $res); + $json = self::renderPartial('json.php', $res, TRUE); + + $trip->json = $json; + $trip->save(); + + header('Content-Type: application/json'); + print $json; + die; } } diff --git a/public/js/map.js b/public/js/map.js index b3cc75a..ba2c910 100644 --- a/public/js/map.js +++ b/public/js/map.js @@ -241,6 +241,9 @@ function initPoints(useBounds) .setContent('Координаты: N°' + getURLParameter('lat').substring(0,8) + ' E°' + getURLParameter('lng').substring(0,8)) .openOn(myMap); } + } else if (getURLParameter('track') != 'null') + { + showTrack(getURLParameter('track')) } } }); diff --git a/public/js/tracks.js b/public/js/tracks.js index edaf025..06b125a 100644 --- a/public/js/tracks.js +++ b/public/js/tracks.js @@ -1,5 +1,14 @@ var trips = new Object; +function showHideTrack(id) +{ + if($('#trackShowHide'+id).prop('checked')) { + showTrack(id) + } else { + hideTrack(id) + } +} + function showTrack(id) { if (typeof (trips[id]) == 'undefined') { diff --git a/views/indexTemplate.php b/views/indexTemplate.php index 4609000..76321da 100644 --- a/views/indexTemplate.php +++ b/views/indexTemplate.php @@ -112,9 +112,15 @@ if (App::$user) {
- - - +
+ + name ?> + + + +
+ + У вас пока нет сохраненных треков.