/** Articles */ public function _default() { $news = new ArticleEntityRepository(); $category = new ArticleCategoryEntityRepository(); echo BreadCrumbs::getInstance()->addCrumb(__('Articles')); echo Columns::getInstance()->add('<a class="btn btn-success" href="?p=' . P . '&do=add">' . __('Add Article') . '</a><br><br>', ['align' => 'right']); echo CmsTable::getInstance()->addData($news)->addColumn(ColumnImg::getInstance()->imgHeight(130)->href('?p=' . P . '&do=edit&id={%id%}'))->addColumn(ColumnData::getInstance('title')->enableTranslationColumn())->addColumn(ColumnData::getInstance('category_id')->setPairedDataOptionsForKeys($category->getPairs('title')))->addColumn(ColumnEdit::getInstance('edit'))->addColumn(ColumnActive::getInstance('active'))->addColumn(ColumnDelete::getInstance('delete')); }
public function _default() { $breadcrumbs = BreadCrumbs::getInstance()->addCrumb(ucfirst(P))->addCrumb('All Reviews'); $reviews = new ReviewEntityRepository(); $reviews->addSimpleSelectFields(['id', 'title', 'active', 'image']); $reviews->addSimpleSelectFieldsAsString('"0" as `images`'); $reviews->addOrderByField('id'); $images = new ImageRepository(); $images->addSimpleSelectFieldsAsString('(SELECT COUNT(*) FROM `' . $images->getDbTableName() . '` WHERE `item_id` = `' . $reviews->getDbTableName() . '`.`id` AND `item_type` = "review") AS `images`'); $reviews->mergeWithCollection($images, 'id', 'item_id', 'left'); $table = CmsTable::getInstance()->addData($reviews)->addColumn(ColumnImg::getInstance('image')->imgHeight('100'))->addColumn(ColumnEdit::getInstance('title')->enableOrderableColumn()->enableTranslationColumn()->setHref('?p=' . P . '&do=edit&id={%id%}'))->addColumn(ColumnData::getInstance('images')->enableOrderableColumn()->setWidth('1%')->enableRightAlign()->setHref('?p=' . P . '&do=images&id={%id%}'))->addColumn(ColumnActive::getInstance('active')->setHref('?p=' . P . '&do=_active&id={%id%}')->enableOrderableColumn()->enableAjax())->addColumn(ColumnDelete::getInstance('delete')->setHref('?p=' . P . '&do=_delete&id={%id%}')); echo Columns::getInstance()->add($breadcrumbs)->add('<a class="btn btn-success" href="?p=' . P . '&do=add">Add Review</a>', ['align' => 'right']); echo $table; }