[pLog-svn] r5989 - plog/branches/lifetype-1.2/class/dao
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Mon Oct 15 17:10:50 EDT 2007
Author: oscar
Date: 2007-10-15 17:10:50 -0400 (Mon, 15 Oct 2007)
New Revision: 5989
Modified:
plog/branches/lifetype-1.2/class/dao/articlecategories.class.php
Log:
Fixed issue http://bugs.lifetype.net/view.php?id=1409 -- Category sorting was not working at all, because getNumBlogCategories() was calling getBlogCategories with the default value BLOG_CATEGORIES_DEFAULT_ORDER, data was being saved in the cache and subsequents calls to getBlogCategories() would return the correct data but in the wrong order. I've rewritten getBlogNumCategories() to avoid the cache, which is as best as I can think of right now.
Modified: plog/branches/lifetype-1.2/class/dao/articlecategories.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/dao/articlecategories.class.php 2007-10-15 20:34:49 UTC (rev 5988)
+++ plog/branches/lifetype-1.2/class/dao/articlecategories.class.php 2007-10-15 21:10:50 UTC (rev 5989)
@@ -160,8 +160,6 @@
break;
}
-// print_r($sorting);
-
$categories = $this->getMany( "blog_id",
$blogId,
CACHE_ARTICLE_CATEGORIES_BLOG,
@@ -360,7 +358,17 @@
*/
function getBlogNumCategories( $blogId, $includeHidden = false, $searchTerms = "" )
{
- return(count($this->getBlogCategories( $blogId, !$includeHidden, BLOG_CATEGORIES_DEFAULT_ORDER, $searchTerms )));
+ $conds = Array();
+ if( !$includeHidden )
+ $conds[] = "in_main_page = 1";
+ if( $searchTerms != "" )
+ $conds[] = "(".$this->getSearchConditions( $searchTerms ).")";
+
+ $conds[] = "blog_id = '".Db::qstr( $blogId )."'";
+
+ $cond = implode( " AND ", $conds );
+
+ return( $this->getNumItems( $this->table, $cond ));
}
}
?>
\ No newline at end of file
More information about the pLog-svn
mailing list