public function getCommentModes() { return CommentMode::getOptions(); }
public function createComponentForumThreadsGrid($name) { $commentModes = [null => null] + CommentMode::getOptions(); $users = [null => null] + $this->getSelectUsers(); $forums = [null => null] + (array) $this->getSelectForums(); $grid = new Grid($this, $name); $grid->setModel($this->forumService->getForumThreadsDataSource()); $grid->setTranslator($this->getTranslator()); $grid->setPrimaryKey("id"); $grid->addColumnNumber("id", "#")->cellPrototype->class[] = "center"; $headerId = $grid->getColumn("id")->headerPrototype; $headerId->class[] = "center"; $headerId->rowspan = "2"; $headerId->style["width"] = '0.1%'; $grid->addColumnText('title', "communicationModule.admin.grid.title")->setTruncate(20)->setSortable()->setFilterText(); $headerTitle = $grid->getColumn('title')->headerPrototype; $headerTitle->class[] = 'center'; $grid->addColumnText('forum', "communicationModule.admin.grid.forum")->setSortable()->setFilterSelect($forums); $headerPar = $grid->getColumn('forum')->headerPrototype; $headerPar->class[] = 'center'; $grid->addColumnText('commentMode', "communicationModule.admin.grid.comments")->setCustomRender($this->commentModeRender)->setSortable()->setFilterSelect($commentModes); $headerStatus = $grid->getColumn('commentMode')->headerPrototype; $headerStatus->class[] = 'center'; $grid->addColumnText('author', "communicationModule.admin.grid.author")->setSortable()->setFilterSelect($users); $headerAuthor = $grid->getColumn('author')->headerPrototype; $headerAuthor->class[] = 'center'; $grid->addActionHref('delete', '', 'deleteForumThread!')->setIcon('trash')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("communicationModule.admin.grid.delete")]))->setConfirm(function ($u) { return $this->tt("communicationModule.admin.grid.messages.rlyDelForumThr", null, ["id" => $u->getId()]); }); $grid->addActionHref('edit', '', 'updateForumThread')->setIcon('pencil')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("communicationModule.admin.grid.update")])); $grid->setOperation(["delete" => "communicationModule.admin.grid.delete"], $this->forumGridOpsHandler)->setConfirm("delete", "communicationModule.admin.grid.messages.rlyDelForumThrItems"); $grid->setFilterRenderType($this->filterRenderType); $grid->setExport("admin-forum" . date("Y-m-d H:i:s", time())); return $grid; }
public function spCommModeRender($e) { return $this->tt(CommentMode::getOptions()[$e->getCommentMode()]); }
private function getCommentModes() { return CommentMode::getOptions(); }