Subversion Repositories taios

Rev

Rev 298 | Rev 303 | 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
 
270 tom 20
write('<p class="bold">');
21
if ($parentID != -1)
22
{
23
    write('<a href="index.php?parentID=-1">Back to root</a>');
24
}
281 tom 25
if ($page->isLoggedIn())
26
{
282 tom 27
    if ($parentID != -1)
281 tom 28
    {
29
        write(' &middot; ');
30
    }
31
    write('<a href="add-post.php?categoryID=' . $parentID . '">Add Post</a>');
32
}
265 tom 33
if ($page->isUserAdmin($page->getLoggedInUser()))
34
{
281 tom 35
    if ($page->isLoggedIn())
270 tom 36
    {
37
        write(' &middot; ');
38
    }
39
    write('<a href="add-category.php?parentID=' . $parentID . '">Add Category</a>');
265 tom 40
}
270 tom 41
write('</p><br />');
265 tom 42
 
246 tom 43
$ids = $page->findIDs('ForumCategories', 'WHERE ParentID = ' . $parentID . ' ORDER BY Title ASC');
252 tom 44
 
45
if (count($ids) >= 1)
46
{
47
    write('<h3>Categories</h3>');
48
}
49
 
246 tom 50
for ($i = 0; $i < count($ids); $i++)
51
{
251 tom 52
    $forumCategory = $page->getForumCategory($ids[$i]);
254 tom 53
    write('<h4><a href="index.php?parentID=' . $forumCategory->ID . '">' . $forumCategory->title . '</a></h4>');
246 tom 54
    write('<p>' . $forumCategory->description . '</p>');
271 tom 55
    if ($page->isUserAdmin($page->getLoggedInUser()))
56
    {
298 freddie 57
        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 58
    }
252 tom 59
    write('<br />');
246 tom 60
}
61
 
252 tom 62
$ids = $page->findIDs('ForumPosts', 'WHERE CategoryID = ' . $parentID . ' AND ParentID = -1 ORDER BY Title ASC');
63
 
64
if (count($ids) >= 1)
65
{
66
    write('<h3>Topics</h3>');
67
}
68
 
69
for ($i = 0; $i < count($ids); $i++)
70
{
71
    $forumPost = $page->getForumPost($ids[$i]);
72
    write('<h4><a href="post.php?id=' . $forumPost->ID . '">' . $forumPost->title . '</a></h4>');
73
    write('<br />');
74
}
75
 
169 tom 76
$page->drawFooter();
77
 
78
?>
79