Пример #1
0
 private function handleForm(Zend_Form $p_form, Comment $p_comment)
 {
     if ($this->getRequest()->isPost() && $p_form->isValid($_POST)) {
         $values = $p_form->getValues();
         $values['ip'] = $this->getRequest()->getClientIp();
         $values['status'] = 'hidden';
         $values['time_created'] = new DateTime();
         $this->commentRepository->save($p_comment, $values);
         $this->commentRepository->flush();
         $this->_helper->flashMessenger(getGS('Comment "$1" saved.', $p_comment->getSubject()));
         $this->_helper->redirector->gotoSimple('index');
     }
 }
Пример #2
0
 private function handleForm(Zend_Form $p_form, Comment $p_comment)
 {
     $translator = \Zend_Registry::get('container')->getService('translator');
     if ($this->getRequest()->isPost() && $p_form->isValid($_POST)) {
         $values = $p_form->getValues();
         $values['ip'] = $this->getRequest()->getClientIp();
         $values['status'] = 'hidden';
         $values['time_created'] = new DateTime();
         $this->commentRepository->save($p_comment, $values);
         $this->commentRepository->flush();
         $this->_helper->flashMessenger($translator->trans('Comment $1 saved.', array('$1' => $p_comment->getSubject()), 'comments'));
         $this->_helper->redirector->gotoSimple('index');
     }
 }