protected function getData($field, $order, $limit, $offset)
 {
     Wind::import('SRV:forum.vo.PwForumSo');
     $so = new PwForumSo();
     //if ($field['fids']) {//if (count($field['fids']) > $limit) $field['fids'] = array_slice($field['fids'], 0, $limit);
     if ($field['fids'] && $field['fids'][0]) {
         $so->setFid($field['fids']);
     }
     switch ($order) {
         case '1':
             $so->orderbyThreads(false);
             break;
         case '2':
             $so->orderbyTodaythreads(false);
             break;
         case '3':
             $so->orderbyArticle(false);
             break;
         case '4':
             $so->orderbyLastPostTime(false);
             break;
     }
     $list = Wekit::load('forum.PwForum')->searchDesignForum($so, $limit, $offset);
     return $this->_buildSignKey($list);
 }
Example #2
0
 public function countSearchForum(PwForumSo $so)
 {
     return $this->_getDesignForumDao()->countSearchForum($so->getData());
 }
Example #3
0
 public function forumAction()
 {
     if (($result = $this->_checkRight()) instanceof PwError) {
         $this->showError($result->getError());
     }
     list($page, $perpage, $keywords, $limittime, $orderby) = $this->getInput(array('page', 'perpage', 'keywords', 'limittime', 'orderby'));
     $args = array();
     if ($keywords) {
         //最后搜索时间
         if (($result = $this->_checkSearch()) instanceof PwError) {
             $this->showError($result->getError());
         }
         $page = $page ? $page : 1;
         $perpage = $perpage ? $perpage : $this->perpage;
         list($start, $limit) = Pw::page2limit($page, $perpage);
         !$orderby && ($orderby = 'lastpost_time');
         Wind::import('SRV:forum.vo.PwForumSo');
         $keywords = urldecode($keywords);
         $so = new PwForumSo();
         $so->setName($keywords);
         $so = $this->_getOrderBy($so, $orderby);
         $count = $this->_getSearchService()->countSearchForum($so);
         $count = $count > $this->maxNum ? $this->maxNum : $count;
         if ($count) {
             $forums = $this->_getSearchService()->searchForum($so, $limit, $start);
             $forums = $this->_getSearchService()->buildForums($forums, $keywords);
             $joinForums = Wekit::load('forum.PwForumUser')->getFroumByUid($this->loginUser->uid);
             $joinForums && $this->setOutput(array_keys($joinForums), 'joinForums');
             $this->_replaceRecord($keywords, App_Search_Record::TYPE_FORUM);
         }
         $this->setOutput($page, 'page');
         $this->setOutput($perpage, 'perpage');
         $this->setOutput($count, 'count');
         $this->setOutput(array('keywords' => $keywords), 'args');
     }
     $this->setOutput($forums, 'forums');
     $this->setOutput(App_Search_Record::TYPE_FORUM, 'recordType');
     $this->setTemplate('index_forum');
     //seo设置
     $seoBo->setCustomSeo($keywords . ' - {sitename}', '', '');
 }