summaryrefslogtreecommitdiff
path: root/forum/utils/forums.php
diff options
context:
space:
mode:
authordeva <deva>2011-11-01 09:32:21 +0000
committerdeva <deva>2011-11-01 09:32:21 +0000
commit42c62cb041a2b2b95c9cda0c20fcf70334fd244c (patch)
tree38371eb37ff7348585ee84438b326c25055e2cbe /forum/utils/forums.php
parent208e3b642149a9ac701a43397d31990f9b27ca79 (diff)
Rewl og krat... needs cleaning up - after port to GIT.origin
Diffstat (limited to 'forum/utils/forums.php')
-rw-r--r--forum/utils/forums.php52
1 files changed, 39 insertions, 13 deletions
diff --git a/forum/utils/forums.php b/forum/utils/forums.php
index c9c48b5..c93cafb 100644
--- a/forum/utils/forums.php
+++ b/forum/utils/forums.php
@@ -7,8 +7,8 @@ include_once($UTIL_DIR . "/threads.php");
class Forum {
public $fid;
public $name;
- private $newStuff;
- private $numPosts;
+ public $newStuff;
+ public $numPosts;
private $latestPost;
public function setNewStuff($newStuff, $threads)
@@ -25,15 +25,37 @@ class Forum {
public function show()
{
+ global $cache;
+ global $yeah;
+
+ $str = "";
+
$newcls = " forum_nonew";
- if($this->newStuff) $newcls = " forum_new";
-
- echo " <div class=\"forum\">\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";
+ if($yeah) {
+ $lp = $cache->get("forum_lastpost");
+ if($lp->value($this->fid)) $newcls = " forum_new";
+ } else {
+ if($this->newStuff) $newcls = " forum_new";
+ }
+
+ $str .= " <div class=\"forum\">\n";
+ $str .= " <span class=\"forum_icon".$newcls."\"></span>\n";
+ $str .= " <a class=\"forum_title\" href=\"?fid=" .
+ $this->fid . "\">" . $this->name . "</a>\n";
+ $str .= " <span class=\"forum_latestpost\">".
+ $this->latestPost . "</span>\n";
+ if($yeah) {
+ $fc = $cache->get("forum_numberofthreads");
+
+ $str .= " <span class=\"forum_numberofthreads\">" .
+ $fc->value($this->fid) . " threads</span>\n";
+ } else {
+ $str .= " <span class=\"forum_numberofthreads\">"
+ . sprintf("%d", $this->numPosts)." threads</span>\n";
+ }
+ $str .= " </div>\n";
+
+ return $str;
}
public function Forum($fid, $name)
@@ -84,11 +106,15 @@ class Forums {
public function show()
{
- echo "<div class=\"forums\">\n";
+ $str = "";
+
+ $str .= "<div class=\"forums\">\n";
foreach($this->forums as $forum) {
- $forum->show();
+ $str .= $forum->show();
}
- echo "</div>\n";
+ $str .= "</div>\n";
+
+ return $str;
}
private function read()