Subversion Repositories taios

Rev

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

Rev Author Line No. Line
169 tom 1
<?php
2
 
3
require '../_taios.php';
4
 
5
$page = new Taios_Page('Forums', '../');
6
 
246 tom 7
$parentID = $_GET['parentID'];
8
if (empty($parentID))
9
{
10
    $parentID = -1;
11
}
302 freddie 12
else if ($parentID != -1)
13
{
14
    $page->title = $page->getForumCategory($parentID)->title;
15
}
169 tom 16
 
302 freddie 17
$page->drawHeader();
18
$page->drawMiddle();
19
 
304 tom 20
write('<p><i>The forums are still under construction.</i></p>');
21
 
270 tom 22
write('<p class="bold">');
23
if ($parentID != -1)
24
{
25
    write('<a href="index.php?parentID=-1">Back to root</a>');
26
}
471 muzer 27
if ($page->isLoggedIn() && $page->isUserNormal($page->getLoggedInUser()))
281 tom 28
{
282 tom 29
    if ($parentID != -1)
281 tom 30
    {
31
        write(' &middot; ');
32
    }
33
    write('<a href="add-post.php?categoryID=' . $parentID . '">Add Post</a>');
34
}
265 tom 35
if ($page->isUserAdmin($page->getLoggedInUser()))
36
{
281 tom 37
    if ($page->isLoggedIn())
270 tom 38
    {
39
        write(' &middot; ');
40
    }
41
    write('<a href="add-category.php?parentID=' . $parentID . '">Add Category</a>');
265 tom 42
}
270 tom 43
write('</p><br />');
265 tom 44
 
484 muzer 45
$ids = $page->findIDs('ForumCategories', 'WHERE ParentID = "' . $parentID . '" ORDER BY Title ASC');
252 tom 46
 
47
if (count($ids) >= 1)
48
{
49
    write('<h3>Categories</h3>');
50
}
51
 
246 tom 52
for ($i = 0; $i < count($ids); $i++)
53
{
251 tom 54
    $forumCategory = $page->getForumCategory($ids[$i]);
254 tom 55
    write('<h4><a href="index.php?parentID=' . $forumCategory->ID . '">' . $forumCategory->title . '</a></h4>');
246 tom 56
    write('<p>' . $forumCategory->description . '</p>');
271 tom 57
    if ($page->isUserAdmin($page->getLoggedInUser()))
58
    {
298 freddie 59
        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>');
271 tom 60
    }
252 tom 61
    write('<br />');
246 tom 62
}
63
 
484 muzer 64
$ids = $page->findIDs('ForumPosts', 'WHERE CategoryID = "' . $parentID . '" AND ParentID = -1 ORDER BY Title ASC');
252 tom 65
 
66
if (count($ids) >= 1)
67
{
68
    write('<h3>Topics</h3>');
69
}
70
 
71
for ($i = 0; $i < count($ids); $i++)
72
{
73
    $forumPost = $page->getForumPost($ids[$i]);
74
    write('<h4><a href="post.php?id=' . $forumPost->ID . '">' . $forumPost->title . '</a></h4>');
75
    write('<br />');
76
}
77
 
169 tom 78
$page->drawFooter();
79
 
80
?>
81