Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function editAction()
- {
- $this->view->title = "Edit album";
- $this->view->headTitle($this->view->title, 'PREPEND');
- $form = new Form_Album();
- $form->submit->setLabel('Save');
- $this->view->form = $form;
- //......................................
- // Riesen test-1
- /*
- if ($this->getRequest()->isPost() &&
- $form->isValid($this->getRequest()->getPost())) {
- $values = $form->getValues();
- Zend_Debug::dump($values);
- exit;
- }
- */
- //......................................
- if ($this->getRequest()->isPost()) {
- $formData = $this->getRequest()->getPost();
- if ($form->isValid($formData)) {
- $id = (int)$form->getValue('id');
- $artist = $form->getValue('artist');
- $title = $form->getValue('title');
- $category = $form->getValue('category');
- $albums = new Model_DbTable_Albums2();
- $albums->updateAlbum($id, $artist, $title, $category);
- $this->_redirect('/');
- } else {
- $form->populate($formData);
- // Category test 2010
- //$category->setValue('4');
- }
- } else {
- $id = $this->_request->getParam('id', 0);
- if ($id > 0) {
- $albums = new Model_DbTable_Albums2();
- $form->populate($albums->getAlbum($id));
- // Customize category
- // $form->getElement('category')->setValue('category_id');
- }
- //......................................
- // Riesen test-2
- Zend_Debug::dump($albums->getAlbum($id)); exit();
- //......................................
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement