/** * Создание материала * * @return void */ public function addAction() { $this->view->assign('Header', $this->_translate->_('Создать ' . $this->ModuleInfo['singlename'])); if ($this->Resource->isAllowedAction('add')) { $form = $this->Resource->getResourceForm('add'); $form->setDefaults($this->Resource->getHumanValues()); if ($this->_request->isPost() && $form->isValid($this->_request->getPost())) { if ($this->Resource->saveResourceForm($form)) { if (isset($this->_params['categoryid'])) { $redirect = '/control/categories/index/categoryid/' . $this->_params['categoryid'] . '/'; } else { $redirect = '/control/resource/index/moduleid/' . $this->Resource->getModuleid() . '/'; } return $this->composeSuccessMessage('Материал сохранен', $redirect); } else { $this->composeTransactionErrorMessage($this->Resource->_errors); } } $this->view->assign('Form', $form); } else { return $this->composeErrorMessage('Недостаточно прав для создания материала'); } }