fix message displayed ID

This commit is contained in:
2019-02-20 22:27:29 +01:00
parent 077c38fe58
commit 29ffa3098a
2 changed files with 9 additions and 11 deletions

View File

@@ -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);
}
}

View File

@@ -263,7 +263,7 @@ function initSpotMessages(aoMessages, aoTracks) {
//Tooltip
$Tooltip = $('<div>', {'class':'info-window'})
.append($('<h1>')
.append('Message '+oMsg.type+' #'+oMsg.id_message))
.append('Message '+oMsg.type+' '+oMsg.displayed_id))
.append($('<p>', {'class':'time'})
.addIcon('fa-time')
.append(oMsg.formatted_time+(self.vars(['project', 'mode'])==self.consts.modes.blog?' ('+oMsg.relative_time+')':'')))