public function addReTopic($request, $response)
 {
     /*{{{*/
     $groupIds = $request->getRequest('groupIds', array());
     $groupList = DAL::get()->find('regroup', $groupIds);
     $article = DAL::get()->find('article', $request->articleId);
     if (false == $article->isNull()) {
         if (false == empty($groupIds) && false === array_search('refused', $groupIds)) {
             foreach ($groupList as $group) {
                 if (false == $group->isNull()) {
                     $reBoard = DAL::get()->find('reboard', $group->reboardId);
                     if ($reBoard->isNull()) {
                         continue;
                     }
                     $content = htmlspecialchars_decode(Seolink::directOutPut($article->content));
                     if (strpos($this->space->extraOptions, 'ArticleEmbeddedLink=0') === FALSE) {
                         $content = preg_replace('/^(.{300}.*?)\\<(br|\\/p|\\/div|\\/center)/is', '\\1' . $this->space->getFullUrl() . '<\\2', $content);
                     }
                     $content = preg_replace("/<\\/?a[^>]*>/i", "", $content);
                     $content = $content . "\n\n<span style='color:#007BC1'>希望此文对大家有帮助,欢迎大家在这里跟帖讨论,发表自己的心得与感想。祝大家早日康复!</span>";
                     ResidentEvilClient::getInstance()->createTopic($group->space, $reBoard, $group->space->user, $article->title, $content, $article->id);
                 }
             }
         } else {
             ArticleClient::getInstance()->modifyArticle($article->id, array('reproduce' => Article::REPRODUCE_REFUSED));
         }
     }
     $response->setRedirect($response->router->urlfor('adminarticle/newpostcomplete', array('id' => $article->id)));
 }
 /** 发表话题**/
 public function postTopic($request, $response)
 {
     /*{{{*/
     $groupIds = array($request->defaultid);
     if ($request->groupIds) {
         $groupIds = array_diff(array_merge($request->groupIds, $groupIds), array(null));
     }
     DBC::requireFalse(empty($groupIds), '小组不能为空');
     $title = $request->title;
     $content = preg_replace("/<\\/?a[^>]*>/i", "", $request->getUnSafeData('content'));
     DBC::requireFalse(XString::cntrim($title) == '' || XString::cntrim($content) == '', '话题标题和内容都不能为空');
     $res = ResidentEvilClient::getInstance()->createTopics2Groups($this->space->id, $groupIds, $this->user->id, $title, $content);
     if (false == $res && $this->user->id != $this->space->id) {
         $this->message('您的发言没有成功,可能是已被禁止发言!服务电话:' . HdfPhoneNumber::PHONE_FENZHEN, $response, array('url' => $this->space->getPatientIndexUrl()));
         return;
     }
     $this->message('话题发表成功!', $response, array('url' => $this->space->getPatientIndexUrl()));
 }
 private function getPatientsList($request, $response)
 {
     /*{{{*/
     $groups = DAL::get()->find_all_by_spaceid('ReGroup', $this->space->id);
     $newTopicLists = ResidentEvilClient::getInstance()->getNewTopicList($this->space->user->id, 5);
     //5条新话题
     $response->groups = $groups;
     $response->newTopicLists = $newTopicLists['list'];
     $allScheduleTables = Schedule::buildAllTables(array($this->space->host));
     $allScheduleTable = $allScheduleTables[$this->space->host->primaryId];
     $response->AllScheduleTables = $allScheduleTable;
 }
    public function addReTopic($request, $response)
    {/*{{{*/
        $groupIds = $request->getRequest('groupIds', array());
        $id = $request->articleId;
        $groupList = DAL::get()->find('regroup',$groupIds);
        $article = DAL::get()->find('article',$id);

        if(false == $article->isNull())
        {
            if(false == empty($groupIds) && false === array_search('refused',$groupIds))
            {
                foreach($groupList as $group)
                {
                    if(false == $group->isNull())
                    {
                        $reBoard = DAL::get()->find('reboard', $group->reboardId);
                        if ($reBoard->isNull())
                        	continue; 
                        $content = preg_replace("/<\/?a[^>]*>/i", "", $article->content); 
                        $content = $content."\n\n<span style='color:#007BC1'>希望此文对大家有帮助,欢迎大家在这里跟帖讨论,发表自己的心得与感想。祝大家早日康复!</span>";
                        ResidentEvilClient::getInstance()->createTopic($group->space, $reBoard,$group->space->user, $article->title, $content, $article->id);
                    }
                }
            }
            else
                ArticleClient::getInstance()->modifyArticle($article->id, array('reproduce' => Article::REPRODUCE_REFUSED));
        }
        $response->setRedirect($response->router->urlfor('adminarticle/newpostcomplete', array('id' =>$article->id)));
    }/*}}}*/
	public function postTopic($request, $response)
	{
		$groupIds = $request->groupIds;
		if(!$groupIds)
		{
			$response->message = '没有选择话题所在的组!';
			MsgHtml::msg($response->message, 'http://'.URL_PREFIX.'passport.haodf.com/mypatient/post', array('delay' => 6, 'button' => 'back'));
			return false;
		}
		$title = $request->title;
		$content = preg_replace("/<\/?a[^>]*>/i", "", $request->content);
		if(XString::cntrim($title) == '' || XString::cntrim($content) == '')
		{
			$response->message = '话题标题和内容都不能为空!';
			MsgHtml::msg($response->message, 'http://'.URL_PREFIX.'passport.haodf.com/mypatient/post', array('delay' => 6, 'button' => 'back'));
			return false;
		}
		$groups = DAL::get()->find('regroup', $groupIds);
		foreach($groups as $group)
		{
			if($group->reboard->isNull() == false)
			{
				$member = ForumClient::getInstance()->getMemberByUserIdAndGroupId($this->user->id, $group->id);
				if($member->isNull() == false && $member->isForbiddened())
				{
					$response->message = '您的发言没有成功,可能是已被禁止发言!服务电话:'.HdfPhoneNumber::PHONE_FENZHEN;
					MsgHtml::msg($response->message, 'http://'.URL_PREFIX.'passport.haodf.com/mypatient/index', array('delay' => 6, 'button' => 'back'));
					return false;
				}
				ResidentEvilClient::getInstance()->createTopic($group->space, $group->reboard, $this->user, $title, $content);
			}
		}
		$response->message = '话题发表成功!';
		MsgHtml::msg($response->message, 'http://'.URL_PREFIX.'passport.haodf.com/mypatient/index', array('delay' => 6, 'button' => 'back'));
	}
 public function getMyTopicsOrMyRemessages($request, $response)
 {
     $nowPage = $request->getRequest('p', 1);
     $pageSize = 20;
     $spaceId = $request->spaceId;
     $type = $request->getRequest('type', 'all');
     $userId = $request->userId;
     $topicList = ResidentEvilClient::getInstance()->getAllTopicOrMessageByUserId($userId, $type, $nowPage, $pageSize, array('spaceId' => $spaceId));
     if (isset($topicList['pageInfo']) && false == empty($topicList['pageInfo'])) {
         $url = "/residentevil/showmytopics?spaceId={$spaceId}&userId={$userId}&type=topic&p=";
         if ($type == 'message') {
             $url = "/residentevil/showmyremessages?spaceId={$spaceId}&userId={$userId}&type=message&p=";
         }
         $pagelink = PageNav::getNavLink(PageNav::getPageNavTemplate($url), $topicList['pageInfo']['nowpage'], $topicList['pageInfo']['pagesize'], $topicList['pageInfo']['total']);
     }
     if (isset($pagelink)) {
         $response->pagelink = $pagelink;
     }
     $response->topicList = $topicList['list'];
 }
    public function index($request,$response)
    {/*{{{*/
        if($this->user->isNull())
        {
            $response->setRedirect('http://'.URL_PREFIX.'passport.haodf.com/user/login');
            return;
        } 
        $user = $this->user;
        $signin = $this->user->getFollowupPatientSignin();
        if($signin->isNull() == false)
        {
            if($signin->isOpenFollowup() || $signin->isSuspendedFollowup())
            {
                header("Location: http://".URL_PREFIX."passport.haodf.com/myhealth/healthdiary");
                return;
            }
            //在审核通过与待审核状态下
            elseif(false == $signin->isCloseFollowup() && false == $signin->isRefused())
            {
                //同意条款,进中间页
                if($signin->isNoticedYes())
                {
                    $response->setRedirect('http://'.URL_PREFIX.'passport.haodf.com/myhealth/followupserviceinfo');
                    return;
                }
                //管理员拒绝前,未确认条款(也就是没点同意,也没有点不同意),进知情同意书
                if(false == $signin->isNoticed())
                {
                    $response->setRedirect('http://'.URL_PREFIX.'passport.haodf.com/myhealth/manhua');
                    return;
                }
            }
        }

        $limit = 10;
        $flows = DAL::get()->find_all_lastSpacePost_by_user('doctorpatientref', $this->user, $limit);
       // $telProposals = DAL::get()->find_all_by_servicedef_and_userId_and_status('proposal', $this->user, ServiceDef::TYPE_TELORDER, Proposal::STATUS_NORMAL);
        $statuses = array(TelDto::STATUS_UNPAID, TelDto::STATUS_WAITING);
        $telProposals = TelDto::getListByStatuses($this->user, $statuses);
        $bookingOrder = DAL::get()->find_all_by_userid_and_valid('bookingOrder', $this->user->id);

        $relatedObjs = array_merge($telProposals, $bookingOrder, $flows);
        $relatedObjs = $this->sortUpdateTime($relatedObjs);
        $response->relatedObjs = $relatedObjs;

        $indexCnt = 5;
        $myDoctorList = SubscriptionClient::getInstance()->getMyDoctorInfos( $this->user->id );
        $subList = SubscriptionClient::getInstance()->getSubcriptDiseaseList( $this->user->id, $indexCnt );
        $articleRes = SubscriptionClient::getInstance()->getUserSubscriptionArticleList4Web($this->user->id, $total=1);
        $response->articleRes = isset($articleRes['list']) ? $articleRes['list'] : array();
        $lastestTopics = ResidentEvilClient::getInstance()->getTopicsByUserId($this->user->id, 5);

        $answerNaireRes = NfsClient::getInstance()->getAnswerNaireList($user->id, 1, 5);
        $answerNaireList = $answerNaireRes['answerNaireList'];
        $response->answerNaireList = $answerNaireList;

        $response->user = $user;
        $response->lastestTopics = $lastestTopics;
        $response->myDoctorList = $myDoctorList;
        $response->subList = $subList;
    }/*}}}*/