public static function getAllForCategory($categoryId, $limit = null, $excludeIds = null)
{
$categoryId = (int) $categoryId;
$limit = (int) $limit;
$excludeIds = empty($excludeIds) ? array(0) : (array) $excludeIds;
// get items
if ($limit != null) {
$items = (array) FrontendModel::getContainer()->get('database')->getRecords('SELECT i.*, m.url
FROM faq_questions AS i
INNER JOIN meta AS m ON i.meta_id = m.id
WHERE i.category_id = ? AND i.language = ? AND i.hidden = ?
AND i.id NOT IN (' . implode(',', $excludeIds) . ')
ORDER BY i.sequence
LIMIT ?', array((int) $categoryId, LANGUAGE, 'N', (int) $limit));
} else {
$items = (array) FrontendModel::getContainer()->get('database')->getRecords('SELECT i.*, m.url
FROM faq_questions AS i
INNER JOIN meta AS m ON i.meta_id = m.id
WHERE i.category_id = ? AND i.language = ? AND i.hidden = ?
AND i.id NOT IN (' . implode(',', $excludeIds) . ')
ORDER BY i.sequence', array((int) $categoryId, LANGUAGE, 'N'));
}
// init var
$link = FrontendNavigation::getURLForBlock('Faq', 'Detail');
// build the item urls
foreach ($items as &$item) {
$item['full_url'] = $link . '/' . $item['url'];
}
return $items;
}