[pLog-svn] r3222 - in plog/trunk: class/dao class/summary/action
class/summary/view styles templates/summary
mark at devel.lifetype.net
mark at devel.lifetype.net
Mon Apr 10 18:41:11 GMT 2006
Author: mark
Date: 2006-04-10 18:41:10 +0000 (Mon, 10 Apr 2006)
New Revision: 3222
Modified:
plog/trunk/class/dao/blogcategories.class.php
plog/trunk/class/dao/globalarticlecategories.class.php
plog/trunk/class/summary/action/summarydefaultaction.class.php
plog/trunk/class/summary/view/summarybloglistview.class.php
plog/trunk/class/summary/view/summarypostlistview.class.php
plog/trunk/styles/summary.css
plog/trunk/templates/summary/blogslist.template
plog/trunk/templates/summary/index.template
plog/trunk/templates/summary/postslist.template
Log:
Now, we have tagCloud in our summary front page to represent GlobalArticleCategories
I also add two new method to BlogCategories and GlobalArticleCategories to help me get the min/max NumOfCategories...
Modified: plog/trunk/class/dao/blogcategories.class.php
===================================================================
--- plog/trunk/class/dao/blogcategories.class.php 2006-04-10 14:29:38 UTC (rev 3221)
+++ plog/trunk/class/dao/blogcategories.class.php 2006-04-10 18:41:10 UTC (rev 3222)
@@ -126,6 +126,42 @@
return( $this->getNumItems( $this->getPrefix()."blogs", $cond ));
}
+
+ /**
+ * returns the minimal number of blogs in BlogCategory
+ * @return an integer
+ */
+ function getMinNumActiveBlogs()
+ {
+ $query = "SELECT MIN(num_active_blogs) as min FROM ".$this->table;
+
+ $result = $this->Execute( $query );
+
+ if( !$result )
+ return 0;
+
+ $row = $result->FetchRow($result);
+
+ return $row["min"];
+ }
+
+ /**
+ * returns the minimal number of blogs in BlogCategory
+ * @return an integer
+ */
+ function getMaxNumActiveBlogs()
+ {
+ $query = "SELECT MAX(num_active_blogs) as max FROM ".$this->table;
+
+ $result = $this->Execute( $query );
+
+ if( !$result )
+ return 0;
+
+ $row = $result->FetchRow($result);
+
+ return $row["max"];
+ }
/**
* @see Model::getSearchConditions()
Modified: plog/trunk/class/dao/globalarticlecategories.class.php
===================================================================
--- plog/trunk/class/dao/globalarticlecategories.class.php 2006-04-10 14:29:38 UTC (rev 3221)
+++ plog/trunk/class/dao/globalarticlecategories.class.php 2006-04-10 18:41:10 UTC (rev 3222)
@@ -127,8 +127,44 @@
return( $this->getNumItems( $this->getPrefix()."articles", $cond ));
}
+
+ /**
+ * returns the minimal number of articles in GlobalArticleCategory
+ * @return an integer
+ */
+ function getMinNumActiveArticles()
+ {
+ $query = "SELECT MIN(num_active_articles) as min FROM ".$this->table;
+
+ $result = $this->Execute( $query );
+
+ if( !$result )
+ return 0;
+
+ $row = $result->FetchRow($result);
+
+ return $row["min"];
+ }
/**
+ * returns the maximal number of articles in GlobalArticleCategory
+ * @return an integer
+ */
+ function getMaxNumActiveArticles()
+ {
+ $query = "SELECT MAX(num_active_articles) as max FROM ".$this->table;
+
+ $result = $this->Execute( $query );
+
+ if( !$result )
+ return 0;
+
+ $row = $result->FetchRow($result);
+
+ return $row["max"];
+ }
+
+ /**
* @see Model::getSearchConditions()
*/
function getSearchConditions( $searchTerms )
Modified: plog/trunk/class/summary/action/summarydefaultaction.class.php
===================================================================
--- plog/trunk/class/summary/action/summarydefaultaction.class.php 2006-04-10 14:29:38 UTC (rev 3221)
+++ plog/trunk/class/summary/action/summarydefaultaction.class.php 2006-04-10 18:41:10 UTC (rev 3222)
@@ -2,6 +2,7 @@
include_once( PLOG_CLASS_PATH."class/summary/action/summaryaction.class.php" );
include_once( PLOG_CLASS_PATH."class/summary/dao/summarystats.class.php" );
+ include_once( PLOG_CLASS_PATH."class/dao/globalarticlecategories.class.php" );
/**
* This is the one and only default action. It simply fetches all the most recent
@@ -45,6 +46,12 @@
$commentedPosts = $stats->getMostCommentedArticles( $this->_numPosts, $registerTopic, $registerText );
$readestBlogs = $stats->getMostReadArticles( $this->_numPosts, $registerTopic, $registerText );
+ // get all blog category
+ $categories = new GlobalArticleCategories();
+ $globalArticleCategories = $categories->getGlobalArticleCategories();
+ $min = $categories->getMinNumActiveArticles();
+ $max = $categories->getMaxNumActiveArticles();
+ $step = ( $max - $min )/6;
// export all these things to the view
$this->_view->setValue( "posts", $recentPosts );
@@ -52,6 +59,11 @@
$this->_view->setValue( "activeBlogs", $activeBlogs );
$this->_view->setValue( "commentedPosts", $commentedPosts );
$this->_view->setValue( "readestBlogs", $readestBlogs );
+
+ // export the value for global article categories
+ $this->_view->setValue( "globalArticleCategories", $globalArticleCategories );
+ $this->_view->setValue( "min", $min );
+ $this->_view->setValue( "step", $step );
//
// :KLUDGE:
Modified: plog/trunk/class/summary/view/summarybloglistview.class.php
===================================================================
--- plog/trunk/class/summary/view/summarybloglistview.class.php 2006-04-10 14:29:38 UTC (rev 3221)
+++ plog/trunk/class/summary/view/summarybloglistview.class.php 2006-04-10 18:41:10 UTC (rev 3222)
@@ -38,6 +38,9 @@
// get all blog category
$categories = new BlogCategories();
$blogCategories = $categories->getBlogCategories();
+ $min = $categories->getMinNumActiveBlogs();
+ $max = $categories->getMaxNumActiveBlogs();
+ $step = ( $max - $min )/6;
// get current blogCategory
$blogCategoryId = $this->_params->getValue( "blogCategoryId" );
@@ -64,7 +67,9 @@
$this->setValue( "blogs", $siteBlogs );
$this->setValue( "pager", $pager );
$this->setValue( "blogCategories", $blogCategories );
- $this->setValue( "currentBlogCategory", $currentBlogCategory);
+ $this->setValue( "currentBlogCategory", $currentBlogCategory);
+ $this->setValue( "min", $min );
+ $this->setValue( "step", $step );
// let the parent view do its job
parent::render();
Modified: plog/trunk/class/summary/view/summarypostlistview.class.php
===================================================================
--- plog/trunk/class/summary/view/summarypostlistview.class.php 2006-04-10 14:29:38 UTC (rev 3221)
+++ plog/trunk/class/summary/view/summarypostlistview.class.php 2006-04-10 18:41:10 UTC (rev 3222)
@@ -36,6 +36,9 @@
// get all blog category
$categories = new GlobalArticleCategories();
$globalArticleCategories = $categories->getGlobalArticleCategories();
+ $min = $categories->getMinNumActiveArticles();
+ $max = $categories->getMaxNumActiveArticles();
+ $step = ( $max - $min )/6;
// get current globalArticleCategoryId
$globalArticleCategoryId = $this->_params->getValue( "globalArticleCategoryId" );
@@ -45,7 +48,7 @@
$globalArticleCategoryId = ALL_GLOBAL_ARTICLE_CATEGORIES;
// get the data itself
- $stats = new SummaryStats();
+ $stats = new SummaryStats();
$posts = $stats->getRecentPostsByGlobalCategory( $globalArticleCategoryId, "", "", $this->_page, $this->_numArticlesPerPage );
$numPosts = $stats->getNumRecentPostsByGlobalCategory( $globalArticleCategoryId, "", "" );
@@ -65,7 +68,9 @@
$this->setValue( "pager", $pager );
$this->setValue( "globalArticleCategories", $globalArticleCategories );
$this->setValue( "currentGlobalArticleCategory", $currentGlobalArticleCategory);
-
+ $this->setValue( "min", $min );
+ $this->setValue( "step", $step );
+
// let the parent view do its job
parent::render();
}
Modified: plog/trunk/styles/summary.css
===================================================================
--- plog/trunk/styles/summary.css 2006-04-10 14:29:38 UTC (rev 3221)
+++ plog/trunk/styles/summary.css 2006-04-10 18:41:10 UTC (rev 3222)
@@ -750,6 +750,19 @@
border: 1px solid #DEDEDE;
}
+.tag {
+ margin-right: 5px;
+}
+.tag a {
+ text-decoration: none;
+ color: #000000;
+}
+
+.tag a:hover {
+ background : #818181;
+ color : #FFFFFF;
+}
+
.itemList {
list-style: none;
margin-left: 1em;
Modified: plog/trunk/templates/summary/blogslist.template
===================================================================
--- plog/trunk/templates/summary/blogslist.template 2006-04-10 14:29:38 UTC (rev 3221)
+++ plog/trunk/templates/summary/blogslist.template 2006-04-10 18:41:10 UTC (rev 3222)
@@ -2,7 +2,8 @@
<div id="onecolumn">
<div id="intro">
{foreach from=$blogCategories item=blogCategory}
- <a href="?op=BlogList&blogCategoryId={$blogCategory->getId()}">{$blogCategory->getName()}</a>
+ {math assign=fontSize equation="(int)((x-y)/step)+12" x=$blogCategory->getNumActiveBlogs() y=$min step=$step}
+ <span class="tag"><a style="font-size: {$fontSize}px" href="?op=BlogList&blogCategoryId={$blogCategory->getId()}">{$blogCategory->getName()}</a></span>
{/foreach}
</div>
{if empty($currentBlogCategory)}
@@ -30,8 +31,7 @@
<div class="bloginfo">
{$locale->tr("users")}
{assign var=blogUsers value=$blog->getUsersInfo()}
- <a
- href="?op=UserProfile&userId={$owner->getId()}">{$owner->getUsername()|strip_tags}</a>{if $blogUsers},{/if}
+ <a href="?op=UserProfile&userId={$owner->getId()}">{$owner->getUsername()|strip_tags}</a>{if $blogUsers},{/if}
{foreach from=$blogUsers item=blogUser name=blogUsersLoop}
<a href="?op=UserProfile&userId={$blogUser->getId()}">{$blogUser->getUsername()}</a>{if !$smarty.foreach.blogUsersLoop.last}, {/if}
{/foreach}
Modified: plog/trunk/templates/summary/index.template
===================================================================
--- plog/trunk/templates/summary/index.template 2006-04-10 14:29:38 UTC (rev 3221)
+++ plog/trunk/templates/summary/index.template 2006-04-10 18:41:10 UTC (rev 3222)
@@ -42,6 +42,13 @@
templates/summary, that is where all template files that make up this page are stored. You are
free to change them in any way you like.
</div>
+ <br/>
+ <div id="intro">
+ {foreach from=$globalArticleCategories item=globalArticleCategory}
+ {math assign=fontSize equation="(int)((x-y)/step)+12" x=$globalArticleCategory->getNumActiveArticles() y=$min step=$step}
+ <span class="tag"><a style="font-size: {$fontSize}px" href="?op=PostList&globalArticleCategoryId={$globalArticleCategory->getId()}">{$globalArticleCategory->getName()}</a></span>
+ {/foreach}
+ </div>
{include file="summary/recent.template"}
</div>
Modified: plog/trunk/templates/summary/postslist.template
===================================================================
--- plog/trunk/templates/summary/postslist.template 2006-04-10 14:29:38 UTC (rev 3221)
+++ plog/trunk/templates/summary/postslist.template 2006-04-10 18:41:10 UTC (rev 3222)
@@ -2,7 +2,8 @@
<div id="onecolumn">
<div id="intro">
{foreach from=$globalArticleCategories item=globalArticleCategory}
- <a href="?op=PostList&globalArticleCategoryId={$globalArticleCategory->getId()}">{$globalArticleCategory->getName()}</a>
+ {math assign=fontSize equation="(int)((x-y)/step)+12" x=$globalArticleCategory->getNumActiveArticles() y=$min step=$step}
+ <span class="tag"><a style="font-size: {$fontSize}px" href="?op=PostList&globalArticleCategoryId={$globalArticleCategory->getId()}">{$globalArticleCategory->getName()}</a></span>
{/foreach}
</div>
{if empty($currentGlobalArticleCategory)}
More information about the pLog-svn
mailing list