Exemplo n.º 1
0
 public function addAction()
 {
     $formGaleria = new Galerias_Form_Galeria();
     $formGaleria->setAction($this->view->url(array(), 'addGaleria'));
     if ($this->getRequest()->isPost()) {
         $formData = $this->_request->getPost();
         if (!$formGaleria->isValid($formData)) {
             $this->view->formGaleria = $formGaleria;
             $formGaleria->populate($formData);
             return $this->render('form');
         } else {
             $galeria = new Galeria();
             $galeria->fromArray($formGaleria->getValues(true));
             $galeria->nuevo();
             $this->_flashMessenger->addSuccess('Galeria Agregado');
             $this->_redirect('/backend/galerias');
         }
     }
     $this->view->formGaleria = $formGaleria;
     $this->render('form');
 }