diff options
Diffstat (limited to 'forum/utils/forums.php')
-rw-r--r-- | forum/utils/forums.php | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/forum/utils/forums.php b/forum/utils/forums.php index 1827e3c..06196a6 100644 --- a/forum/utils/forums.php +++ b/forum/utils/forums.php @@ -1,4 +1,4 @@ -<?php +<?php /* -*- Mode: php; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ include_once($UTIL_DIR . "/convert.php"); include_once($UTIL_DIR . "/threads.php"); @@ -8,18 +8,31 @@ class Forum { public $fid; public $name; private $newStuff; + private $numPosts; + private $latestPost; - public function setNewStuff($newStuff) + public function setNewStuff($newStuff, $threads) { + $this->numPosts = sizeof($threads->threads); + $this->latestPost = ""; + $t = $threads->getLatestThread(); + if($t) { + $this->latestPost = $t->name; + } + $this->newStuff = $newStuff; } public function show() { + $newcls = ""; + if($this->newStuff) $newcls = " forum_new"; + echo " <div class=\"forum\">\n"; - if($this->newStuff) echo " <div class=\"new\"></div>\n"; - else echo " <div class=\"nonew\"></div>\n"; - echo " <a href=\"?fid=" . $this->fid . "\">" . $this->name . "</a>\n"; + echo " <span class=\"forum_icon".$newcls."\"></span>\n"; + echo " <a class=\"forum_title\" href=\"?fid=" . $this->fid . "\">" . $this->name . "</a>\n"; + echo " <span class=\"forum_latestpost\">".$this->latestPost."</span>\n"; + echo " <span class=\"forum_numberofthreads\">".sprintf("%d", $this->numPosts)." threads</span>\n"; echo " </div>\n"; } @@ -92,7 +105,7 @@ class Forums { $this->add($forum); $threads = new Threads($FORUMS_DIR . "/" . $f->getAttribute('fid')); - $forum->setNewStuff($threads->newStuff()); + $forum->setNewStuff($threads->newStuff(), $threads); } } |