/** * display client message details * @param web request $request */ public function executeShowMessage($request) { $sf_user = $this->getuser(); $sf_guard_user = $sf_user->getGuardUser(); $sf_user_id = $sf_guard_user->getId(); $branch_id = $sf_user->getUserBranch()->getId(); $client_id = $request->getParameter('id'); $client_details = ProfilePeer::retrieveByPK($client_id); $message_id = $request->getParameter('message_id'); $update_comment = $request->getParameter('comment_update'); $comment_id = $request->getParameter('comment_id'); $message_details = MessagesPeer::retrieveByPK($message_id); $this->message_details = $message_details; $message_sender = $message_details->getSender(); $this->sender = ProfilePeer::getMessageSenderName($message_sender); $this->comments = CommentsPeer::getMessageAllComments($message_id); $this->form = new CommentsForm(); if ($comment_id) { $comment_details = CommentsPeer::retrieveByPK($comment_id); $this->form = new CommentsForm($comment_details); } if ($update_comment) { $update_status = new Messages(); $update_status->setMessageCommentsStatus($message_id, $sf_user_id); } if ($request->isMethod('post')) { $form_data = $request->getParameter('comments'); $form_data['sender'] = $sf_guard_user->getUsername(); $form_data['message_id'] = $message_id; $this->form->bind($form_data); if ($this->form->isValid()) { $comment = $this->form->save(); $comment_sender = $comment->getSender(); $this->updateMessageStatusOnComment($comment_sender, $message_id); $this->redirect('client/showMessage?id=' . $client_id . '&message_id=' . $message_id); } } $this->setTemplate('showMessage'); }