adding news feed chunks
This commit is contained in:
18
inc/spot.php
18
inc/spot.php
@@ -2,6 +2,10 @@
|
||||
|
||||
class Spot extends Main
|
||||
{
|
||||
//Spot Mode
|
||||
const MODE_HISTO = 'histo';
|
||||
const MODE_BLOG = 'blog';
|
||||
|
||||
//Spot feed
|
||||
const FEED_ID = '0Y5LrvigElWeAieBGnFol0KBEuOTkFJmm';
|
||||
const FEED_HOOK = 'https://api.findmespot.com/spot-main-web/consumer/rest-api/2.0/public/feed/';
|
||||
@@ -16,6 +20,8 @@ class Spot extends Main
|
||||
|
||||
const FORMAT_TIME = 'd/m/Y à H:i';
|
||||
|
||||
const FEED_CHUNK_SIZE = 15;
|
||||
|
||||
public function __construct($oClassManagement, $sProcessPage)
|
||||
{
|
||||
parent::__construct($oClassManagement, $sProcessPage);
|
||||
@@ -74,9 +80,11 @@ class Spot extends Main
|
||||
);
|
||||
}
|
||||
|
||||
public function getMainPage($asGlobalVars=array(), $sMainPage='index')
|
||||
public function getMainPage()
|
||||
{
|
||||
return parent::getMainPage(array('vars'=>array('feed_id'=>self::FEED_ID)));
|
||||
return parent::getMainPage(array('vars'=>array( 'feed_id' => self::FEED_ID,
|
||||
'chunk_size'=> self::FEED_CHUNK_SIZE,
|
||||
'mode' => Settings::MODE)));
|
||||
}
|
||||
|
||||
/* Getting & Storing messages */
|
||||
@@ -163,7 +171,7 @@ class Spot extends Main
|
||||
return $asMessages;
|
||||
}
|
||||
|
||||
public function getNewsFeed()
|
||||
public function getNewsFeed($iChunk=0)
|
||||
{
|
||||
$asFeed = array();
|
||||
|
||||
@@ -213,6 +221,10 @@ class Spot extends Main
|
||||
}
|
||||
|
||||
ksort($asFeed);
|
||||
|
||||
//split chunks
|
||||
$asFeed = array_slice($asFeed, $iChunk*self::FEED_CHUNK_SIZE, self::FEED_CHUNK_SIZE);
|
||||
|
||||
return self::getJsonResult(true, '', $asFeed);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user