Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. public function saveAction() {
  2. if ($this->getRequest()->isPost()) {
  3. $id = null;
  4. if ($this->getRequest()->getParam('id')) {
  5. $id = $this->getRequest()->getParam('id');
  6. }
  7. $reiseId = null;
  8. if ($this->getRequest()->getParam('id_reise')) {
  9. $reiseId = $this->getRequest()->getParam('id_reise');
  10. }
  11. if ($id != null) {
  12. $data = array(
  13. 'name' => $this->getRequest()->getParam('name'),
  14. 'beschreibung' => $this->getRequest()->getParam('beschreibung')
  15. );
  16. $where = $this->galerieTable->getAdapter()->quoteInto('id = ?', $id);
  17. $this->galerieTable->update($data);
  18. $this->_redirect('galerie/show/?id='.$id);
  19. } else {
  20. $data = array(
  21. 'name' => $this->getRequest()->getParam('name'),
  22. 'id_reise' => $reiseId,
  23. 'beschreibung' => $this->getRequest()->getParam('beschreibung'),
  24. 'dateCreate' => date('Y-m-d H:i:s', time())
  25. );
  26. $this->galerieTable->insert($data);
  27. $this->_redirect('reise/show/?id='.$reiseId);
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement