public function modifyPost($request, $response)
 {
     $paperTplId = $request->paperTplId;
     $paperTpl = DAL::get()->find('PaperTpl', $paperTplId, true);
     DBC::requireTrue($paperTpl instanceof PaperTpl, "PaperTpl {$paperTplId} 不存在");
     $params = array();
     $params['ename'] = $request->ename;
     $params['name'] = $request->name;
     $params['content'] = $request->getPost('content');
     PaperClient::getInstance()->modifyPaperTpl($paperTplId, $params);
     $msg = '修改成功';
     $url = $response->router->urlfor('papertpl/modify', array('msg' => $msg, 'paperTplId' => $paperTplId));
     $response->setRedirect($url);
 }
 private function getZhuantis($request, $response)
 {
     /*{{{*/
     $newZhuanTiList = PaperClient::getInstance()->queryPaperListByTag($this->space->host->id, 'Doctor');
     $oldZhuanTiList = ZhuanTiClient::getInstance()->getZhuanTiByDoctorId($this->space->host->id, 50000);
     list($allZhuanTiCount, $zhuanTis) = CombineZhuanTi::combineZhuanTiList($oldZhuanTiList, $newZhuanTiList);
     $response->allZhuanTiCount = $allZhuanTiCount;
     $zhuanTitWithPicUrl = array();
     foreach ($newZhuanTiList as $zhuanTi) {
         if ($zhuanTi->adpicurl != "") {
             $zhuanTitWithPicUrl[] = $zhuanTi;
         }
     }
     $response->zhuanTitWithPicUrl = array_slice($zhuanTitWithPicUrl, 0, 5);
 }
 public function uploadPic($request, $response)
 {
     /*{{{*/
     $paperId = $request->paperId;
     $type = empty($request->type) ? $request->type : "";
     $file = $_FILES['file'];
     $user = $this->curOperatorUser;
     $filePath = '';
     if ($file['error'] == 0) {
         $attach = Uploader::imageFile2attach($user, $file, Attachment::TYPE_JPG, $user->id, Attachment::HOSTTYPE_HDFADMIN);
         if ($attach instanceof Attachment) {
             $filePath = $attach->filePath;
         }
     }
     if ($filePath) {
         if (empty($type)) {
             PaperClient::getInstance()->modifyPaperPicurl($paperId, $filePath);
         } else {
             PaperClient::getInstance()->modifyPaperAdPicurl($paperId, $filePath);
         }
     }
     $msg = '专题图片修改成功';
     $url = $response->router->urlfor('paper/modifypic', array('msg' => $msg, 'paperId' => $paperId, 'type' => $type));
     $response->setRedirect($url);
 }
    public function healthNews($request, $response)
    {/*{{{*/
        $page = $request->page?$request->page:1;
        $pageSize = 50;
        $articleIds = array();
        $zhuantiIds = array();
        $articleDiseases = array();
        $zhuantis = array('list' => array());
        $articles = ArticleClient::getInstance()->getArticleList4Baidu($page,$pageSize);
        $this->sortHealthNewsArray($articles['list'], 'ctime');
        $firstArticle = array_shift($articles['list']);
        $lastArticle = array_pop($articles['list']);
        array_push($articles['list'], $lastArticle);
        array_unshift($articles['list'], $firstArticle);
        $articles['list'] = array_filter($articles['list']);
//        if ($firstArticle && $lastArticle) 
        {
//            $zhuantis = ZhuanTiClient::getInstance()->getZhuanTiList4Baidu($lastArticle->ctime, $firstArticle->ctime);
        }   
        foreach ($articles['list'] as $article)
        {
            $articleIds[] = $article->id;
        }
        if (false == empty($articleIds))
        {
            $articleDiseases = DiseaseClient::getInstance()->getDiseaseLablesByObjIds($articleIds, 'article', $pageSize);	
        }


        if($page == 1)
        {
            $papers = array('list'=>array());
            $papers['list'] = PaperClient::getInstance()->queryOnlinePaperList(XDateTime::now()->addDay(-10));

            $thesiss = array('list'=>array());
            $thesiss['list'] = ThesisClient::getInstance()->queryThesisOnlineList(XDateTime::now()->addDay(-10)); 
            $news = $articles['list'] + $zhuantis['list'] + $papers['list'] + $thesiss['list'];
        }
        else
        {
            $news = $articles['list'] + $zhuantis['list'];
        }
        $this->sortHealthNewsArray($news, 'ctime');
        $pagelink = PageNav::getNavLink(PageNav::getPageNavTemplate("?page="), $articles['pageInfo']['nowpage'], $pageSize, $articles['pageInfo']['total']);
        $response->news = $news;
        $response->articleDiseases = $articleDiseases;
        $response->pagelink = $pagelink;
    }/*}}}*/
 private function getZhuanTiListByType($cmsObjArr)
 {/*{{{*/
     $oldZhuanTiList = ZhuanTiClient::getInstance()->getZhuanTiByDoctorId($cmsObjArr['doctorIds'],50000); 
     $newZhuanTiList = PaperClient::getInstance()->queryPaperListByTag($cmsObjArr['entity']->id,get_Class($cmsObjArr['entity']));
     return CombineZhuanTi::combineZhuanTiList($oldZhuanTiList,$newZhuanTiList);
 }/*}}}*/
    private function getZhuanTiListByHospital($hospitalId)
    {/*{{{*/
		$oldZhuanTiList = ZhuantiClient::getInstance()->getListByHospitalId($hospitalId, 10);
        $newZhuanTiList = PaperClient::getInstance()->queryPaperListByTag($hospitalId,'Hospital');
        return CombineZhuanTi::combineZhuanTiList($oldZhuanTiList,$newZhuanTiList);
    }/*}}}*/
    private function getZhuanTiListByDoctor($doctorId)
    {/*{{{*/
		$oldZhuanTiList = ZhuanTiClient::getInstance()->getZhuanTiByDoctorId($doctorId, 10);
        $newZhuanTiList = PaperClient::getInstance()->queryPaperListByTag($doctorId,'Doctor');
        return CombineZhuanTi::combineZhuanTiList($oldZhuanTiList,$newZhuanTiList);
    }/*}}}*/
    public function showTagList($request,$response)
    {/*{{{*/
        $response->csss = array(
            'http://i1.hdfimg.com/www/cms/css/content_thesis.css?20140722',
            'http://i1.hdfimg.com/www/cms/css/thesis.css?20140722'
        );
        if($request->searchParam)
        {
            $searchParams = array();
            $searchType = $request->searchType;
            $searchParams[$searchType] = $request->searchParam;
            $searchParams['status'] = Paper::STATUS_ONLINE; 

            $page = $request->getRequest('page', 1);
            $pageSize = 40;
            $res = PaperClient::getInstance()->queryPapersByCondition($request->paperTplId, $searchType, $searchParams, $page, $pageSize);


            $response->papers = $res['list']; 
            $response->pageLink = '';
            if (false == empty($res['pageInfo'])) 
            {
                $response->pageLink = PageNav::getNavLink(
                    PageNav::getPageNavTemplate('/thesis/showtaglist?searchType='.$request->searchType.'&searchParam='.$request->searchParam.'&status='.$searchParams['status'].'&page='),
                    $res['pageInfo']['nowpage'], $res['pageInfo']['pagesize'],
                    $res['pageInfo']['total']);
            }
            $response->searchParam = $request->searchParam;
        }
        $response->searchType = $request->searchType;
        $response->searchWords = $this->getHotSearchWords();
        //咨询列表
        $response->flowList = FlowClient::getInstance()->getLatestFlowList(8);

        //电话咨询
        $diseaseIds_shuffle = self::$diseaseIds;
        shuffle($diseaseIds_shuffle);
        $this->getPhoneList(array_pop($diseaseIds_shuffle), $response);

        //好文推荐
        if ($request->category != CmsObjCategory::HAOWEN)
        {
            $this->getHaowenList($request, $response);
        }
        $response->category = $request->category;
    }/*}}}*/
        }
    }
    $doctors = DAL::get()->find('doctor', $doctorIds);
    $tmpDoctors = array();
    foreach ($doctorIds as $topicId => $doctorId)
    {
        $tmpDoctors[$topicId] = $doctors[$doctorId];
    }
    $result['topicList'] = $topicList;
    $result['DoctorList'] = $tmpDoctors;
    return $result;
}

?>
<?php
$papers = PaperClient::getInstance()->queryOnlinePaperListByLevel(2);
?> 

<div class="r_bar_con">
<ul class="r_bar_list2">

<?php
$paperCnt = 1;
if(false == empty($papers))
{
        foreach($papers as $paper)
        {
?>
                    <li <?=($paperCnt == 15) ? "style='border-bottom:0px'":""?>>
                        <a href="<?=$paper->getUrl()?>" target="_blank"><?=XString::truncate($paper->title, '40')?></a></li>
<?php
    private function getZhuantiListByFaculty($facultyId)
    {/*{{{*/
		// get doctorids by facultyid
        $doctorIds = DAL::get()->find_id_byFacultyId('doctor', $facultyId);
        $oldZhuanTiList = array();
        if($doctorIds)
        {
            $oldZhuanTiList = ZhuanTiClient::getInstance()->getZhuanTiByDoctorId($doctorIds, 10);
        }
        $newZhuanTiList = PaperClient::getInstance()->queryPaperListByTag($facultyId,'Faculty');

        return CombineZhuanTi::combineZhuanTiList($oldZhuanTiList,$newZhuanTiList);
    }/*}}}*/
 private function getZhuanTiListByDiseaseId($diseaseId)
 {/*{{{*/
     $diseaseZhuanTiList = DAL::get()->find_all_by_limitCount('diseasezhuanti', $diseaseId, 0);
     $oldZhuanTiIds = array();
     foreach($diseaseZhuanTiList as $diseaseZhuanti)
     {
         if($diseaseZhuanti->isNull() == false)
         {
             $oldZhuanTiIds[] = $diseaseZhuanti->zhuanti->id;
         }
     }
     $diseaseOldZhuanTiList = DAL::get()->find('zhuanti',$oldZhuanTiIds);
     $diseaseNewZhuantiList = PaperClient::getInstance()->queryPaperListByTag($diseaseId,'Disease');
     return CombineZhuanTi::combineZhuanTiList($diseaseOldZhuanTiList,$diseaseNewZhuantiList);
 }/*}}}*/
示例#12
0
 public function modifyPost4Ajax($request, $response)
 {
     $chipId = $request->chipId;
     $chip = DAL::get()->find('Chip', $chipId, true);
     $data = array();
     $data['errorno'] = -1;
     $data['content'] = '';
     if (false == $chip instanceof Chip) {
         $data['errorno'] = 0;
     }
     $params = array();
     $params['content'] = mb_convert_encoding($request->getPost('chipContent'), 'GBK', 'UTF-8');
     $chipId = PaperClient::getInstance()->modifyChip($chipId, $params);
     $chip = DAL::get()->find('Chip', $chipId, true);
     if ($chip instanceof Chip) {
         $data['errorno'] = 1;
         $data['content'] = mb_convert_encoding($chip->getModifyChipContent(), 'UTF-8', 'GBK');
     }
     header('Content-type: text/html;charset=UTF-8');
     echo json_encode($data);
     return parent::DIRECT_OUTPUT;
 }