Subversion Repositories taios

Rev

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