[pLog-svn] r1141 - plog/trunk/class/dao

subaochen at devel.plogworld.net subaochen at devel.plogworld.net
Sat Feb 19 15:18:32 GMT 2005


Author: subaochen
Date: 2005-02-19 15:18:32 +0000 (Sat, 19 Feb 2005)
New Revision: 1141

Modified:
   plog/trunk/class/dao/articlecategory.class.php
   plog/trunk/class/dao/mylinkscategories.class.php
Log:
1 add last modification field when create articlecategory
2 add function to update last modification, because updateCategory will get the current timestamp, but sometimes we need only update the last modification field. I think function updateLastModification is no harm to others codes, but oscar, please double check this...


Modified: plog/trunk/class/dao/articlecategory.class.php
===================================================================
--- plog/trunk/class/dao/articlecategory.class.php	2005-02-19 13:37:56 UTC (rev 1140)
+++ plog/trunk/class/dao/articlecategory.class.php	2005-02-19 15:18:32 UTC (rev 1141)
@@ -28,18 +28,19 @@
 		var $_description;
 		var $_lastModification;
 
-		function ArticleCategory( $name, $url, $blogId, $inMainPage, $description = "", $numArticles = 0, $properties = Array(), $id = -1 )
+		function ArticleCategory( $name, $url, $blogId, $inMainPage, $description = "", $numArticles = 0, $properties = Array(), $id = -1, $lastModification=null )
 		{
 			$this->DbObject();
 			$this->_name = $name;
             $this->_url = $url;
 			$this->_id = $id;
             $this->_blogId = $blogId;
-		$this->setInMainPage( $inMainPage );
+		    $this->setInMainPage( $inMainPage );
             $this->_numArticles = $numArticles;
 			$this->setProperties( $properties );
 			$this->_parentId = $parentId;
 			$this->_description = $description;
+			$this->_lastModification = new Timestamp($lastModification);
 		}
 
         /**
@@ -209,17 +210,6 @@
 		}
 
 		/**
-		 * sets the last modification date
-		 *
-		 * @param date
-		 * @return nothing
-		 */
-		function setLastModification( $date )
-		{
-			$this->_lastModification = $date;
-		}
-		
-		/**
 		 * returns the last modification date
 		 *
 		 * @return A Timestamp object
@@ -228,5 +218,11 @@
 		{
 			return $this->_lastModification;
 		}
+
+        function setLastModification( $newDate )
+        {
+            $this->_lastModification = $newDate;
+        }
+        
 	}
 ?>

Modified: plog/trunk/class/dao/mylinkscategories.class.php
===================================================================
--- plog/trunk/class/dao/mylinkscategories.class.php	2005-02-19 13:37:56 UTC (rev 1140)
+++ plog/trunk/class/dao/mylinkscategories.class.php	2005-02-19 15:18:32 UTC (rev 1141)
@@ -246,6 +246,20 @@
 			return $result;
 		}
 
+        /**
+         * update last modification field
+         */
+		function updateLastModification( $categoryId , $lastModification)
+		{
+			$query = "UPDATE ".$this->getPrefix()."mylinks_categories
+					  SET last_modification = '".Db::qstr( $lastModification )."' 
+					  WHERE id = '".Db::qstr( $categoryId )."'";
+			$this->_db->debug=false;
+			$result = $this->_db->Execute( $query );
+			
+			return $result;
+		}
+
 		/**
 		 * @private
 		 */




More information about the pLog-svn mailing list