/** * Редактирование материала * * @return void */ public function editAction() { $this->view->assign('Header', $this->_translate->_('Редактировать ' . $this->ModuleInfo['singlename'])); if ($this->Resource->isAllowedAction('edit', $this->ResourceInfo['categories'], $this->ResourceInfo['creator'])) { $form = $this->Resource->getResourceForm('edit'); $form->setDefaults($this->ResourceInfo); if ($this->_request->isPost() && $form->isValid($this->_request->getPost())) { if ($this->Resource->saveResourceForm($form, $this->ResourceInfo['resourceid'])) { 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('Недостаточно прав для внесения изменений'); } }