fix feed sorting and image numbering
This commit is contained in:
28
inc/spot.php
28
inc/spot.php
@@ -84,8 +84,7 @@ class Spot extends Main
|
||||
private function getFeed($sRefFeedId=self::FEED_ID)
|
||||
{
|
||||
$sUrl = self::FEED_HOOK.$sRefFeedId.self::FEED_TYPE_JSON;
|
||||
//$sContent = file_get_contents($sUrl);
|
||||
$sContent = '{"response":{"feedMessageResponse":{"count":1,"feed":{"id":"0Y5LrvigElWeAieBGnFol0KBEuOTkFJmm","name":"Te Araroa","description":"Te Araroa","status":"ACTIVE","usage":0,"daysRange":7,"detailedMessageShown":false},"totalCount":1,"activityCount":0,"messages":{"message":{"@clientUnixTime":"0","id":477259564,"messengerId":"0-2489517","messengerName":"Francois","unixTime":1449002345,"messageType":"OK","latitude":48.85129,"longitude":2.40491,"modelId":"SPOT3","showCustomMsg":"N","dateTime":"2015-12-01T20:39:05+0000","messageDetail":"","batteryState":"GOOD","hidden":0,"messageContent":"Jusque là , tout va bien ! Click sur le lien en dessous pour voir où je suis :)\r\n\r\n@Clara: <3"}}}}}';
|
||||
$sContent = file_get_contents($sUrl);
|
||||
return json_decode($sContent, true);
|
||||
}
|
||||
|
||||
@@ -172,7 +171,7 @@ class Spot extends Main
|
||||
$asMessages = $this->getSpotMessages();
|
||||
foreach($asMessages as $asMessage)
|
||||
{
|
||||
$iId = $asMessage['unix_timestamp'] * -1;
|
||||
$iId = ($asMessage['unix_timestamp']*-1).'.0'.$asMessage[MySqlManager::getId(self::MSG_TABLE)];
|
||||
$asFeed[$iId] = $asMessage;// array('type'=>'message', 'time'=>$asMessage['relative_time'], 'text'=>$asMessage['relative_time']);
|
||||
$asFeed[$iId]['type'] = 'message';
|
||||
$asFeed[$iId]['id'] = $asMessage[MySqlManager::getId(self::MSG_TABLE)];
|
||||
@@ -187,23 +186,30 @@ class Spot extends Main
|
||||
$iPicTimeStamp = $asPicInfo['timestamp'];
|
||||
|
||||
//Preparing pictures sorting key and related info
|
||||
$asFeed[$iPicTimeStamp*-1] = array( 'type' => 'picture',
|
||||
'id' => $iKey,
|
||||
'path' => $sPicPath,
|
||||
'rotate' => $asPicInfo['rotate'],
|
||||
'formatted_time'=> date(self::FORMAT_TIME, $iPicTimeStamp),
|
||||
'relative_time' => Toolbox::getDateTimeDesc($iPicTimeStamp));
|
||||
$asPics[($iPicTimeStamp*-1).'.1'.$iKey] = array( 'type' => 'picture',
|
||||
'path' => $sPicPath,
|
||||
'rotate' => $asPicInfo['rotate'],
|
||||
'formatted_time'=> date(self::FORMAT_TIME, $iPicTimeStamp),
|
||||
'relative_time' => Toolbox::getDateTimeDesc($iPicTimeStamp));
|
||||
}
|
||||
ksort($asPics);
|
||||
$iCount = count($asPics);
|
||||
foreach($asPics as $iKey=>$asPic)
|
||||
{
|
||||
$asFeed[$iKey] = $asPic;
|
||||
$asFeed[$iKey]['id'] = $iCount--;
|
||||
}
|
||||
|
||||
//Post
|
||||
$asPosts = $this->oMySql->selectRows(array('from'=>self::POST_TABLE));
|
||||
foreach($asPosts as $iKey=>$asPost)
|
||||
foreach($asPosts as $asPost)
|
||||
{
|
||||
$iUnixTimeStamp = strtotime($asPost['led']);
|
||||
$iId = $iUnixTimeStamp * -1;
|
||||
$iId = ($iUnixTimeStamp*-1).'.2'.$asPost[MySqlManager::getId(self::POST_TABLE)];
|
||||
$asFeed[$iId] = array('name'=>Toolbox::mb_ucwords($asPost['name']), 'post'=>$asPost['content'], 'type'=>'post');;
|
||||
$asFeed[$iId]['relative_time'] = Toolbox::getDateTimeDesc($iUnixTimeStamp);
|
||||
$asFeed[$iId]['formatted_time'] = date(self::FORMAT_TIME, $iUnixTimeStamp);
|
||||
$asFeed[$iId]['id'] = $asPost[MySqlManager::getId(self::POST_TABLE)];
|
||||
}
|
||||
|
||||
ksort($asFeed);
|
||||
|
||||
@@ -18,7 +18,7 @@ oSpot.pageInit = function(asHash)
|
||||
|
||||
//Build Feed
|
||||
updateFeed();
|
||||
setInterval(updateFeed, 60 * 1000); //refresh every minute
|
||||
//setInterval(updateFeed, 60 * 1000); //refresh every minute
|
||||
|
||||
//Building messages
|
||||
aoMessages = [];
|
||||
@@ -117,7 +117,9 @@ function updateFeed()
|
||||
switch(asPost.type)
|
||||
{
|
||||
case 'message':
|
||||
$Body = $('<span>').addIcon('fa-compass', true).append(asPost.latitude+' | '+asPost.longitude);
|
||||
$Body = $('<div>')
|
||||
.append($('<p>').addIcon('fa-compass', true).append(asPost.latitude+' | '+asPost.longitude))
|
||||
.append($('<p>').addIcon('fa-clock-o', true).append(asPost.formatted_time));
|
||||
sClass = 'compass';
|
||||
break;
|
||||
case 'picture':
|
||||
|
||||
@@ -2837,32 +2837,39 @@
|
||||
#feed #posts .post.message {
|
||||
background: #6DFF58;
|
||||
color: #326526; }
|
||||
/* line 118, spot.scss */
|
||||
/* line 117, spot.scss */
|
||||
#feed #posts .post.message p {
|
||||
font-size: 0.9em;
|
||||
margin: 0.5em 0; }
|
||||
/* line 122, spot.scss */
|
||||
#feed #posts .post.message p:first-child {
|
||||
margin-top: 1em; }
|
||||
/* line 127, spot.scss */
|
||||
#feed #posts .fa.push {
|
||||
margin-right: 0.5em; }
|
||||
|
||||
/* Info Window */
|
||||
/* line 126, spot.scss */
|
||||
/* line 135, spot.scss */
|
||||
.info-window h1 {
|
||||
font-size: 1.2em; }
|
||||
|
||||
/* line 129, spot.scss */
|
||||
/* line 138, spot.scss */
|
||||
.info-window p {
|
||||
font-size: 1.0em; }
|
||||
|
||||
/* line 133, spot.scss */
|
||||
/* line 142, spot.scss */
|
||||
.info-window i {
|
||||
padding-right: 0.5em;
|
||||
font-size: 1.33333333em;
|
||||
line-height: 0.75em;
|
||||
vertical-align: -15%; }
|
||||
|
||||
/* line 141, spot.scss */
|
||||
/* line 150, spot.scss */
|
||||
.info-window .battery {
|
||||
text-transform: capitalize; }
|
||||
|
||||
/* Upload */
|
||||
/* line 147, spot.scss */
|
||||
/* line 156, spot.scss */
|
||||
.bar {
|
||||
height: 18px;
|
||||
background: green; }
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -113,6 +113,15 @@
|
||||
.post.message {
|
||||
background: #6DFF58;
|
||||
color:#326526;
|
||||
|
||||
p {
|
||||
font-size:0.9em;
|
||||
margin:0.5em 0;
|
||||
}
|
||||
|
||||
p:first-child {
|
||||
margin-top:1em;
|
||||
}
|
||||
}
|
||||
|
||||
.fa.push {
|
||||
|
||||
Reference in New Issue
Block a user