Esempio n. 1
0
        public static List <IXForum> GetForumIndexCollection(int hidePrivate, int userGroupId, int moderStyle, out int topicCount, out int postCount, out int todayCount)
        {
            var list = new List <IXForum>();

            topicCount = 0;
            postCount  = 0;
            todayCount = 0;
            //foreach (var current in BBX.Data.Forums.GetForumIndexList())
            foreach (var frm in XForum.GetForumIndexList())
            {
                if (!frm.Viewperm.IsNullOrEmpty() && !Utils.InArray(userGroupId.ToString(), frm.Viewperm))
                {
                    if (hidePrivate != 0)
                    {
                        continue;
                    }

                    //frm.LastTitle = "";
                    //frm.LastPoster = "";
                    //frm.Status = -1;
                }
                if (frm.Layer == 0 && Utils.GetCookie("bbx_collapse").IndexOf("_category_" + frm.Fid + "_") > -1)
                {
                    frm.Collapse = "display: none;";
                }
                //if (frm.Status > 0)
                //{
                //    if (frm.ParentID == 0 && frm.SubforumCount > 0)
                //    {
                //        frm.Status = frm.ColCount + 1;
                //    }
                //    else
                //    {
                //        frm.Status = 1;
                //        //frm.ColCount = 1;
                //    }
                //}
                //current.Moderators = Forums.GetModerators(current, moderStyle);
                if (frm.ModeratorsHtml == null)
                {
                    frm.ModeratorsHtml = frm.GetModerators(moderStyle);
                }
                if (frm.LastPost <= DateTime.MinValue || frm.LastPost.Date != DateTime.Now.Date)
                {
                    frm.TodayPosts = 0;
                }
                //if (!frm.Viewperm.IsNullOrEmpty() && !Utils.InArray(userGroupId.ToString(), frm.Viewperm) && hidePrivate == 0)
                //{
                //    frm.LastTitle = "";
                //    frm.LastPoster = "";
                //    frm.Status = -1;
                //}
                if (frm.Layer > 0)
                {
                    //var forumInfo = Forums.GetForumInfo(frm.Fid, false);
                    //if (forumInfo != null)
                    //{
                    //    forumInfo.Topics = frm.Topics;
                    //    forumInfo.Posts = frm.Posts;
                    //    forumInfo.TodayPosts = frm.TodayPosts;
                    //}
                    topicCount += frm.Topics;
                    postCount  += frm.Posts;
                    todayCount += frm.TodayPosts;
                }
                list.Add(frm);
            }
            return(Forums.GetRealForumIndexCollection(list));
        }