diff --git a/js/photosController.js b/js/photosController.js index 5905bf34c..51bd89211 100644 --- a/js/photosController.js +++ b/js/photosController.js @@ -51,6 +51,13 @@ PhotosController.prototype = { $(this).parent().parent().parent().find('>.app-navigation-entry-menu').addClass('open'); } }); + // expand navigation + $('body').on('click', '#navigation-photos', function(e) { + if (e.target.tagName === 'LI' && $(e.target).attr('id') === 'navigation-photos') { + that.toggleNavigation(); + that.optionsController.saveOptionValues({photosNavigationShow: $('#navigation-favorites').hasClass('open')}); + } + }); }, updateMyFirstLastDates: function() { @@ -86,6 +93,10 @@ PhotosController.prototype = { } }, + toggleNavigation: function() { + $('#navigation-photos').toggleClass('open'); + }, + getPhotoMarkerOnClickFunction: function() { var _app = this; return function(evt) { diff --git a/lib/Service/GeophotoService.php b/lib/Service/GeophotoService.php index e19d90be1..55d4bf832 100644 --- a/lib/Service/GeophotoService.php +++ b/lib/Service/GeophotoService.php @@ -25,6 +25,7 @@ use OCA\Maps\DB\Geophoto; use OCA\Maps\DB\GeophotoMapper; use OCA\Maps\Service\TracksService; +use OCA\Maps\Service\DevicesService; class GeophotoService { @@ -35,8 +36,9 @@ class GeophotoService { private $preview; private $tracksService; private $timeordedPointSets; + private $devicesService; - public function __construct (ILogger $logger, IRootFolder $root, IL10N $l10n, GeophotoMapper $photoMapper, IPreview $preview, TracksService $tracksService, $userId) { + public function __construct (ILogger $logger, IRootFolder $root, IL10N $l10n, GeophotoMapper $photoMapper, IPreview $preview, TracksService $tracksService, DevicesService $devicesService, $userId) { $this->root = $root; $this->l10n = $l10n; $this->photoMapper = $photoMapper; @@ -45,6 +47,7 @@ public function __construct (ILogger $logger, IRootFolder $root, IL10N $l10n, Ge $this->tracksService = $tracksService; $this->timeordedPointSets = null; $this->userId = $userId; + $this->devicesService = $devicesService; } @@ -165,6 +168,15 @@ private function loadTimeordedPointSets($userId) { } } } + foreach ($this->devicesService->getDevicesFromDB($userId) as $device) { + $device_points = $this->devicesService->getDevicePointsFromDB($userId, $device); + $points = []; + foreach ($device_points as $pt) { + $points[$pt->timestamp] = [(string) $pt->lat, (string) $pt->lng]; + } + $foo = ksort($points); + $this->timeordedPointSets[] = $points; + } return null; } @@ -207,6 +219,13 @@ private function getTimeorderdPointsFromTrack($track) { * @param $points array sorted by keys timestamp => [lat, lng] */ private function getLocationFromSequenceOfPoints($dateTaken, $points) { + $foo = end($points); + $end = key($points); + $foo = reset($points); + $start = key($points); + if ($start > $dateTaken OR $end < $dateTaken) { + return null; + } $smaller = null; $bigger = null; foreach ($points as $time => $locations) { diff --git a/templates/navigation/index.php b/templates/navigation/index.php index 230032ae8..d33f38bfb 100644 --- a/templates/navigation/index.php +++ b/templates/navigation/index.php @@ -68,7 +68,7 @@ -