Subversion Repositories taios

Rev

Rev 304 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php

require '../_taios.php';

$page = new Taios_Page('Forums', '../');

$parentID = $_GET['parentID'];
if (empty($parentID))
{
    $parentID = -1;
}
else if ($parentID != -1)
{
    $page->title = $page->getForumCategory($parentID)->title;
}

$page->drawHeader();
$page->drawMiddle();

write('<p><i>The forums are still under construction.</i></p>');

write('<p class="bold">');
if ($parentID != -1)
{
    write('<a href="index.php?parentID=-1">Back to root</a>');
}
if ($page->isLoggedIn() && $page->isUserNormal($page->getLoggedInUser()))
{
    if ($parentID != -1)
    {
        write(' &middot; ');
    }
    write('<a href="add-post.php?categoryID=' . $parentID . '">Add Post</a>');
}
if ($page->isUserAdmin($page->getLoggedInUser()))
{
    if ($page->isLoggedIn())
    {
        write(' &middot; ');
    }
    write('<a href="add-category.php?parentID=' . $parentID . '">Add Category</a>');
}
write('</p><br />');

$ids = $page->findIDs('ForumCategories', 'WHERE ParentID = ' . $parentID . ' ORDER BY Title ASC');

if (count($ids) >= 1)
{
    write('<h3>Categories</h3>');
}

for ($i = 0; $i < count($ids); $i++)
{
    $forumCategory = $page->getForumCategory($ids[$i]);
    write('<h4><a href="index.php?parentID=' . $forumCategory->ID . '">' . $forumCategory->title . '</a></h4>');
    write('<p>' . $forumCategory->description . '</p>');
    if ($page->isUserAdmin($page->getLoggedInUser()))
    {
        write('<p class="bold"><a href="edit-category.php?id=' . $forumCategory->ID . '">Edit Category</a> &nbsp; &middot; &nbsp; <a href="delete-category-do.php?id=' . $forumCategory->ID . '">Delete Category</a></p>');
    }
    write('<br />');
}

$ids = $page->findIDs('ForumPosts', 'WHERE CategoryID = ' . $parentID . ' AND ParentID = -1 ORDER BY Title ASC');

if (count($ids) >= 1)
{
    write('<h3>Topics</h3>');
}

for ($i = 0; $i < count($ids); $i++)
{
    $forumPost = $page->getForumPost($ids[$i]);
    write('<h4><a href="post.php?id=' . $forumPost->ID . '">' . $forumPost->title . '</a></h4>');
    write('<br />');
}

$page->drawFooter();

?>