Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. public function editAction() {
  2.  
  3. $bugReportForm = new Form_BugReportForm();
  4. $bugReportForm->setAction('/bug/edit');
  5. $bugReportForm->setMethod('post');
  6. $this->recordId = $this->_request->getParam('id');
  7.  
  8. if ($this->getRequest()->isPost()) {
  9. if ($bugReportForm->isValid($_POST)) {
  10. $bugModel = new Model_Bug();
  11. // if the form is valid then update the bug
  12.  
  13. $result = $bugModel->updateBug(
  14. $this->recordId,
  15. $bugReportForm->getValue('author'),
  16. $bugReportForm->getValue('email'),
  17. $bugReportForm->getValue('date'),
  18. $bugReportForm->getValue('url'),
  19. $bugReportForm->getValue('description'),
  20. $bugReportForm->getValue('priority'),
  21. $bugReportForm->getValue('status')
  22. );
  23. return $this->_forward('list');
  24. }
  25. } else {
  26.  
  27. $id = $this->_request->getParam('id');
  28. $bug = $bugModel->find($id)->current();
  29. $bugReportForm->populate($bug->toArray());
  30. //format the date field
  31. $bugReportForm->getElement('date')->setValue(date('m-d-Y', $bug->date));
  32. }
  33. $this->view->form = $bugReportForm;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement