[pLog-svn] r2498 - plog/trunk/class/summary/dao

oscar at devel.plogworld.net oscar at devel.plogworld.net
Tue Sep 20 18:40:44 GMT 2005


Author: oscar
Date: 2005-09-20 18:40:44 +0000 (Tue, 20 Sep 2005)
New Revision: 2498

Modified:
   plog/trunk/class/summary/dao/summarystats.class.php
Log:
the summary is working again


Modified: plog/trunk/class/summary/dao/summarystats.class.php
===================================================================
--- plog/trunk/class/summary/dao/summarystats.class.php	2005-09-20 18:20:52 UTC (rev 2497)
+++ plog/trunk/class/summary/dao/summarystats.class.php	2005-09-20 18:40:44 UTC (rev 2498)
@@ -29,12 +29,9 @@
         function SummaryStats()
         {
             // initialize ADOdb
+			include_once( 'class/data/timestamp.class.php' );
             $this->Model();
             
-            // common object for all methods so that we can reuse caches
-            $this->articles = new Articles();
-            $this->blogs = new Blogs();            
-            
             // calculate the date limits
             $t = new Timestamp();
             $this->_now = $t->getTimestamp(); 
@@ -54,6 +51,7 @@
         function getMostCommentedArticles( $maxPosts = 0, $ignoreTopic = "", $ignoreText = "" )
         {
             include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" );
+			$articles = new Articles();
 
 			$prefix = $this->getPrefix();
 			$query = " SELECT COUNT(*) as total_comments, a.* 
@@ -81,7 +79,7 @@
 
             $posts = Array();
             while( $row = $result->FetchRow()) {
-            	array_push( $posts, $this->articles->_fillArticleInformation($row));
+            	array_push( $posts, $articles->mapRow($row));
             }
             
             $result->Close();
@@ -101,6 +99,7 @@
         function getMostReadArticles( $maxPosts = 0, $ignoreTopic = "", $ignoreText = "" )
         {
              include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" );
+			 $articles = new Articles();
 
              $query = " SELECT 
                  a.id as id, 
@@ -127,7 +126,7 @@
 
             $posts = Array();
             while( $row = $result->FetchRow()) {
-				$post = $this->articles->_fillArticleInformation($row);
+				$post = $articles->mapRow($row);
             	array_push( $posts, $post );
             }
             
@@ -145,6 +144,7 @@
          */
          function getRecentBlogs($maxBlogs = 0)
          {
+			include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
          	$query = "SELECT * FROM ".$this->getPrefix()."blogs WHERE status = ".BLOG_STATUS_ACTIVE." 
                           ORDER BY id DESC";
 
@@ -158,8 +158,9 @@
             }
 
             $blogs = Array();
+			$blogsDao = new Blogs();
             while( $row = $result->FetchRow()) {
-            	$blog = $this->blogs->_fillBlogInformation( $row );
+            	$blog = $blogsDao->mapRow( $row );
                 $blogs[$blog->getId()] = $blog;
             }
             
@@ -177,6 +178,8 @@
          */
          function getMostActiveBlogs( $maxBlogs = 0 )
          {
+			include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
+		 
 			$prefix = $this->getPrefix();
             $query = "SELECT COUNT(*) as t, SUM((num_reads / (TO_DAYS(NOW()) - TO_DAYS(a.date) + 1)) ) as rank, b.*
                        FROM {$prefix}articles AS a
@@ -195,8 +198,9 @@
             }
 
             $blogs = Array();
+			$blogsDao = new Blogs();
             while( $row = $result->FetchRow()) {
-                $blog = $this->blogs->_fillBlogInformation( $row );
+                $blog = $blogsDao->mapRow( $row );
                 $blogs[$blog->getId()] = $blog;
             }
             
@@ -236,7 +240,7 @@
             $users = Array();
 			$usersDao = new Users();
             while( $row = $result->FetchRow()) {
-            	$user = $usersDao->_fillUserInformation( $row, true );
+            	$user = $usersDao->mapRow( $row  );
                 $users[$user->getId()] = $user;
             }
             
@@ -284,11 +288,12 @@
             $posts = Array();
             $i     = 0;
 
+			$articles = new Articles();
             while( ($row = $result->FetchRow()) && ($i < $maxPosts) ) {
                 if (!in_array($row["blog_id"], $blogs))
                 {
                     $blogs[] = $row["blog_id"];
-                    array_push( $posts, $this->articles->_fillArticleInformation($row) );
+                    array_push( $posts, $articles->mapRow($row) );
                     $i++;
                 }
             }
@@ -329,13 +334,13 @@
 
                 if (empty($maxPosts))
                 {
-                    array_push( $posts, $this->articles->_fillArticleInformation($row));
+                    array_push( $posts, $articles->mapRow($row));
                     $count++;
                 }
                 else if($count <= $maxPosts && empty($ids[$row["blog_id"]]))
                 {
                     $ids[$row["blog_id"]] = true;
-                    array_push( $posts, $this->articles->_fillArticleInformation($row));
+                    array_push( $posts, $articles->mapRow($row));
                     $count++;
                 }
             }




More information about the pLog-svn mailing list