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