Advertisement
Guest User

Untitled

a guest
Aug 15th, 2011
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.78 KB | None | 0 0
  1. <?php
  2. class GuestbookController extends Zend_Controller_Action
  3. {
  4.     public function indexAction()
  5.     {
  6.         $guestbook = new Application_Model_GuestbookMapper();
  7.         $this->view->entries = $guestbook->fetchAll();
  8.     }
  9.     public function signAction()
  10.     {
  11.         $request = $this->getRequest();
  12.         $form    = new Application_Form_Guestbook();
  13.  
  14.         if ($this->getRequest()->isPost()) {
  15.             if ($form->isValid($request->getPost())) {
  16.                 $comment = new Application_Model_Guestbook($form->getValues());
  17.                 $mapper  = new Application_Model_GuestbookMapper();
  18.                 $mapper->save($comment);
  19.                 return $this->_helper->redirector('index');
  20.             }
  21.         }
  22.         $this->view->form = $form;
  23.     }
  24. }
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement