[xoops-cvslog 1261] CVS update: xoops2jp/html/modules/base/admin/actions

Zurück zum Archiv-Index

Minahito minah****@users*****
2005年 12月 1日 (木) 14:17:07 JST


Index: xoops2jp/html/modules/base/admin/actions/LegacyModuleListAction.class.php
diff -u xoops2jp/html/modules/base/admin/actions/LegacyModuleListAction.class.php:1.1.2.1 xoops2jp/html/modules/base/admin/actions/LegacyModuleListAction.class.php:1.1.2.2
--- xoops2jp/html/modules/base/admin/actions/LegacyModuleListAction.class.php:1.1.2.1	Thu Dec  1 01:17:37 2005
+++ xoops2jp/html/modules/base/admin/actions/LegacyModuleListAction.class.php	Thu Dec  1 14:17:07 2005
@@ -1,15 +1,17 @@
 <?php
 /**
- * @version $Id: LegacyModuleListAction.class.php,v 1.1.2.1 2005/11/30 16:17:37 minahito Exp $
+ * @version $Id: LegacyModuleListAction.class.php,v 1.1.2.2 2005/12/01 05:17:07 minahito Exp $
  */
 
-require_once XOOPS_ROOT_PATH."/modules/base/admin/forms/ModuleListFilterForm.class.php";
+require_once XOOPS_BASE_PATH."/admin/forms/ModuleListFilterForm.class.php";
+require_once XOOPS_BASE_PATH."/admin/forms/ModuleSettingsForm.class.php";
 
 class LegacyModuleListAction extends LegacyAdminAction
 {
 	var $mDB=null;
-	var $mModuleObjects=null;
-	var $mFilter;
+	var $mModuleObjects=array();
+	var $mFilter=null;
+	var $mForm=null;
 
 	function prepare(&$controller,&$xoopsUser)
 	{
@@ -35,8 +37,78 @@
 	
 	function execute(&$controller,&$xoopsUser)
 	{
+		$moduleHandler=&xoops_gethandler('module');
+		$objests=$moduleHandler->getObjects();
+
+		$this->mForm=new ModuleSettingsForm();
+		$this->mForm->prepare();
+		
+		$this->mForm->fetch();
+		$this->mForm->validate();
+
+		if($this->mForm->hasError() || !isset($_POST['dummy_ticket'])) {
+			return $this->_processConfirm($controller,$xoopsUser);
+		}
+		else {
+			return $this->_processSave($controller,$xoopsUser);
+		}
+
 	}
 	
+	function _processConfirm(&$controller,&$xoopsUser)
+	{
+		$moduleHandler=&xoops_gethandler('module');
+		$objests=$moduleHandler->getObjects();
+
+		//
+		// Do mapping.
+		//
+		foreach($objests as $modObject) {
+			$this->mModuleObjects[$modObject->getVar('mid')]=&$modObject;
+			unset($modObject);
+		}
+
+		return LEGACY_ADMIN_FRAME_VIEW_INPUT;
+	}
+
+	function _processSave(&$controller,&$xoopsUser)
+	{
+		$moduleHandler=&xoops_gethandler('module');
+		$objects=$moduleHandler->getObjects();
+		
+		$successFlag=true;
+		foreach($objects as $modObject) {
+			$mid=$modObject->getVar('mid');
+			$modObject->setVar('name',$this->mForm->getVar('name',$mid));
+			$modObject->setVar('weight',$this->mForm->getVar('weight',$mid));
+			$modObject->setVar('isactive',$this->mForm->getVar('isactive',$mid));
+
+			//
+			// Store.
+			//
+			$successFlag&=$moduleHandler->insert($modObject);
+		}
+		
+		return $successFlag ? LEGACY_ADMIN_FRAME_VIEW_SUCCESS : LEGACY_ADMIN_FRAME_VIEW_ERROR;
+	}
+
+	/**
+	 * To support a template writer, this send the list of mid that actionForm kept.
+	 */
+	function executeViewInput(&$controller,&$xoopsUser,&$renderer)
+	{
+		$renderer->setTemplateName("legacy_admin_modulelist_confirm.html");
+		$renderer->setAttribute('moduleObjects',$this->mModuleObjects);
+		$renderer->setAttribute('actionForm',$this->mForm);
+		
+		//
+		// To support a template writer, this send the list of mid that
+		// actionForm kept.
+		//
+		$tarray=&$this->mForm->getVar('name');
+		$renderer->setAttribute('mids',array_keys($tarray));
+	}
+
 	function executeViewIndex(&$controller,&$xoopsUser,&$renderer)
 	{
 		$renderer->setTemplateName("legacy_admin_modulelist_index.html");
@@ -51,6 +123,16 @@
 
 		$renderer->setAttribute('moduleObjects',$this->mModuleObjects);
 	}
+
+	function executeViewSuccess(&$controller,&$xoopsUser,&$renderer)
+	{
+		XCube_Utils::redirectHeader('./index.php?action=ModuleList',1,"*SUCCESS*");
+	}
+
+	function executeViewError(&$controller,&$xoopsUser,&$renderer)
+	{
+		XCube_Utils::redirectHeader('./index.php?action=ModuleList',1,"*ERROR*");
+	}
 }
 
 ?>
\ No newline at end of file


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