Beispiel #1
0
 /**
  * Редактирование свойства
  * 
  * @return void
  */
 public function editpropertyAction()
 {
     if (isset($this->_params['propertyid']) && ($PropertyInfo = $this->Structures->getPropertyInfo($this->_params['propertyid']))) {
         // Получаем оригинальную форму
         $form = $this->Structures->getPropertyForm('editproperty');
         $form->setDefaults($PropertyInfo);
         if ($this->_request->isPost()) {
             // Модифицируем форму на основе POST-данных
             $form = $this->Structures->getPropertyFormModified($this->_request->getPost(), $form);
             if ($form->isValid($this->_request->getPost())) {
                 if ($FormData = $this->Structures->savePropertyForm($form, $PropertyInfo['propertyid'])) {
                     return $this->composeSuccessMessage('Изменения внесены', '/control/structures/properties/');
                 } else {
                     $this->composeTransactionErrorMessage($this->Structures->_errors);
                 }
             }
             // Возвращаем модификации формы обратно
             $form = $this->Structures->getPropertyFormOriginal($form);
         } else {
             // Модифицируем форму на основе информации о свойстве
             $form = $this->Structures->getPropertyFormModified($PropertyInfo, $form);
         }
         $this->view->assign('Form', $form);
     } else {
         return $this->composeErrorMessage('Свойство с указанным Id не найдено');
     }
 }