/** casepost编辑提交 */ public function postUpdatePost($request, $response) { $postClient = PostClient::getInstance(); $post = DAL::get()->find('post', (int)$request->postid); if ($this->_refuseNotIsUserCase($response, $post->thread)){ return false; } $data = array(); if($post->isSpaceReply()) { $content = $request->getUnSafeData('post_content'); } else { $content = $request->post_content; } $data['content'] = $content; $data['attachmentIds'] = $request->getRequest('post_patient_attachment_ids', ''); if (strlen($content) < 1){ $this->message('回复的内容太短!',$response); return false; } $postClient->update($post->user, $post->id, $data); $this->message('回复内容修改成功', $response, array( 'buttons' => array( array('text' => '返回问题', 'url' => $post->thread->getUrl()) ), )); }
public function updateCasePost($caseId, $userId, $postId, $type, $content, $attachmentIds) {/*{{{*/ $user = DAL::get()->find('user', $userId); if ($user->isNull()) { $this->setErrorCode(107); return 0; } // $thread = DAL::get()->find('doctorPatientRef', $caseId); $thread = $this->getTheRightThread($caseId); if($thread instanceof Intention || $thread instanceof Proposal) { $this->setErrorCode(142); return 0; } if($thread->isNull()) { $this->setErrorCode(142); return 0; } if(self::TYPE_FLOW == $type) { $post = DAL::get()->find('doctorPatientPost', $postId); } $canEdit = $this->isCanEdit($userId, $post, $thread); if(false == $canEdit) { $this->setErrorCode(311); return 0; } // $attachmentIds = ($attachmentIds != null) ? $request->attachmentIds : ''; if($attachmentIds) { $attachmentIds = $attachmentIds; } else { $attachmentIds = ''; } $attachmentArr = array(); if($attachmentIds) { $attachmentArr = explode(',', $attachmentIds); } if(($content == '') && $attachmentIds <> '') { $content = '有新资料上传'; } $post = new NullEntity(); if(self::TYPE_POST == $type || 'post' == $type) { $postId = PostClient::getInstance()->update($user, $postId, array('content'=>$content, 'attachmentIds'=>$attachmentIds)); $post = DAL::get()->find('post', $postId); } else if(self::TYPE_FLOW == $type || 'doctorpatientpost' == $type) { $post = DoctorPatientPostClient::getInstance()->updateDoctorPatientPost($postId, array('content'=>$content, 'attachmentIds'=>$attachmentArr)); } if($post->isNull()) { $this->setErrorCode(206); return 0; } $this->content = array('caseId' => $caseId, 'userId' => $userId); }/*}}}*/
/** 删除casepost */ public function postDeletePost($request, $response) { $postId = (int)$request->poseid; $userId = $this->_newSpace->user->id; $user = DAL::get()->find('user', $userId); $post = DAL::get()->find('post', $postId); $thread = $post->thread; PostClient::getInstance()->delete($user, $postId); $this->message('咨询对话已经被删除了', $response, array( 'buttons' => array( array('text' => '返回问题', 'url' => $thread->getUrl()) ), )); }
public function updatePost($request, $response) {/*{{{*/ $ref = DAL::get()->find('DoctorPatientRef', $request->refid); $editPostType = $request->editposttype; if('Post' == $editPostType) { $editPost = DAL::get()->find('Post', $request->editpostid); } else { $editPost = DAL::get()->find('DoctorPatientPost', $request->editpostid); } $relateEntity = $ref; if($ref->isNull() || in_array($this->_newUser->id, array($ref->user->id, $ref->space->user->id)) == false) { header('Location: '.$this->_newSpace->url); return; } // 如果还有继续能回复post的就打开post回复开关 if ($ref->isClosePost()) { DoctorPatientPostClient::getInstance()->switchPatientPostCan($this->_newUser->id, $ref->id); } $option = array(); $attachmentIds = ($request->attachmentIds != null) ? $request->attachmentIds : ''; $attachmentArr = explode(',', $attachmentIds); $option['attachmentIds'] = $attachmentArr; if($ref->space->user->id == $this->_newUser->id) { $content = $ref->space->name."大夫和您有新对话<a href='".$ref->url."' target='_blank'>点击查看详情</a>"; $title = $ref->space->name."大夫和您有新对话"; StationLetterClient::getInstance()->sendMsg(Message::AdminUserId, $ref->user->id, $title, $content); } if($editPost->isSpaceReply()) { $postContent = $request->getUnSafeData('content'); } else { $postContent = $request->content; } if(($postContent == '点击此处跟大夫对话!' || $postContent == '') && $attachmentIds <> '') { $postContent = '有新资料上传'; } $post = new NullEntity(); if('Post' == $editPostType) { $post = PostClient::getInstance()->update4Flow($this->_newUser, $request->editpostid, array('content'=>$postContent, 'attachmentIds'=>$attachmentArr)); } else { $post = DoctorPatientPostClient::getInstance()->updateDoctorPatientPost($editPost->id, array('content'=>$postContent, 'attachmentIds'=>$attachmentArr)); } if(false == $post->isNull() && $ref->user->id == $this->_newUser->id) { //管理员给患者的提示信息失效 PatientSigninClient::getInstance()->disablePatientNotice($ref->id); } DBC::requireFalse($post->isNull(), '系统繁忙,请稍后重试'); $response->setRedirect($ref->url."#reply"); }/*}}}*/
public function deletePost($request, $response) { /*{{{*/ $post = DAL::get()->find('post', $request->postid); DBC::requireFalse($post->isNull(), "咨询对话不存在"); PostClient::getInstance()->delete($post->user, $post->thread->id, $post->id); //删除回复 扣回积分 ScoreClient::getInstance()->doctorDeletePost($post->id); $this->message('咨询对话已经被删除了', $response, array('text' => '返回问题', 'url' => $post->thread->getUrl())); }