/** Reply to a stored message * @access public * @return void */ public function replyAction() { if ($this->getParam('id', false)) { $form = new MessageReplyForm(); $form->submit->setLabel('Send reply'); $this->view->form = $form; if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) { if ($form->isValid($form->getValues())) { $reply = array(); $reply['messagetext'] = $form->getValue('messagetext'); $reply['messageID'] = $this->getParam('id'); $data['replied'] = 1; $where = $this->_messages->getAdapter()->quoteInto('id= ?', $this->getParam('id')); $update = $this->_messages->update($data, $where); $this->_replies->add($reply); $contact = array(array('email' => $form->getValue('comment_author_email'), 'name' => $form->getValue('comment_author'))); $this->_helper->mailer($form->getValues(), 'messageResponse', $contact, $contact); $this->getFlash()->addMessage('Message replied to.'); $this->redirect('/admin/messages/'); } else { $this->getFlash()->addMessage('There is a problem with ' . 'the form, please check and resubmit'); $form->populate($form->getValues()); } } else { // find id is expected in $params['id'] $id = (int) $this->_request->getParam('id', 0); if ($id > 0) { $message = $this->_messages->fetchRow('id =' . $id); if ($message) { $form->populate($message->toArray()); } else { throw new Pas_Exception_Param($this->_nothingFound); } } } } else { throw new Pas_Exception_Param($this->_missingParameter, 500); } }