|
From: <al...@us...> - 2008-09-23 15:39:09
|
Revision: 688
http://sciret.svn.sourceforge.net/sciret/?rev=688&view=rev
Author: alpeb
Date: 2008-09-23 15:39:01 +0000 (Tue, 23 Sep 2008)
Log Message:
-----------
added categories and articles counter under the categories tab in the mainview
Modified Paths:
--------------
trunk/templates/MainView.tpl
trunk/views/MainView.php
Modified: trunk/templates/MainView.tpl
===================================================================
--- trunk/templates/MainView.tpl 2008-09-19 23:04:59 UTC (rev 687)
+++ trunk/templates/MainView.tpl 2008-09-23 15:39:01 UTC (rev 688)
@@ -36,6 +36,15 @@
</td>
</tr>
</table>
+ [l]Total Number of Categories:[/l]
+ {numCats}<br />
+ <!-- BEGIN totalNumArts_block -->
+ [l]Total Number of Articles:[/l]
+ <!-- END totalNumArts_block -->
+ <!-- BEGIN totalNumArtsCat_block -->
+ [l]Total Number of Articles in this Category:[/l]
+ <!-- END totalNumArtsCat_block -->
+ {numArts}
</div>
<div>
<div class="title_view">
Modified: trunk/views/MainView.php
===================================================================
--- trunk/views/MainView.php 2008-09-19 23:04:59 UTC (rev 687)
+++ trunk/views/MainView.php 2008-09-23 15:39:01 UTC (rev 688)
@@ -51,6 +51,8 @@
$this->tpl->set_block('mostViewedArts_block', 'mostViewedArtsItem_block', 'mostViewedArtsItem');
$this->tpl->set_block('unansweredQuestions_block', 'unansweredQuestionsItem_block', 'unansweredQuestionsItem');
+ $this->tpl->set_block('main', 'totalNumArts_block', 'totalNumArts');
+ $this->tpl->set_block('main', 'totalNumArtsCat_block', 'totalNumArtsCat');
$this->tpl->set_block('main', 'viewAllLink_block', 'viewAllLink');
$this->tpl->set_block('main', 'viewArticlesLink_block', 'viewArticlesLink');
$this->tpl->set_block('main', 'viewBookmarksLink_block', 'viewBookmarksLink');
@@ -124,14 +126,23 @@
$articleGateway = new ArticleGateway;
$categoryGateway = new CategoryGateway;
$this->categories = $categoryGateway->getCategories();
+ $numCats = count($categoryGateway->getSubcategoriesIds($this->categories[$catId]));
if ($catId > 0) {
$path = $this->_getCategoryPath($catId, 'MainView', true);
$this->tpl->set_var('path', $this->user->lang('You are in %s', $path));
+ $this->tpl->parse('totalNumArtsCat', 'totalNumArtsCat_block');
+ $this->tpl->set_var('totalNumArts', '');
+
+ // don't include current cat in the counter
+ $numCats--;
} else {
$this->tpl->set_var('path', '');
+ $this->tpl->parse('totalNumArts', 'totalNumArts_block');
+ $this->tpl->set_var('totalNumArtsCat', '');
}
$this->tpl->set_var(array(
'categories' => $this->_getCategoriesHTML($this->categories[$catId]->getChildren(), 'MainView'),
+ 'numCats' => $numCats,
));
// ** ARTICLES LIST **
@@ -144,6 +155,7 @@
$this->user->getPreference('articlesPerPage'),
isset($_GET['set'])? $_GET['set'] : 'all',
isset($_GET['sort'])? $_GET['sort'] : false);
+ $this->tpl->set_var('numArts', $articles->getNumItems());
$firstIteration = true;
while ($article = $articles->fetch()) {
unset($this->tPath);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|