public function actionConfigurationEdit() { $breadCrumbLinks = array(Zurmo::t('MarketingModule', 'Marketing Configuration')); $form = MarketingConfigurationFormAdapter::makeFormFromMarketingConfiguration(); $postData = PostUtil::getData(); $postVariableName = get_class($form); if (isset($postData[$postVariableName])) { $form->setAttributes($postData[$postVariableName]); if ($form->validate()) { MarketingConfigurationFormAdapter::setConfigurationFromForm($form); Yii::app()->user->setFlash('notification', Zurmo::t('ZurmoModule', 'Marketing configuration saved successfully.')); $this->redirect(Yii::app()->createUrl('configuration/default/index')); } } $editView = new MarketingConfigurationEditAndDetailsView('Edit', $this->getId(), $this->getModule()->getId(), $form); $editView->setCssClasses(array('AdministrativeArea')); $view = new ZurmoConfigurationPageView(ZurmoDefaultAdminViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $editView, $breadCrumbLinks, 'SettingsBreadCrumbView')); echo $view->render(); }
public function testMakeFormAndSetConfigurationFromForm() { $form = MarketingConfigurationFormAdapter::makeFormFromMarketingConfiguration(); $this->assertEquals(GlobalMarketingFooterUtil::getContentByType(false), $form->autoresponderOrCampaignFooterPlainText); $this->assertEquals(GlobalMarketingFooterUtil::getContentByType(true), $form->autoresponderOrCampaignFooterRichText); //User is not root so he cant change batch size $form->autoresponderOrCampaignFooterPlainText = 'abc'; $form->autoresponderOrCampaignFooterRichText = 'def'; MarketingConfigurationFormAdapter::setConfigurationFromForm($form); $form = MarketingConfigurationFormAdapter::makeFormFromMarketingConfiguration(); $this->assertEquals('abc', $form->autoresponderOrCampaignFooterPlainText); $this->assertEquals('def', $form->autoresponderOrCampaignFooterRichText); //User is root so he can change batch size $super = User::getByUsername('super'); $super->setIsRootUser(); Yii::app()->user->userModel = $super; $form->autoresponderOrCampaignFooterPlainText = 'cba'; $form->autoresponderOrCampaignFooterRichText = 'fed'; MarketingConfigurationFormAdapter::setConfigurationFromForm($form); $form = MarketingConfigurationFormAdapter::makeFormFromMarketingConfiguration(); $this->assertEquals('cba', $form->autoresponderOrCampaignFooterPlainText); $this->assertEquals('fed', $form->autoresponderOrCampaignFooterRichText); }