Subversion Repositories taios

Rev

Rev 272 | Rev 275 | 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
$page->drawHeader();
7
$page->drawMiddle();
8
 
246 tom 9
$parentID = $_GET['parentID'];
10
if (empty($parentID))
11
{
12
    $parentID = -1;
13
}
169 tom 14
 
270 tom 15
write('<p class="bold">');
16
if ($parentID != -1)
17
{
18
    write('<a href="index.php?parentID=-1">Back to root</a>');
19
}
265 tom 20
if ($page->isUserAdmin($page->getLoggedInUser()))
21
{
270 tom 22
    if ($parentID != -1)
23
    {
24
        write(' &middot; ');
25
    }
26
    write('<a href="add-category.php?parentID=' . $parentID . '">Add Category</a>');
265 tom 27
}
270 tom 28
write('</p><br />');
265 tom 29
 
246 tom 30
$ids = $page->findIDs('ForumCategories', 'WHERE ParentID = ' . $parentID . ' ORDER BY Title ASC');
252 tom 31
 
32
if (count($ids) >= 1)
33
{
34
    write('<h3>Categories</h3>');
35
}
36
 
246 tom 37
for ($i = 0; $i < count($ids); $i++)
38
{
251 tom 39
    $forumCategory = $page->getForumCategory($ids[$i]);
254 tom 40
    write('<h4><a href="index.php?parentID=' . $forumCategory->ID . '">' . $forumCategory->title . '</a></h4>');
246 tom 41
    write('<p>' . $forumCategory->description . '</p>');
271 tom 42
    if ($page->isUserAdmin($page->getLoggedInUser()))
43
    {
273 tom 44
        write('<p><a href="edit-category.php?id=' . $forumCategory->ID . '">Edit Category</a> &nbsp;&nbsp; &middot; &nbsp;&nbsp; <a href="delete-category.php?id=' . $forumCategory->ID . '">Delete Category</a></p>');
271 tom 45
    }
252 tom 46
    write('<br />');
246 tom 47
}
48
 
252 tom 49
$ids = $page->findIDs('ForumPosts', 'WHERE CategoryID = ' . $parentID . ' AND ParentID = -1 ORDER BY Title ASC');
50
 
51
if (count($ids) >= 1)
52
{
53
    write('<h3>Topics</h3>');
54
}
55
 
56
for ($i = 0; $i < count($ids); $i++)
57
{
58
    $forumPost = $page->getForumPost($ids[$i]);
59
    write('<h4><a href="post.php?id=' . $forumPost->ID . '">' . $forumPost->title . '</a></h4>');
60
    write('<br />');
61
}
62
 
169 tom 63
$page->drawFooter();
64
 
65
?>
66