/** Enter an error report
  * @access public
  * @return void
  */
 public function errorAction()
 {
     if ($this->getParam('id', false)) {
         $form = new CommentOnErrorFindForm();
         $form->submit->setLabel('Submit your error report');
         $finds = $this->getHoards()->fetchRow($this->getHoards()->select()->where('id = ?', $this->getParam('id')))->toArray();
         $this->view->finds = $finds;
         $this->view->form = $form;
         if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) {
             $data = $form->getValues();
             if ($this->_helper->akismet($data)) {
                 $data['comment_approved'] = 'spam';
             } else {
                 $data['comment_approved'] = 1;
             }
             $errors = new ErrorReports();
             $errors->add($data);
             $data = array_merge($finds, $data);
             $this->notify($finds['institution'], $finds['createdBy'], $data);
             $this->getFlash()->addMessage('Your error report has been submitted. Thank you!');
             $this->redirect(self::REDIRECT . 'record/id/' . $this->getParam('id'));
         } else {
             $form->populate($this->_request->getPost());
         }
     } else {
         throw new Pas_Exception_Param($this->_missingParameter, 500);
     }
 }
 /** Enter an error report
  * @access public
  * @return void
  * @todo move insert logic to model
  */
 public function errorreportAction()
 {
     if ($this->getParam('id', false)) {
         $form = new CommentOnErrorFindForm();
         $form->submit->setLabel('Submit your error report');
         $finds = $this->getFinds()->getRelevantAdviserFind($this->getParam('id', 0));
         $this->view->form = $form;
         $this->view->finds = $finds;
         if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) {
             $data = $form->getValues();
             if ($this->_helper->akismet($data)) {
                 $data['comment_approved'] = 'spam';
             } else {
                 $data['comment_approved'] = 1;
             }
             if (array_key_exists('captcha', $data)) {
                 unset($data['captcha']);
             }
             $errors = new ErrorReports();
             $errors->add($data);
             $data = array_merge($finds['0'], $data);
             $this->notify($finds['0']['objecttype'], $finds['0']['broadperiod'], $finds['0']['institution'], $finds['0']['createdBy'], $data);
             $this->getFlash()->addMessage('Your error report has been submitted. Thank you!');
             $this->redirect(self::REDIRECT . 'record/id/' . $this->getParam('id'));
         } else {
             $form->populate($this->_request->getPost());
         }
     } else {
         throw new Pas_Exception_Param($this->_missingParameter, 500);
     }
 }
 /** Enter an error report
  * @todo move insert logic to model
  */
 public function errorreportAction()
 {
     if ($this->_getParam('id', false)) {
         $form = new CommentOnErrorFindForm();
         $form->submit->setLabel('Submit your error report');
         $finds = $this->_finds->getRelevantAdviserFind($this->_getParam('id', 0));
         $this->view->form = $form;
         $this->view->finds = $finds;
         if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) {
             if ($form->isValid($form->getValues())) {
                 $data = $form->getValues();
                 if ($this->_helper->getAkismet->isSpam($data)) {
                     $data['comment_approved'] = 'spam';
                 } else {
                     $data['comment_approved'] = '1';
                 }
                 $errors = new ErrorReports();
                 $mail = $this->notify($finds['0']['objecttype'], $finds['0']['broadperiod'], $data);
                 $insert = $errors->addReport($data);
                 $this->_flashMessenger->addMessage('Your error report has been submitted. Thank you!');
                 $this->_redirect(self::REDIRECT . 'record/id/' . $this->_getParam('id'));
             } else {
                 $form->populate($formData);
             }
         }
     } else {
         throw new Pas_Exception_Param($this->_missingParameter);
     }
 }