| // +---------------------------------------------------------------------------+ /** * Site news block. * * @package block * @author Demian Turner */ class Publisher_Block_RecentHtmlArticles { var $webRoot = SGL_BASE_URL; function init() { return $this->getBlockContent(); } function getBlockContent() { $aResult = $this->retrieveAll(); $newList = $this->toHtml($aResult); $newsContent = $newList; return $newsContent; } /** * Retrieves all published articles. * * @access public * @return array $aArticles array of article objects */ function retrieveAll() { $dbh = & SGL_DB::singleton(); $c = &SGL_Config::singleton(); $conf = $c->getAll(); $query = " SELECT i.item_id, ia.addition, i.start_date FROM {$conf['table']['item']} i, {$conf['table']['item_addition']} ia, {$conf['table']['item_type']} it, {$conf['table']['item_type_mapping']} itm WHERE ia.item_type_mapping_id = itm.item_type_mapping_id AND it.item_type_id = itm.item_type_id AND i.item_id = ia.item_id AND i.start_date < '" . SGL_Date::getTime() . "' AND (i.expiry_date > '" . SGL_Date::getTime() . "' OR i.expiry_date IS NULL) AND itm.field_name = 'title' AND it.item_type_id = 2 AND i.status = " . SGL_STATUS_PUBLISHED . " ORDER BY i.start_date DESC LIMIT 5 "; $aArticles = $dbh->getAll($query); if (!DB::isError($aArticles)) { return $aArticles; } else { SGL::raiseError('perhaps no item tables exist', SGL_ERROR_NODATA); } } function toHtml($aNewsItems) { SGL::logMessage(null, PEAR_LOG_DEBUG); $newItems = '"; return $newItems; } else { return 'no recent HTML Articles'; } } } ?>