Ejemplo n.º 1
0
 function createAction()
 {
     $this->view->title = 'Create New Album';
     $form = new AlbumForm(array('legend' => $this->view->title));
     $form->submit->setLabel('Create');
     $this->view->form = $form;
     if ($this->_request->isPost()) {
         $form_data = $this->_request->getPost();
         if ($form->isValid($form_data)) {
             $albums = new Albums();
             $row = $albums->createRow();
             $row->title = $form->getValue('title');
             $row->description = $form->getValue('description');
             $row->save();
             $this->_redirect('/album/list');
         } else {
             $form->populate($form_data);
         }
     }
     $this->_helper->viewRenderer('form');
 }