/**
  * 获取版块信息
  *
  * @param string $fids 版块信息列表 空或者0则为全部版块
  * @return array
  */
 public static function getForumInfos($fids = '')
 {
     if ($fids == '' || $fids == '0') {
         $fids = ForumUtils::getForumShowFids();
     } else {
         $fids = ArrayUtils::explode($fids);
     }
     return DzForumForum::getForumInfos($fids);
 }
 private function _getForumList($fid)
 {
     require_once libfile('function/forumlist');
     $forumList = array();
     // 子版块
     if ($fid > 0) {
         $tempForum = array();
         $tempForum['board_category_id'] = $fid;
         $tempForum['board_category_name'] = WebUtils::emptyHtml(DzForumForum::getNameByFid($fid));
         $tempForum['board_category_type'] = 1;
         $forums = ForumUtils::getForumSubList($fid);
         foreach ($forums as $forum) {
             $tempForum['board_list'][] = $this->_getForumInfo($forum);
         }
         $forumList[] = $tempForum;
     } else {
         $forumColumnStyle = WebUtils::getDzPluginAppbymeAppConfig('dzsyscache_forum_column_style');
         $groups = ForumUtils::getForumGroupList();
         foreach ($groups as $group) {
             $gid = (int) $group['fid'];
             $tempGroup = array();
             $tempGroup['board_category_id'] = $gid;
             $tempGroup['board_category_name'] = WebUtils::emptyHtml($group['name']);
             $tempGroup['board_category_type'] = isset($forumColumnStyle[$gid]) ? (int) $forumColumnStyle[$gid] : 2;
             $forums = ForumUtils::getForumList($group['fid']);
             foreach ($forums as $forum) {
                 $tempGroup['board_list'][] = $this->_getForumInfo($forum);
             }
             $forumList[] = $tempGroup;
         }
     }
     $fidList = ForumUtils::getForumShowFids();
     $imgFidList = ForumUtils::getForumImageShowFids();
     $tempGroupList = array();
     foreach ($forumList as $key => $group) {
         $tempForumList = array();
         foreach ($group['board_list'] as $forum) {
             if (in_array($forum['board_id'], $fidList)) {
                 if (!in_array($forum['board_id'], $imgFidList)) {
                     $forum['board_img'] = '';
                 }
                 $tempForumList[] = $forum;
             }
         }
         if (!empty($tempForumList)) {
             $tempGroup = $group;
             $tempGroup['board_list'] = $tempForumList;
             $tempGroupList[] = $tempGroup;
         }
     }
     $forumList = $tempGroupList;
     return $forumList;
 }
 private function _getFids($fid)
 {
     if ($fid == 0) {
         $fids = ForumUtils::getForumShowFids();
     }
     $fids[] = $fid;
     return $fids;
 }
Beispiel #4
0
 private static function _getFids($fid)
 {
     return $fid == 0 ? ForumUtils::getForumShowFids() : array($fid);
 }
 private function _getTopicInfos($fid, $page, $pageSize, $sort, $filterType = '', $filterId = '', $isImageList = '', $topOrder = '')
 {
     $infos = array('count' => 0, 'list' => array(), 'topTopicList' => array());
     // global $_G;
     // $forum = $_G['forum'];
     $count = $this->_getTopicCount($fid, $sort, $filterType, $filterId);
     $topicList = $this->_getTopicList($fid, $page, $pageSize, $sort, $filterType, $filterId);
     $topTopicList = $topTopicListTmp = $topList = array();
     if ($page == 1 && $topOrder != 0) {
         $status = $_GET['topOrder'];
         $fids = array();
         switch ($status) {
             case DzForumThread::DISPLAY_ORDER_GLOBAL:
                 $fids = ForumUtils::getForumShowFids();
                 break;
             case DzForumThread::DISPLAY_ORDER_GROUP:
                 $fids = DzForumForum::getFidsByGid(DzForumForum::getGidByFid($fid));
                 break;
             case DzForumThread::DISPLAY_ORDER_FORUM:
                 $fids = array($fid);
                 break;
             default:
                 break;
         }
         $topTopicListTmp = DzForumThread::getByFidData($fids, 0, 3, array('topic_stick' => array($status)));
         foreach ($topTopicListTmp as $top) {
             $topList['id'] = (int) $top['tid'];
             $topList['title'] = (string) $top['subject'];
             $topTopicList[] = $topList;
         }
     }
     // $topTopicList = $this->_getListField($topTopicList);
     $list = $this->_getListField($topicList);
     $infos['count'] = $count;
     $infos['list'] = $list;
     $infos['topTopicList'] = $topTopicList;
     return $infos;
 }
Beispiel #6
0
 private function _getForumList($fid, $type)
 {
     require_once libfile('function/forumlist');
     $forumList = array();
     // 关注的板块
     $focusBoardIds = $this->_getFocusBoard();
     $params = array('focusBoardIds' => $focusBoardIds);
     // 子版块
     if ($fid > 0) {
         $tempForum = array();
         $tempForum['board_category_id'] = $fid;
         $tempForum['board_category_name'] = WebUtils::emptyHtml(DzForumForum::getNameByFid($fid));
         $tempForum['board_category_type'] = 1;
         $forums = ForumUtils::getForumSubList($fid);
         foreach ($forums as $forum) {
             $tempForum['board_list'][] = $this->_getForumInfo($forum, $params);
         }
         $forumList[] = $tempForum;
     } else {
         $forumColumnStyle = WebUtils::getDzPluginAppbymeAppConfig('dzsyscache_forum_column_style');
         $groups = ForumUtils::getForumGroupList();
         foreach ($groups as $group) {
             $gid = (int) $group['fid'];
             $tempGroup = array();
             $tempGroup['board_category_id'] = $gid;
             $tempGroup['board_category_name'] = WebUtils::emptyHtml($group['name']);
             $tempGroup['board_category_type'] = isset($forumColumnStyle[$gid]) ? (int) $forumColumnStyle[$gid] : 2;
             $forums = ForumUtils::getForumList($group['fid']);
             foreach ($forums as $forum) {
                 $tempGroup['board_list'][] = $this->_getForumInfo($forum, $params);
             }
             $forumList[] = $tempGroup;
         }
     }
     $fidList = ForumUtils::getForumShowFids();
     $imgFidList = ForumUtils::getForumImageShowFids();
     $tempGroupList = array();
     foreach ($forumList as $key => $group) {
         $tempForumList = array();
         foreach ($group['board_list'] as $forum) {
             if (in_array($forum['board_id'], $fidList)) {
                 if (!in_array($forum['board_id'], $imgFidList)) {
                     $forum['board_img'] = '';
                 }
                 $tempForumList[] = $forum;
             }
         }
         if (!empty($tempForumList)) {
             $tempGroup = $group;
             $tempGroup['board_list'] = $tempForumList;
             $tempGroupList[] = $tempGroup;
         }
     }
     $forumList = $tempGroupList;
     if ($type == 'rec') {
         // 推荐板块 按照总帖子进行排序
         $recommendedBoard = $topicTotalNum = $focusBoard = array();
         if ($fid == 0) {
             foreach ($forumList as $k => $v) {
                 $board = $forumList[$k]['board_list'];
                 $recommendedBoard = array_merge($recommendedBoard, $board);
             }
             foreach ($recommendedBoard as $k => $v) {
                 $topicTotalNum[] = $v['topic_total_num'];
                 if (in_array($v['board_id'], $focusBoardIds)) {
                     $focusBoard[] = $v;
                 }
             }
             array_multisort($topicTotalNum, SORT_DESC, $recommendedBoard);
             $recommendedBoard = array_slice($recommendedBoard, 0, 5);
         }
         return array('forumList' => $forumList, 'focusBoard' => $focusBoard, 'recommendedBoard' => $recommendedBoard);
     }
     return $forumList;
 }