From 29ffa3098aa02381cd588c7d29fcc84348541457 Mon Sep 17 00:00:00 2001 From: franzz Date: Wed, 20 Feb 2019 22:27:29 +0100 Subject: [PATCH] fix message displayed ID --- inc/spot.php | 18 ++++++++---------- masks/project.html | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/inc/spot.php b/inc/spot.php index fa711d8..c284eb9 100755 --- a/inc/spot.php +++ b/inc/spot.php @@ -255,7 +255,6 @@ class Spot extends Main ); //Update on Blog Mode and not updated already today - $asAllFeedMessages = array(); foreach($asFeeds as $asFeed) { //Feed updated once a day in Blog Mode @@ -275,21 +274,20 @@ class Spot extends Main 'orderBy' => array('site_time'=>'ASC')); $asMessages = $this->oDb->selectRows($asInfo); - foreach($asMessages as $asMessage) + foreach($asMessages as $iIndex=>&$asMessage) { $asMessage['latitude'] = floatval($asMessage['latitude']); $asMessage['longitude'] = floatval($asMessage['longitude']); $asMessage['lat_dms'] = self::DecToDMS($asMessage['latitude'], 'lat'); $asMessage['lon_dms'] = self::DecToDMS($asMessage['longitude'], 'lon'); + $asMessage['displayed_id'] = 'N°'.($iIndex + 1); $this->addTimeStamp($asMessage, $asMessage['unix_time']); - - $asAllFeedMessages[] = $asMessage; } } - usort($asAllFeedMessages, function($a, $b){return $a['unix_time'] > $b['unix_time'];}); + usort($asMessages, function($a, $b){return $a['unix_time'] > $b['unix_time'];}); - return $asAllFeedMessages; + return $asMessages; } /** @@ -303,10 +301,12 @@ class Spot extends Main { $asPics = $this->oPicture->getPicsInfo(); $asValidPics = array(); - foreach($asPics as &$asPic) { + foreach($asPics as $iIndex=>$asPic) { $sTimeRef = $asPic[$sTimeRefField]; if($sTimeRef >= $this->oProject->getActivePeriod('from') && $sTimeRef <= $this->oProject->getActivePeriod('to')) { $asPic['taken_on_formatted'] = date(self::FORMAT_TIME, strtotime($asPic['taken_on'])); + $asPic['displayed_id'] = 'N°'.($iIndex + 1); + $this->addTimeStamp($asPic, strtotime($sTimeRef)); $asValidPics[] = $asPic; } @@ -368,15 +368,13 @@ class Spot extends Main ) ); foreach($asFeedTypes as $sFeedType=>$asFeedTypeInfo) { - foreach($asFeedTypeInfo['feed'] as $iIndex=>$asFeed) { + foreach($asFeedTypeInfo['feed'] as $asFeed) { $sPriority = $asFeedTypeInfo['priority']; if($bHistoMode) $sPriority = count($asFeedTypes) - 1 - $asFeedTypeInfo['priority']; $iId = ($asFeed['unix_time'] * -1).'.'.$sPriority.$asFeed[Db::getId($asFeedTypeInfo['table'])]; - $asFeeds[$iId] = $asFeed; $asFeeds[$iId]['type'] = $sFeedType; - if($sFeedType!='post') $asFeeds[$iId]['displayed_id'] = 'N°'.($iIndex + 1); } } diff --git a/masks/project.html b/masks/project.html index 739c586..69616c2 100755 --- a/masks/project.html +++ b/masks/project.html @@ -263,7 +263,7 @@ function initSpotMessages(aoMessages, aoTracks) { //Tooltip $Tooltip = $('
', {'class':'info-window'}) .append($('

') - .append('Message '+oMsg.type+' #'+oMsg.id_message)) + .append('Message '+oMsg.type+' '+oMsg.displayed_id)) .append($('

', {'class':'time'}) .addIcon('fa-time') .append(oMsg.formatted_time+(self.vars(['project', 'mode'])==self.consts.modes.blog?' ('+oMsg.relative_time+')':'')))