public function handleAddNewAjaxSection($name = '', $underSection = '', $underSubSection = '') { if (!$name || !$underSection || !$underSubSection) { throw new Nette\Application\BadRequestException(); } if (!$this->user->isAllowed('Section', 'moderate')) { throw new \Nette\Application\ForbiddenRequestException(); } $form = $this->presenter->action; $id = $this->articleManager->addSerial(ArrayHash::from(['name' => $name, 'underSection' => $underSection, 'underSubSection' => $underSubSection, 'byUser' => $this->user->id, 'articleId' => $this->updateId])); if ($this->user->isAllowed(self::RES, 'moderate')) { $items = $this->articleManager->getSerialList($underSubSection); } else { $items = $this->articleManager->getSerialList($underSubSection, $this->user->getId()); } $this[$form]['underSerial']->setItems($items + [0 => 'Žádná'])->setValue($id); $this->redrawAjax(['underSerialSnippet', 'jsUpdate']); }