rik89

Untitled

Apr 18th, 2012
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.03 KB | None | 0 0
  1. public function indexAction()
  2.     {
  3.        $this->authoriseUser();
  4.         //get id param from index.phtml (view)
  5.        $id = $this->getRequest()->getParam('club_id');
  6.        //get model and query by $id
  7.        $clubs = new Application_Model_DbTable_Clubs();
  8.        $clubs = $clubs->getClub($id);
  9.        //assign data from model to view [EDIT](display.phtml)
  10.        $this->view->clubs = $clubs;
  11.     }
  12.    
  13.     public function addAction() {
  14.         //action for the comments submission
  15.         $form = new Application_Form_Comment();
  16.         $form->submit->setLabel('Comment');
  17.         $this->view->form = $form;
  18.         if ($this->getRequest()->isPost()) {
  19.             $formData = $this->getRequest()->getPost();
  20.             if ($form->isValid($formData)) {
  21.             $comment = new Application_Model_DbTable_Comments();
  22.             $comment->addComment($formData['comment'], $id);
  23.                 $this->_helper->redirector('index');
  24.             } else {
  25.                 $form->populate($formData);
  26.             }
  27.         }
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment