Ejemplo n.º 1
0
 /**
  * Редактирование формы
  * 
  * @return void
  */
 public function editAction()
 {
     if (isset($this->_params['resourceid']) && ($FormInfo = $this->Forms->getFullFormInfo($this->_params['resourceid']))) {
         if ($this->Forms->isAllowedAction('edit', $FormInfo['categories'], $FormInfo['creator'])) {
             $form = $this->Forms->getResourceForm('edit');
             $form->setDefaults($FormInfo);
             if ($this->_request->isPost() && $form->isValid($this->_request->getPost())) {
                 if ($this->Forms->saveResourceForm($form, $FormInfo['resourceid'], '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('Недостаточно прав для внесения изменений');
         }
     } else {
         return $this->composeErrorMessage('Форма с указанным Id не найдена');
     }
 }