Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public function editAction()
  2.     {
  3.         $this->view->title = "Edit album";
  4.         $this->view->headTitle($this->view->title, 'PREPEND');
  5.  
  6.         $form = new Form_Album();
  7.         $form->submit->setLabel('Save');
  8.         $this->view->form = $form;
  9.  
  10. //......................................
  11. // Riesen test-1
  12. /*
  13.         if ($this->getRequest()->isPost() &&
  14.         $form->isValid($this->getRequest()->getPost())) {
  15.  
  16.             $values = $form->getValues();
  17.             Zend_Debug::dump($values);
  18.             exit;
  19.         }
  20. */
  21. //......................................
  22.  
  23.         if ($this->getRequest()->isPost()) {
  24.             $formData = $this->getRequest()->getPost();
  25.  
  26.             if ($form->isValid($formData)) {
  27.                 $id = (int)$form->getValue('id');
  28.                 $artist = $form->getValue('artist');
  29.                 $title = $form->getValue('title');
  30.                 $category = $form->getValue('category');
  31.                 $albums = new Model_DbTable_Albums2();
  32.                 $albums->updateAlbum($id, $artist, $title, $category);
  33.  
  34.                 $this->_redirect('/');
  35.             } else {
  36.                 $form->populate($formData);
  37.                 // Category test 2010
  38.                 //$category->setValue('4');
  39.             }
  40.         } else {
  41.             $id = $this->_request->getParam('id', 0);
  42.             if ($id > 0) {
  43.                 $albums = new Model_DbTable_Albums2();
  44.                 $form->populate($albums->getAlbum($id));
  45. // Customize category
  46.        //         $form->getElement('category')->setValue('category_id');
  47.             }
  48. //......................................
  49. // Riesen test-2
  50.         Zend_Debug::dump($albums->getAlbum($id)); exit();
  51. //......................................
  52.         }
  53.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement