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

oscar at devel.lifetype.net oscar at devel.lifetype.net
Tue Sep 19 12:07:56 GMT 2006


Author: oscar
Date: 2006-09-19 12:07:54 +0000 (Tue, 19 Sep 2006)
New Revision: 3994

Modified:
   plog/trunk/class/dao/userpermission.class.php
Log:
some changes for the new permission framework


Modified: plog/trunk/class/dao/userpermission.class.php
===================================================================
--- plog/trunk/class/dao/userpermission.class.php	2006-09-19 11:47:45 UTC (rev 3993)
+++ plog/trunk/class/dao/userpermission.class.php	2006-09-19 12:07:54 UTC (rev 3994)
@@ -14,6 +14,7 @@
         var $_blogId;
         var $_permId;
         var $_id;
+        var $_perm;
 
     	function UserPermission( $userId, $blogId, $permId, $id = -1 )
         {
@@ -22,6 +23,7 @@
             $this->_blogId = $blogId;
             $this->_permId = $permId;
             $this->_id     = $id;
+            $this->_perm   = null;
 			
 			$this->_pk = "id";
 			$this->_fields = Array (
@@ -50,16 +52,51 @@
 		{
 			$this->_blogId = $blogId;
 		}
+		
+		function getBlogInfo()
+		{
+			if( $this->_blog === null ) {
+				include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
+				$blogs = new Blogs();
+				$this->_blog = $blogs->getBlogInfo( $this->getBlogId());
+			}
+			
+			return( $this->_blog );	
+		}
 
         function getPermissionId()
         {
         	return $this->_permId;
         }
 		
-		function setPermissionId( $permId ) 
+		function setPermission( $perm )
 		{
-			$this->_permId = $permId;
+			$this->_perm = $perm;
+			$this->_permId = $perm->getId();			
 		}
+		
+		function getPermission()
+		{
+			if( $this->_perm === null ) {
+				include_once( PLOG_CLASS_PATH."class/dao/permissions.class.php" );
+				$perms = new Permissions();	
+				$this->_perm = $perms->getPermission( $this->_permId );
+			}
+			
+			return( $this->_perm );
+		}
+		
+		function getPermissionName()
+		{
+			$perm = $this->getPermission();
+			return( $perm->getName());	
+		}
+		
+		function getPermissionDescription()
+		{
+			$perm = $this->getPermission();
+			return( $perm->getDescription());					
+		}
 
         function getUserId()
         {
@@ -70,5 +107,16 @@
 		{
 			$this->_userId = $userId;
 		}
+		
+		function getUserInfo()
+		{
+			if( $this->_user === null ) {
+				include_once( PLOG_CLASS_PATH."class/dao/users.class.php" );
+				$users = new Users();
+				$this->_user = $users->getUserInfo( $this->getBlogId());
+			}
+			
+			return( $this->_user );				
+		}
     }
 ?>



More information about the pLog-svn mailing list