fix status in news + max nb of news
This commit is contained in:
@@ -1836,9 +1836,10 @@ class Databap extends PhpObject
|
||||
public function getNews()
|
||||
{
|
||||
$sMsgIdCol = MySqlManager::getId(self::MSG_TABLE);
|
||||
$sMsgTxtCol = MySqlManager::getText(self::MSG_TABLE);
|
||||
|
||||
//News
|
||||
$asInfo['select'] = array($sMsgIdCol, 'nickname', MySqlManager::getText(self::MSG_TABLE), 'led');
|
||||
$asInfo['select'] = array($sMsgIdCol, 'nickname', $sMsgTxtCol, 'type', 'led');
|
||||
$asInfo['from'] = self::MSG_TABLE;
|
||||
$asInfo['constraint'] = array('type'=>self::MESSAGE_NEWS);
|
||||
$asInfo['orderBy'] = array('led'=>'DESC');
|
||||
@@ -1846,6 +1847,7 @@ class Databap extends PhpObject
|
||||
$asNews = $this->oMySql->selectRows($asInfo);
|
||||
|
||||
//Status
|
||||
//$asInfo['select'] = array($sMsgIdCol, 'nickname', "CONCAT(nickname, SPACE(1), ".$sMsgTxtCol." AS ".$sMsgTxtCol, 'led');
|
||||
$asInfo['constraint'] = array('type'=>self::MESSAGE_STATUS);
|
||||
$asStatus = $this->oMySql->selectRows($asInfo);
|
||||
|
||||
@@ -1854,7 +1856,12 @@ class Databap extends PhpObject
|
||||
$asNews = array_merge($asNews, $asStatus);
|
||||
foreach($asNews as $iKey=>$asNewsInfo) $asNewsSort[$iKey] = strtotime($asNewsInfo['led']);
|
||||
arsort($asNewsSort);
|
||||
foreach($asNewsSort as $iKey=>$iTimestamp) $asNews2[] = $asNews[$iKey];
|
||||
foreach($asNewsSort as $iKey=>$iTimestamp)
|
||||
{
|
||||
if($asNews[$iKey]['type']==self::MESSAGE_STATUS) $asNews[$iKey][$sMsgTxtCol] = $asNews[$iKey]['nickname'].' '.$asNews[$iKey][$sMsgTxtCol];
|
||||
$asNews2[] = $asNews[$iKey];
|
||||
if(count($asNews2)==3) break;
|
||||
}
|
||||
|
||||
$asFormatNews = array();
|
||||
foreach($asNews2 as $asNew)
|
||||
|
||||
Reference in New Issue
Block a user