getAllForCategory() public static method

Get all items in a category
public static getAllForCategory ( integer $categoryId, integer $limit = null, mixed $excludeIds = null ) : array
$categoryId integer
$limit integer
$excludeIds mixed
return array
Beispiel #1
0
 /**
  * Load the data, don't forget to validate the incoming data
  */
 private function getData()
 {
     $categories = FrontendFaqModel::getCategories();
     $limit = $this->get('fork.settings')->get('Faq', 'overview_num_items_per_category', 10);
     foreach ($categories as $item) {
         $item['questions'] = FrontendFaqModel::getAllForCategory($item['id'], $limit);
         // no questions? next!
         if (empty($item['questions'])) {
             continue;
         }
         // add the category item including the questions
         $this->items[] = $item;
     }
 }
Beispiel #2
0
 /**
  * Load the data, don't forget to validate the incoming data
  */
 private function getData()
 {
     // validate incoming parameters
     if ($this->URL->getParameter(1) === null) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     // get by URL
     $this->record = FrontendFaqModel::getCategory($this->URL->getParameter(1));
     // anything found?
     if (empty($this->record)) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     $this->record['full_url'] = FrontendNavigation::getURLForBlock('Faq', 'Category') . '/' . $this->record['url'];
     $this->questions = FrontendFaqModel::getAllForCategory($this->record['id']);
 }
Beispiel #3
0
 /**
  * Parse
  */
 private function parse()
 {
     $this->tpl->assign('widgetFaqCategory', FrontendFaqModel::getCategoryById($this->data['id']));
     $this->tpl->assign('widgetFaqCategoryList', FrontendFaqModel::getAllForCategory($this->data['id'], $this->get('fork.settings')->get('Faq', 'most_read_num_items', 10)));
 }
Beispiel #4
0
 /**
  * Parse the data into the template
  */
 private function parse()
 {
     // add to breadcrumb
     if ($this->settings['allow_multiple_categories']) {
         $this->breadcrumb->addElement($this->record['category_title'], $this->record['category_full_url']);
     }
     $this->breadcrumb->addElement($this->record['question']);
     // set meta
     if ($this->settings['allow_multiple_categories']) {
         $this->header->setPageTitle($this->record['category_title']);
     }
     $this->header->setPageTitle($this->record['question']);
     // assign article
     $this->tpl->assign('item', $this->record);
     // assign items in the same category and related items
     $this->tpl->assign('inSameCategory', FrontendFaqModel::getAllForCategory($this->record['category_id'], $this->settings['related_num_items'], $this->record['id']));
     $this->tpl->assign('related', FrontendFaqModel::getRelated($this->record['id'], $this->settings['related_num_items']));
     // assign settings
     $this->tpl->assign('settings', $this->settings);
     // parse the form
     if (empty($this->status)) {
         $this->frm->parse($this->tpl);
     }
     // parse the form status
     if (!empty($this->status)) {
         $this->tpl->assign($this->status, true);
     }
 }