public function indexLastBlock()
{
$nLimit = config::sys('bbs.index.last.limit', 10);
if ($nLimit > 30) $nLimit = 30;
if (!$nLimit) return '';
$aData = array();
$sLimit = $this->db->prepareLimit(0, $nLimit);
$sqlTablePrefix = 'I.';
$sOrder = $sqlTablePrefix.'publicated_order DESC';
$aFilter = array(
'status' => self::STATUS_PUBLICATED,
);
if (static::premoderation()) {
$aFilter[':mod'] = $sqlTablePrefix . 'moderated > 0';
}
$aData['title'] = _t('bbs', 'Последние объявления');
$aSvc = $this->svc()->model()->svcData(BBS::SERVICE_PREMIUM, array('id'));
if (!empty($aSvc['on'])) {
$aData['title'] = _t('bbs', 'Премиум объявления');
$sOrder = $sqlTablePrefix.'svc_premium_order DESC';
$aFilter[':premium'] = $sqlTablePrefix . 'svc & ' . BBS::SERVICE_PREMIUM . ' > 0 ';
}
$aData['items'] = $this->model->itemsList($aFilter, false, $sLimit, $sOrder);
if (empty($aData['items'])) return '';
return $this->viewPHP($aData, 'index.last.block');
}