Exemple #1
0
 /** Faqs */
 public static function _default()
 {
     echo Columns::getInstance()->add('<a class="btn btn-success" href="?p=' . P . '&do=add">Add new Faq</a>', ['align' => 'right']);
     echo '<br>';
     $faqs = new FaqEntityRepository();
     $faqs->addOrderByField('id');
     $categories = new FaqCategoryEntityRepository();
     echo CmsTable::getInstance()->addData($faqs)->addColumn(ColumnEdit::getInstance('title')->setHref('?p=' . P . '&do=edit&id={%id%}')->enableOrderableColumn()->enableTranslationColumn())->addColumn(ColumnData::getInstance('category_id')->enableOrderableColumn()->setPairedDataOptionsForKeys($categories->getPairs('title'))->setTitle('Category'))->addColumn(ColumnDelete::getInstance()->setHref('?p=' . P . '&do=_delete&id={%id%}'));
 }
 /**
  * @param int $category_id
  * @return array
  */
 public static function getFaqByCategoryId($category_id)
 {
     $faqs = new FaqEntityRepository();
     $faqs->setWhereCategoryId($category_id);
     return $faqs->getAsArrayOfObjects();
 }