public function ajaxaddAction() { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); $mtrId = $this->_getParam('mtrId',0); $cmt = $this->_getParam('comment',0); if($mtrId != null) { $userId = $this->getUserId(); $users = new System_Models_UserMapper(); $contactId = $users->getContactId($userId); $comments = new Pment_Models_CommentMapper(); $comment = new Pment_Models_Comment(); $comment->setMtrId($mtrId); $comment->setComment($cmt); $comment->setContactId($contactId); $comment->setAddDate(date('Y-m-d,H:i')); $id = $comments->save($comment); $contacts = new Employee_Models_ContactMapper(); $contactName = $contacts->findContactName($contactId); $json['addDate'] = $comment->getAddDate(); $json['contactId'] = $comment->getContactId(); $json['contactName'] = $contactName; $json['cId'] = $id; $json = Zend_Json::encode($json); echo $json; } else { $this->_redirect('/pment/mplan'); } }