[pLog-svn] r628 - in plog/trunk/class/summary: dao view

oscar at devel.plogworld.net oscar at devel.plogworld.net
Thu Dec 30 16:34:14 GMT 2004


Author: oscar
Date: 2004-12-30 16:34:14 +0000 (Thu, 30 Dec 2004)
New Revision: 628

Modified:
   plog/trunk/class/summary/dao/summarystats.class.php
   plog/trunk/class/summary/view/summarybloglistview.class.php
   plog/trunk/class/summary/view/summaryuserlistview.class.php
Log:
fixed a problem with the list of blog in the site, and added a new constant called SUMMARY_DEFAULT_ITEMS_PER_PAGE that will be used whenever the value of the config key "summary_blogs_per_page" is empty, as the maximum amount of blogs to show

Modified: plog/trunk/class/summary/dao/summarystats.class.php
===================================================================
--- plog/trunk/class/summary/dao/summarystats.class.php	2004-12-30 16:33:13 UTC (rev 627)
+++ plog/trunk/class/summary/dao/summarystats.class.php	2004-12-30 16:34:14 UTC (rev 628)
@@ -4,9 +4,12 @@
     include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" );
     include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
 	include_once( PLOG_CLASS_PATH."class/dao/users.class.php" );
+	
+	/**
+	 * maximum number of items that will be shown per page in the summary
+	 */
+	define( "SUMMARY_DEFAULT_ITEMS_PER_PAGE", 15 );
 
-    define( "SUMMARY_MAX_CACHE_SECS", 60 * 60 );
-
     /**
      * implements some general methods that return some statistical
      * data that is used in the summary.php script, and that is not

Modified: plog/trunk/class/summary/view/summarybloglistview.class.php
===================================================================
--- plog/trunk/class/summary/view/summarybloglistview.class.php	2004-12-30 16:33:13 UTC (rev 627)
+++ plog/trunk/class/summary/view/summarybloglistview.class.php	2004-12-30 16:34:14 UTC (rev 628)
@@ -1,60 +1,61 @@
-<?php
-
-	include_once( PLOG_CLASS_PATH."class/summary/view/summarycachedview.class.php" );
-    include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
-    include_once( PLOG_CLASS_PATH."class/data/pager/pager.class.php" );
-    include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
-	
-	/**
-	 * shows a paged list of blogs
-	 */
-	class SummaryBlogListView extends SummaryCachedView
-	{
-		var $_numBlogs;
-		var $_numBlogsPerPage;
-	
-		function SummaryBlogListView()
-		{
-			// get the page
-			$this->_page = $this->getCurrentPageFromRequest();
-			
-			$this->SummaryCachedView( "blogslist",  Array( "summary" => "BlogList", "page" => $this->_page ) );
-			
-			// items per page
-            //$this->_numUsers = $this->_config->getValue( "summary_page_show_max" );
-            $config =& Config::getConfig();
-			$this->_numBlogsPerPage = $config->getValue( "summary_blogs_per_page", SUMMARY_DEFAULT_BLOGS_PER_PAGE );
-		}
-		
-		function render()
-		{
-			// do nothing if the contents of our view are cached
-			if( $this->isCached()) {
-				parent::render();
-				return true;
-			}
-			
-			// get the data itself
-			$blogs = new Blogs();
-            $siteBlogs = $blogs->getAllBlogs( BLOG_STATUS_ACTIVE, $this->_page, $this->_numBlogsPerPage );
-			$numBlogs = $blogs->getNumBlogs( BLOG_STATUS_ACTIVE );
-			
-            if( !$siteBlogs ) {
-                // if there was an error, show the error view
-				$siteBlogs = Array();
-            }
-			
-			// calculate the links to the different pages
-			$pager = new Pager( "?op=BlogList&amp;page=",
-			                    $this->_page, 
-								$numBlogs, 
-								$this->_numBlogsPerPage );
-
-			$this->setValue( "blogs", $siteBlogs );
-			$this->setValue( "pager", $pager );
-		
-			// let the parent view do its job
-			parent::render();
-		}
-	}
+<?php
+
+	include_once( PLOG_CLASS_PATH."class/summary/view/summarycachedview.class.php" );
+    include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
+    include_once( PLOG_CLASS_PATH."class/data/pager/pager.class.php" );
+    include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
+	include_once( PLOG_CLASS_PATH."class/summary/dao/summarystats.class.php" );
+	
+	/**
+	 * shows a paged list of blogs
+	 */
+	class SummaryBlogListView extends SummaryCachedView
+	{
+		var $_numBlogs;
+		var $_numBlogsPerPage;
+	
+		function SummaryBlogListView()
+		{
+			// get the page
+			$this->_page = $this->getCurrentPageFromRequest();
+			
+			$this->SummaryCachedView( "blogslist",  Array( "summary" => "BlogList", "page" => $this->_page ) );
+			
+			// items per page
+            //$this->_numUsers = $this->_config->getValue( "summary_page_show_max" );
+            $config =& Config::getConfig();
+			$this->_numBlogsPerPage = $config->getValue( "summary_blogs_per_page", SUMMARY_DEFAULT_ITEMS_PER_PAGE );
+		}
+		
+		function render()
+		{
+			// do nothing if the contents of our view are cached
+			if( $this->isCached()) {
+				parent::render();
+				return true;
+			}
+			
+			// get the data itself
+			$blogs = new Blogs();
+            $siteBlogs = $blogs->getAllBlogs( BLOG_STATUS_ACTIVE, $this->_page, $this->_numBlogsPerPage );
+			$numBlogs = $blogs->getNumBlogs( BLOG_STATUS_ACTIVE );
+			
+            if( !$siteBlogs ) {
+                // if there was an error, show the error view
+				$siteBlogs = Array();
+            }
+			
+			// calculate the links to the different pages
+			$pager = new Pager( "?op=BlogList&amp;page=",
+			                    $this->_page, 
+								$numBlogs, 
+								$this->_numBlogsPerPage );
+
+			$this->setValue( "blogs", $siteBlogs );
+			$this->setValue( "pager", $pager );
+		
+			// let the parent view do its job
+			parent::render();
+		}
+	}
 ?>
\ No newline at end of file

Modified: plog/trunk/class/summary/view/summaryuserlistview.class.php
===================================================================
--- plog/trunk/class/summary/view/summaryuserlistview.class.php	2004-12-30 16:33:13 UTC (rev 627)
+++ plog/trunk/class/summary/view/summaryuserlistview.class.php	2004-12-30 16:34:14 UTC (rev 628)
@@ -24,7 +24,7 @@
 			
 			// items per page
             $config =& Config::getConfig();
-			$this->_numUsersPerPage = $config->getValue( "summary_blogs_per_page", SUMMARY_DEFAULT_BLOGS_PER_PAGE );
+			$this->_numUsersPerPage = $config->getValue( "summary_blogs_per_page", SUMMARY_DEFAULT_ITEMS_PER_PAGE );
 
 		}
 		




More information about the pLog-svn mailing list