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

Zurück zum Archiv-Index

Minahito minah****@users*****
2006年 1月 17日 (火) 19:36:08 JST


Index: xoops2jp/html/modules/user/class/AbstractEditAction.class.php
diff -u xoops2jp/html/modules/user/class/AbstractEditAction.class.php:1.1.2.1 xoops2jp/html/modules/user/class/AbstractEditAction.class.php:1.1.2.2
--- xoops2jp/html/modules/user/class/AbstractEditAction.class.php:1.1.2.1	Sun Jan  8 23:01:23 2006
+++ xoops2jp/html/modules/user/class/AbstractEditAction.class.php	Tue Jan 17 19:36:08 2006
@@ -1,74 +1,83 @@
 <?php
 
-require_once XOOPS_ROOT_PATH."/modules/user/admin/forms/GroupEditForm.class.php";
-
-class User_AbstractEditAction extends UserAction
+class User_AbstractEditAction extends User_Action
 {
 	var $mObject = null;
 	var $mObjectHandler = null;
-	var $mActionForm=null;
+	var $mActionForm = null;
 
-	function isSecure()
+	function _getId()
 	{
-		return true;
 	}
 
-	function getDefaultView(&$controller,&$xoopsUser)
+	function &_getHandler()
 	{
-		$this->_setupActionForm();
-		$this->_setupObject($controller);
-
-		$this->mActionForm->load($this->mObject);
-
-		return USER_FRAME_VIEW_INPUT;
 	}
-	
-	function execute(&$controller,&$xoopsUser)
-	{
-		$this->_setupActionForm();
-		$this->_setupObject($controller);
-
-		//
-		// If image is no, the data has to continue to keep his value.
-		//
-		$this->mActionForm->load($this->mObject);
 
-		$this->mActionForm->fetch();
-		$this->mActionForm->validate();
-
-		if($this->mActionForm->hasError())
-			return USER_FRAME_VIEW_INPUT;
-			
-		$this->mActionForm->update($this->mObject);
-
-		return $this->mObjectHandler->insert($this->mObject) ? USER_FRAME_VIEW_SUCCESS
-		                                                     : USER_FRAME_VIEW_ERROR;
+	function _setupActionForm()
+	{
 	}
 
-	function _setupObject(&$controller)
+	function _setupObject()
 	{
 		$id = $this->_getId();
 		
-		$this->mObjectHandler =& $this->_getHandler();
+		$this->mObjectHandler = $this->_getHandler();
 		
 		$this->mObject =& $this->mObjectHandler->get($id);
-		if (!is_object($this->mObject)) {
+	
+		if ($this->mObject == null && $this->isEnableCreate()) {
 			$this->mObject =& $this->mObjectHandler->create();
 		}
 	}
-	
-	function &_getHandler()
+
+	function isEnableCreate()
 	{
+		return true;
 	}
-	
-	function _getId()
+
+	function prepare(&$controller, &$xoopsUser)
 	{
+		$this->_setupActionForm();
+		$this->_setupObject();
 	}
+
+	function getDefaultView(&$controller, &$xoopsUser)
+	{
+		if ($this->mObject == null) {
+			return USER_FRAME_VIEW_ERROR;
+		}
 	
-	function _setupActionForm()
+		$this->mActionForm->load($this->mObject);
+	
+		return USER_FRAME_VIEW_INPUT;
+	}
+
+	function execute(&$controller, &$xoopsUser)
 	{
+		if ($this->mObject == null) {
+			return USER_FRAME_VIEW_ERROR;
+		}
+	
+		$this->mActionForm->load($this->mObject);
+		
+		$this->mActionForm->fetch();
+		$this->mActionForm->validate();
+	
+		if($this->mActionForm->hasError()) {
+			return USER_FRAME_VIEW_INPUT;
+		}
+	
+		$this->mActionForm->update($this->mObject);
+		
+		return $this->_doExecute($this->mObject) ? USER_FRAME_VIEW_SUCCESS
+		                                         : USER_FRAME_VIEW_ERROR;
 	}
 
+	function _doExecute()
+	{
+		return $this->mObjectHandler->insert($this->mObject);
+	}
 }
 
-?>
\ No newline at end of file
+?>


xoops-cvslog メーリングリストの案内
Zurück zum Archiv-Index