コード例 #1
0
 public function actionEdit($id)
 {
     $contactWebForm = static::getModelAndCatchNotFoundAndDisplayError('ContactWebForm', intval($id));
     ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($contactWebForm);
     $modelClassName = $this->getModule()->getPrimaryModelName();
     $breadCrumbTitle = Zurmo::t('ContactWebFormsModule', 'Edit Web Form');
     $breadCrumbLinks = array($breadCrumbTitle);
     $contactWebForm->defaultPermissionSetting = ContactWebFormAdapter::resolveAndGetDefaultPermissionSetting($contactWebForm);
     if ($contactWebForm->language === null) {
         $contactWebForm->language = Yii::app()->language;
     }
     if (isset($_POST[$modelClassName])) {
         unset($_POST[$modelClassName]['serializedData']);
         foreach ($_POST['ContactWebFormAttributeForm'] as $attributeName => $attributeData) {
             if (isset($attributeData['hiddenValue']) && !empty($attributeData['hiddenValue'])) {
                 $_POST['ContactWebFormAttributeForm'][$attributeName]['hiddenValue'] = ContactWebFormsUtil::sanitizeHiddenAttributeValue($attributeName, $attributeData['hiddenValue']);
             }
         }
         $contactWebForm->serializedData = serialize($_POST['ContactWebFormAttributeForm']);
         if (isset($_POST[$modelClassName]['defaultPermissionGroupSetting'])) {
             $contactWebForm = ContactWebFormAdapter::setDefaultPermissionGroupSetting($contactWebForm, (int) $_POST[$modelClassName]['defaultPermissionSetting'], (int) $_POST[$modelClassName]['defaultPermissionGroupSetting']);
             unset($_POST[$modelClassName]['defaultPermissionGroupSetting']);
         }
     }
     $titleBarAndEditView = $this->makeEditAndDetailsView($this->attemptToSaveModelFromPost($contactWebForm), 'Edit');
     $view = new ContactWebFormsPageView(ZurmoDefaultAdminViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $titleBarAndEditView, $breadCrumbLinks, 'ContactWebFormsBreadCrumbView'));
     echo $view->render();
 }