/** Publish a comment
  * @access public
  * @throws Exception
  * @throws Pas_Exception_Param
  * @return void
  */
 public function publishAction()
 {
     if ($this->getParam('id', false)) {
         $form = new PublishCommentFindForm();
         $form->submit->setLabel('Submit changes');
         $this->view->form = $form;
         if ($this->getRequest()->isPost()) {
             if ($form->isValid($this->_request->getPost())) {
                 $data = $form->getValues();
                 $to[] = array('name' => $form->getValue('comment_author'), 'email' => $form->getValue('comment_author_email'));
                 $where = $this->getComments()->getAdapter()->quoteInto('id = ?', $this->getParam('id'));
                 $this->getComments()->update($data, $where);
                 $this->_helper->mailer($form->getValues(), 'commentPublished', $to);
                 $this->getFlash()->addMessage('Comment data updated.');
                 $this->redirect('/admin/comments/');
             } else {
                 $this->getFlash()->addMessage('There is a problem with the form, please check and resubmit');
                 $form->populate($this->_request->getPost());
             }
         } else {
             // find id is expected in $params['id']
             $id = (int) $this->_request->getParam('id', 0);
             if ($id > 0) {
                 $comment = $this->getComments()->fetchRow($this->getComments()->select()->where('id = ?', $id))->toArray();
                 if ($comment) {
                     $form->populate($comment);
                 } else {
                     throw new Exception('No comment found with that ID');
                 }
             }
         }
     } else {
         throw new Pas_Exception_Param($this->_missingParameter, 500);
     }
 }
 /** Publish a comment
  * 
  */
 public function publishAction()
 {
     if ($this->_getParam('id', false)) {
         $form = new PublishCommentFindForm();
         $form->submit->setLabel('Submit changes');
         $this->view->form = $form;
         if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) {
             if ($form->isValid($form->getValues())) {
                 $data = $form->getValues();
                 $data['comment_type'] = 'recordcomment';
                 $where = $this->_comments->getAdapter()->quoteInto('comment_ID = ?', $this->_getParam('id'));
                 $update = $this->_comments->update($data, $where);
                 $approvalstatus = $form->getValue('approval');
                 switch ($form->getValue('comment_approval')) {
                     case 'approved':
                         $finds = new Finds();
                         $find = $finds->getCreator($form->getValue('comment_findID'));
                         break;
                 }
                 $this->_flashMessenger->addMessage('Comment data updated.');
                 $this->_redirect('/admin/comments/');
             } else {
                 $this->_flashMessenger->addMessage('There is a problem with the form, please check and resubmit');
                 $form->populate($formData);
             }
         } else {
             // find id is expected in $params['id']
             $id = (int) $this->_request->getParam('id', 0);
             if ($id > 0) {
                 $comment = $this->_comments->fetchRow('comment_ID =' . $id)->toArray();
                 if ($comment) {
                     $form->populate($comment);
                 } else {
                     throw new Exception('No comment found with that ID');
                 }
             }
         }
     } else {
         throw new Pas_Exception_Param($this->_missingParameter);
     }
 }