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

Back to archive index

Minahito minah****@users*****
2006年 7月 13日 (木) 19:54:47 JST


Index: xoops2jp/html/modules/user/class/mailjob.php
diff -u xoops2jp/html/modules/user/class/mailjob.php:1.1.2.5 xoops2jp/html/modules/user/class/mailjob.php:1.1.2.6
--- xoops2jp/html/modules/user/class/mailjob.php:1.1.2.5	Wed May 24 18:43:53 2006
+++ xoops2jp/html/modules/user/class/mailjob.php	Thu Jul 13 19:54:47 2006
@@ -8,6 +8,21 @@
 	var $_mUsersLoadedFlag = false;
 	var $mUserCount = 0;
 	
+	/**
+	 * @var XCube_NewDelegate
+	 */
+	var $mGetReplaceTitle = null;
+
+	/**
+	 * @var XCube_NewDelegate
+	 */
+	var $mGetReplaceBody = null;
+
+	/**
+	 * @var XCube_NewDelegate
+	 */
+	var $mSend = null;
+	
 	function UserMailjobObject()
 	{
 		$this->initVar('mailjob_id', XOBJ_DTYPE_INT, '', false);
@@ -18,6 +33,15 @@
 		$this->initVar('is_pm', XOBJ_DTYPE_BOOL, '0', true);
 		$this->initVar('is_mail', XOBJ_DTYPE_BOOL, '0', true);
 		$this->initVar('create_unixtime', XOBJ_DTYPE_INT, time(), true);
+		
+		$this->mGetReplaceTitle =& new XCube_NewDelegate();
+		$this->mGetReplaceTitle->register('UserMailjobObject.GetReplaceTitle');
+		
+		$this->mGetReplaceBody =& new XCube_NewDelegate();
+		$this->mGetReplaceBody->register('UserMailjobObject.GetReplaceBody');
+		
+		$this->mSend =& new XCube_NewDelegate();
+		$this->mSend->register('UserMailjobObject.Send');
 	}
 
 	/**
@@ -45,8 +69,6 @@
 	{
 		$root =& XCube_Root::getSingleton();
 		
-		$root->mEventManager->add("Module.User.Mailjob.ReplaceBody", new XCube_InstanceDelegate($this, "getReplaceBody"));
-
 		$this->loadUser();
 		$handler =& xoops_getmodulehandler('mailjob_link', 'user');
 
@@ -56,28 +78,32 @@
 			$to_user =& $userHandler->get($link->get('uid'));
 			
 			if (is_object($to_user)) {
-				$eventArgs = array();
-				$eventArgs['from_user'] =& $from_user;
-				$eventArgs['to_user'] =& $to_user;
-				$eventArgs['mailjob'] =& $this;
-			
-				$root->mEventManager->raiseEvent('Module.User.Mailjob.Send', $this, $eventArgs);
+				$this->mSend->call(new XCube_Ref($this), $to_user, $from_user);
 			}
 			
 			$handler->delete($link);
 		}
 	}
 	
-	function getReplaceBody(&$sender, &$eventArgs)
+	function getReplaceTitle(&$to_user, &$from_user)
 	{
+		return $this->get('title');
+	}
+	
+	function getReplaceBody(&$to_user, &$from_user)
+	{
+		$t_body = $this->get('body');
+		
 		//
-		// TODO Replace subject, too. (We wait new delegate class)
-		//
-		$eventArgs['body'] = str_replace('{X_UID}', $eventArgs['to_user']->get('uid'), $eventArgs['body']);
-		$eventArgs['body'] = str_replace('{X_UNAME}', $eventArgs['to_user']->get('uname'), $eventArgs['body']);
-		$eventArgs['body'] = str_replace('{X_UEMAIL}', $eventArgs['to_user']->get('email'), $eventArgs['body']);
-		$eventArgs['body'] = str_replace('{X_UEMAIL}', $eventArgs['to_user']->get('email'), $eventArgs['body']);
 		// TODO {X_UACTLINK}
+		//
+		$t_body = str_replace('{X_UID}', $to_user->get('uid'), $t_body);
+		$t_body = str_replace('{X_UNAME}', $to_user->get('uname'), $t_body);
+		$t_body = str_replace('{X_UEMAIL}', $to_user->get('email'), $t_body);
+
+		$this->mGetReplaceBody->call(new XCube_Ref($t_body), $to_user, $from_user);
+		
+		return $t_body;
 	}
 }
 


xoops-cvslog メーリングリストの案内
Back to archive index