public function indexAction()
 {
     $form = new Admin_Form_Configuration();
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         $form->populate($data);
         $result = $form->processPost($data, $data);
         switch ($result) {
             case Admin_Form_Configuration::RESULT_SAVE:
                 if ($form->isValid($data)) {
                     $config = new Zend_Config(array(), true);
                     $form->updateModel($config);
                     Application_Configuration::save($config);
                 } else {
                     break;
                 }
             case Admin_Form_Configuration::RESULT_CANCEL:
                 $this->_redirectTo('setup', null, 'index', 'admin');
                 break;
             default:
                 break;
         }
     } else {
         $form->populateFromModel($this->getConfig());
     }
     $this->_helper->viewRenderer->setNoRender(true);
     echo $form;
 }
Example #2
0
 public function testValidationFailure()
 {
     $form = new Admin_Form_Configuration();
     $this->assertFalse($form->isValid(array('supportedLanguages' => array('ru'))));
 }