[xoops-cvslog 6354] CVS update: xoops2jp/html/modules/user/class

アーカイブの一覧に戻る

Minahito minah****@users*****
2007年 4月 25日 (水) 18:05:44 JST


Index: xoops2jp/html/modules/user/class/users.php
diff -u xoops2jp/html/modules/user/class/users.php:1.1.2.7.2.1.2.1 xoops2jp/html/modules/user/class/users.php:1.1.2.7.2.1.2.2
--- xoops2jp/html/modules/user/class/users.php:1.1.2.7.2.1.2.1	Wed Apr 25 17:46:33 2007
+++ xoops2jp/html/modules/user/class/users.php	Wed Apr 25 18:05:44 2007
@@ -10,6 +10,9 @@
 	var $Groups = array();
 	var $_mGroupsLoadedFlag = false;
 	
+	var $_mRankLoadedFlag = false;
+	var $mRank;
+	
 	function UserUsersObject()
 	{
 		$this->initVar('uid', XOBJ_DTYPE_INT, 0, true);
@@ -43,8 +46,6 @@
 		$this->initVar('bio', XOBJ_DTYPE_TEXT, '', false);
 		$this->initVar('user_intrest', XOBJ_DTYPE_STRING, '', false, 150);
 		$this->initVar('user_mailok', XOBJ_DTYPE_BOOL, '1', false);
-		
-		$this->updateRank();
 	}
 	
 	function getGroups()
@@ -68,18 +69,30 @@
 		$this->_mGroupsLoadedFlag = true;
 	}
 
-	/**
-	 * Updates the rank value of this user.
-	 */	
-	function updateRank()
-	{
-		$handler =& xoops_getmodulehandler('ranks');
-		$rank =& $handler->get($this->get('rank'));
-		if ($rank == null || ($rank != null && !$rank->get('rank_special'))) {
-			$t_rank = xoops_getrank(0, $this->get('posts'));
-			$this->set('rank', $t_rank['id']);
+	
+	function _loadRank()
+	{
+		if (!$this->_mRankLoadedFlag) {
+			$rank_id = $this->get('rank_id');
+			if ($rank_id != 0) {
+				$t_rank = xoops_getrank(0, $this->get('posts'));
+				$rank_id = $t_rank['id'];
+			}
+			
+			$handler =& xoops_getmodulehandler('ranks');
+			$this->mRank =& $handler->get($this->get('rank'));
+		
+			$this->_mRankLoadedFlag = true;
 		}
 	}
+	
+	function getRank()
+	{
+		if (!$this->_mRankLoadedFlag)
+			$this->_loadRank();
+			
+		return $this->mRank;
+	}
 }
 
 class UserUsersHandler extends XoopsObjectGenericHandler


xoops-cvslog メーリングリストの案内
アーカイブの一覧に戻る