summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Fowler <spider@viovio.com>2008-08-04 16:18:43 +0000
committerChristian Fowler <spider@viovio.com>2008-08-04 16:18:43 +0000
commit3ce4c6dfcf4510f428f60b15c10e2d4b14556fd8 (patch)
treeffabfc9c0020681d5ba662ffee75ff0bb7755caf
parentc56707f9955f574413d4d394f5583b1913f183fc (diff)
downloadboards-3ce4c6dfcf4510f428f60b15c10e2d4b14556fd8.tar.gz
boards-3ce4c6dfcf4510f428f60b15c10e2d4b14556fd8.tar.bz2
boards-3ce4c6dfcf4510f428f60b15c10e2d4b14556fd8.zip
add topic_count and post_count to board listing
-rw-r--r--BitBoard.php16
-rw-r--r--templates/board_table.tpl5
2 files changed, 14 insertions, 7 deletions
diff --git a/BitBoard.php b/BitBoard.php
index 85bad02..fcbd466 100644
--- a/BitBoard.php
+++ b/BitBoard.php
@@ -1,13 +1,13 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_boards/BitBoard.php,v 1.49 2008/08/01 21:00:29 wjames5 Exp $
- * $Id: BitBoard.php,v 1.49 2008/08/01 21:00:29 wjames5 Exp $
+ * $Header: /cvsroot/bitweaver/_bit_boards/BitBoard.php,v 1.50 2008/08/04 16:18:43 spiderr Exp $
+ * $Id: BitBoard.php,v 1.50 2008/08/04 16:18:43 spiderr Exp $
*
* BitBoard class to illustrate best practices when creating a new bitweaver package that
* builds on core bitweaver functionality, such as the Liberty CMS engine
*
* @author spider <spider@steelsun.com>
- * @version $Revision: 1.49 $ $Date: 2008/08/01 21:00:29 $ $Author: wjames5 $
+ * @version $Revision: 1.50 $ $Date: 2008/08/04 16:18:43 $ $Author: spiderr $
* @package boards
*/
@@ -534,12 +534,20 @@ WHERE map.`board_content_id`=lc.`content_id` AND ((s_lc.`user_id` < 0) AND (s.`i
$ret = array();
while( $res = $result->fetchRow() ) {
$res['url']= BOARDS_PKG_URL."index.php?b={$res['board_id']}";
- $res['post_count'] = $this->mDb->getOne( "SELECT count(*)
+
+ $res['topic_count'] = $this->mDb->getOne( "SELECT count(*)
FROM `".BIT_DB_PREFIX."boards_map` map
INNER JOIN `".BIT_DB_PREFIX."liberty_comments` lcom ON (map.`topic_content_id` = lcom.`root_id`)
INNER JOIN `".BIT_DB_PREFIX."liberty_content` slc ON( slc.`content_id` = lcom.`content_id` )
LEFT JOIN `".BIT_DB_PREFIX."boards_posts` fp ON (fp.`comment_id` = lcom.`comment_id`)
WHERE lcom.`root_id`=lcom.`parent_id` AND map.`board_content_id`=? AND ((fp.`is_approved` = 1) OR (fp.`is_approved` IS NULL))", array( $res['content_id'] ) );
+
+ $res['post_count'] = $this->mDb->getOne( "SELECT count(*)
+ FROM `".BIT_DB_PREFIX."liberty_comments` lcom
+ INNER JOIN `".BIT_DB_PREFIX."liberty_content` slc ON( slc.`content_id` = lcom.`content_id` )
+ INNER JOIN `".BIT_DB_PREFIX."boards_map` map ON (lcom.`root_id`=map.`topic_content_id`)
+ LEFT JOIN `".BIT_DB_PREFIX."boards_posts` fp ON (fp.`comment_id` = lcom.`comment_id`)
+ WHERE map.`board_content_id`=? AND ((fp.`is_approved` = 1) OR (fp.`is_approved` IS NULL))", array( $res['content_id'] ) );
if($track) {
if ($gBitUser->isRegistered()) {
$res['track']['on'] = true;
diff --git a/templates/board_table.tpl b/templates/board_table.tpl
index 1e1bf18..4eb3342 100644
--- a/templates/board_table.tpl
+++ b/templates/board_table.tpl
@@ -32,11 +32,10 @@
</div>
</td>
<td style="text-align:center">
- {* this field is poorly named *}
- <strong class="count">{$board.post_count}</strong>
+ <strong class="count">{$board.topic_count}</strong>
</td>
<td style="text-align:center">
- @TODO
+ <strong class="count">{$board.post_count}</strong>
</td>
<td>
{if !empty($board.last)}