コード例 #1
0
        private void RenderForumsMenu()
        {
            ForumCollection forums = DataProvider.Instance().GetForumsByForumGroupId(Forum.ForumGroupId, Context.User.Identity.Name);

            forums.Sort();
            string forumMenu = "<div class='popupMenu' style='position: absolute; display: none;' id='" + this.UniqueID + ":forumMenu'>";

            forumMenu += "<div class='popupTitle'>Forums</div>";
            for (int i = 0; i < forums.Count; i++)
            {
                forumMenu += "<div class='popupItem'> <a href='" + UrlShowForum + ((Forum)forums[i]).ForumID +
                             "'>" + ((Forum)forums[i]).Name + "</a> </div>";
            }
            forumMenu += "</div>";
            Page.RegisterClientScriptBlock(this.UniqueID + ":forumMenu", forumMenu);
        }
コード例 #2
0
        // *********************************************************************
        //  GetChildForums
        //
        /// <summary>
        /// Used to return a collection of forums for a parent forum
        /// </summary>
        /// <param name="forumGroupId">Forum Group ID to retrieve forums for</param>
        /// <param name="username">Username making the request</param>
        /// <param name="showAll">Show forums marked as inactive?</param>
        ///
        // ***********************************************************************/
        public ForumCollection GetChildForums(int forumId, string username, bool showAll)
        {
            ForumCollection allForums;
            ForumCollection subForums = new ForumCollection();

            // First get all the forums
            allForums = GetAllForums(showAll, username);

            // Sort the forums
            allForums.Sort();

            // Find all the forums that belong to the requested forumGroupId
            foreach (Forum f in allForums)
            {
                if (f.ParentId == forumId)
                {
                    subForums.Add(f);
                }
            }

            subForums.Sort();

            return(subForums);
        }
コード例 #3
0
        // *********************************************************************
        //  GetForumsByForumGroupId
        //
        /// <summary>
        /// Used to return a narrow collection of forums that belong to a given forum id.
        /// The username is provied for personalization, e.g. if the user has new
        /// posts in the forum. Note, this only returns ParentID = 0 forums
        /// </summary>
        /// <param name="forumGroupId">Forum Group ID to retrieve forums for</param>
        /// <param name="username">Username making the request</param>
        /// <param name="showAll">Show forums marked as inactive?</param>
        ///
        // ***********************************************************************/
        public ForumCollection GetForumsByForumGroupId(int forumGroupId, string username, bool showAll)
        {
            ForumCollection allForums;
            ForumCollection forumsBelongingToGroup = new ForumCollection();

            // First get all the forums
            allForums = GetAllForums(showAll, username);

            // Sort the forums
            allForums.Sort();

            // Find all the forums that belong to the requested forumGroupId
            foreach (Forum f in allForums)
            {
                if ((f.ForumGroupId == forumGroupId) && (f.ParentId == 0))
                {
                    forumsBelongingToGroup.Add(f);
                }
            }

            forumsBelongingToGroup.Sort();

            return(forumsBelongingToGroup);
        }