[xoops-cvslog 1740] CVS update: xoops2jp/html/modules/legacyRender/admin/class

Back to archive index

Minahito minah****@users*****
2006年 1月 14日 (土) 16:58:54 JST


Index: xoops2jp/html/modules/legacyRender/admin/class/AbstractEditAction.class.php
diff -u /dev/null xoops2jp/html/modules/legacyRender/admin/class/AbstractEditAction.class.php:1.1.2.1
--- /dev/null	Sat Jan 14 16:58:54 2006
+++ xoops2jp/html/modules/legacyRender/admin/class/AbstractEditAction.class.php	Sat Jan 14 16:58:54 2006
@@ -0,0 +1,83 @@
+<?php
+
+class LegacyRender_AbstractEditAction extends LegacyRender_Action
+{
+	var $mObject = null;
+	var $mObjectHandler = null;
+	var $mActionForm = null;
+
+	function _getId()
+	{
+	}
+	
+	function &_getHandler()
+	{
+	}
+	
+	function _setupObject()	
+	{
+		$id = $this->_getId();
+
+		$this->mObjectHandler = $this->_getHandler();
+		
+		$this->mObject =& $this->mObjectHandler->get($id);
+		if ($this->mObject == null && $this->isEnableCreate()) {
+			$this->mObject =& $this->mObjectHandler->create();
+		}
+	}
+
+	function _setupActionForm()
+	{
+	}
+
+	/**
+	 * @return bool
+	 */	
+	function isEnableCreate()
+	{
+		return true;
+	}
+	
+	function prepare(&$controller, &$xoopsUser)
+	{
+		$this->_setupActionForm();
+		$this->_setupObject();
+	}
+
+	function getDefaultView(&$controller,&$xoopsUser)
+	{
+		if ($this->mObject == null) {
+			return LEGACYRENDER_FRAME_VIEW_ERROR;
+		}
+
+		$this->mActionForm->load($this->mObject);
+
+		return LEGACYRENDER_FRAME_VIEW_INPUT;
+	}
+
+	function execute(&$controller,&$xoopsUser)
+	{
+		if ($this->mObject == null) {
+			return LEGACYRENDER_FRAME_VIEW_ERROR;
+		}
+
+		//
+		// 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 LEGACYRENDER_FRAME_VIEW_INPUT;
+		}
+			
+		$this->mActionForm->update($this->mObject);
+
+		return $this->mObjectHandler->insert($this->mObject) ? LEGACYRENDER_FRAME_VIEW_SUCCESS
+		                                                     : LEGACYRENDER_FRAME_VIEW_ERROR;
+	}
+}
+
+?>
\ No newline at end of file


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