<?PHP

#
#   FILE:  SPT--Forums.php
#
#   FUNCTIONS PROVIDED:
#
#   FUNCTIONS EXPECTED:
#
#   Part of the Scout Portal Toolkit
#   Copyright 2004 Internet Scout Project
#   http://scout.cs.wisc.edu
#

PageTitle("Discussion Forums");

# ----- EXPORTED FUNCTIONS ---------------------------------------------------

# print forum name
function PrintForumName()
{
    global $ForumId;
    
    if (isset($ForumId))
    {
        $Forum = new Forum($ForumId);
        print $Forum->ForumName();
    }
}

# print forum description
function PrintForumDescription()
{
    global $ForumId;

    if (isset($ForumId))
    {
        $Forum = new Forum($ForumId);
        print $Forum->ForumDescription();
    }
}

# print forum moderator email 
function PrintForumModeratorEmail()
{
    global $ForumId;
    if (isset($ForumId))
    {
        $Forum = new Forum($ForumId);
        print $Forum->ModeratorEmail();
    }
}

# print forum moderator
function PrintForumModerator()
{
    global $ForumId;

    if (isset($ForumId))
    {
        $Forum = new Forum($ForumId);
        print $Forum->ModeratorName();
    }
}

# print forumid
function PrintForumId()
{
    global $ForumId;

    print $ForumId;
}

# print topic count
function PrintTopicCount()
{
    global $ForumId;

    if (isset($ForumId))
    {
        $Forum = new Forum($ForumId);
        print $Forum->TopicCount();
    }
}

# print message count
function PrintMessageCount()
{
    global $ForumId;

    if (isset($ForumId))
    {
        $Forum = new Forum($ForumId);
        print $Forum->MessageCount();
    }
}

# print last message date 
function PrintLastMessageDate()
{
    global $ForumId;

    if (isset($ForumId))
    {
        $Forum = new Forum($ForumId);
        print $Forum->LastMessageDate();
    }
}

# print last message poster 
function PrintLastMessagePoster()
{
    global $ForumId;

    if (isset($ForumId))
    {
        $Forum = new Forum($ForumId);
        print $Forum->LastMessagePoster();
    }
}

# print last message poster email
function PrintLastMessagePosterEmail()
{
    global $ForumId;

    if (isset($ForumId))
    {
        $Forum = new Forum($ForumId);
        print $Forum->LastMessagePosterEmail();
    }
}

function DisplayForums()
{
    global $ForumId;

    $Query = "Select * from Forums Order By ForumName";
    $DB = new SPTDatabase();
    $DB->Query($Query);

    while ($Entry = $DB->FetchRow())
    {
        $ForumId = $Entry["ForumId"];

        # print forum info 
        PrintForum();
    }
}

# ----- LOCAL FUNCTIONS ------------------------------------------------------

# ----- MAIN -----------------------------------------------------------------

# non-standard global variables
global $ForumId;

?>
