Rev 266 | Rev 271 | 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(' · '); |
||
| 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>'); |
| 252 | tom | 42 | write('<br />'); |
| 246 | tom | 43 | } |
| 44 | |||
| 252 | tom | 45 | $ids = $page->findIDs('ForumPosts', 'WHERE CategoryID = ' . $parentID . ' AND ParentID = -1 ORDER BY Title ASC'); |
| 46 | |||
| 47 | if (count($ids) >= 1) |
||
| 48 | { |
||
| 49 | write('<h3>Topics</h3>'); |
||
| 50 | } |
||
| 51 | |||
| 52 | for ($i = 0; $i < count($ids); $i++) |
||
| 53 | { |
||
| 54 | $forumPost = $page->getForumPost($ids[$i]); |
||
| 55 | write('<h4><a href="post.php?id=' . $forumPost->ID . '">' . $forumPost->title . '</a></h4>'); |
||
| 56 | write('<br />'); |
||
| 57 | } |
||
| 58 | |||
| 169 | tom | 59 | $page->drawFooter(); |
| 60 | |||
| 61 | ?> |
||
| 62 |