Minahito
minah****@users*****
2006年 2月 2日 (木) 21:00:43 JST
Index: xoops2jp/html/modules/base/admin/actions/ModuleListAction.class.php diff -u xoops2jp/html/modules/base/admin/actions/ModuleListAction.class.php:1.1.2.1 xoops2jp/html/modules/base/admin/actions/ModuleListAction.class.php:1.1.2.2 --- xoops2jp/html/modules/base/admin/actions/ModuleListAction.class.php:1.1.2.1 Thu Jan 26 01:18:51 2006 +++ xoops2jp/html/modules/base/admin/actions/ModuleListAction.class.php Thu Feb 2 21:00:42 2006 @@ -1,92 +1,90 @@ <?php /** - * @version $Id: ModuleListAction.class.php,v 1.1.2.1 2006/01/25 16:18:51 minahito Exp $ + * @version $Id: ModuleListAction.class.php,v 1.1.2.2 2006/02/02 12:00:42 minahito Exp $ */ -require_once XOOPS_BASE_PATH."/admin/forms/ModuleListFilterForm.class.php"; -require_once XOOPS_BASE_PATH."/admin/forms/ModuleSettingsForm.class.php"; +require_once XOOPS_BASE_PATH . "/admin/forms/ModuleListFilterForm.class.php"; +require_once XOOPS_BASE_PATH . "/admin/forms/ModuleSettingsForm.class.php"; class Legacy_ModuleListAction extends Legacy_Action { - var $mDB=null; - var $mModuleObjects=array(); - var $mFilter=null; - var $mForm=null; + var $mDB = null; + var $mModuleObjects = array(); + var $mFilter = null; - function prepare(&$controller,&$xoopsUser) + var $mActionForm = null; + + function prepare(&$controller, &$xoopsUser) { - $this->mDB=&$controller->getDB(); + $this->mDB =& $controller->getDB(); + + $this->mActionForm =& new Legacy_ModuleSettingsForm(); + $this->mActionForm->prepare(); } + - function getDefaultView(&$controller,&$xoopsUser) + function getDefaultView(&$controller, &$xoopsUser) { - $this->mFilter=new ModuleListFilterForm(); + $this->mFilter =& new ModuleListFilterForm(); $this->mFilter->fetch(); - $moduleHandler=&xoops_gethandler('module'); + $moduleHandler =& xoops_gethandler('module'); // dmy - $criteria=new Criteria('mid',0,'>'); + $criteria =& new Criteria('mid',0,'>'); $criteria->setSort($this->mFilter->getSort()); $criteria->setOrder($this->mFilter->getOrder()); - $this->mModuleObjects=&$moduleHandler->getObjects($criteria); + $this->mModuleObjects =& $moduleHandler->getObjects($criteria); return LEGACY_FRAME_VIEW_INDEX; } - function execute(&$controller,&$xoopsUser) + function execute(&$controller, &$xoopsUser) { - $moduleHandler=&xoops_gethandler('module'); - $objests=$moduleHandler->getObjects(); - - $this->mForm=new ModuleSettingsForm(); - $this->mForm->prepare(); - - $this->mForm->fetch(); - $this->mForm->validate(); + $this->mActionForm->fetch(); + $this->mActionForm->validate(); - if($this->mForm->hasError() || !isset($_POST['dummy_ticket'])) { - return $this->_processConfirm($controller,$xoopsUser); + if ($this->mActionForm->hasError()) { + return $this->_processConfirm($controller, $xoopsUser); } else { - return $this->_processSave($controller,$xoopsUser); + return $this->_processSave($controller, $xoopsUser); } - } function _processConfirm(&$controller,&$xoopsUser) { - $moduleHandler=&xoops_gethandler('module'); - $objests=$moduleHandler->getObjects(); + $moduleHandler =& xoops_gethandler('module'); + $objects =& $moduleHandler->getObjects(); // // Do mapping. // - foreach($objests as $modObject) { - $this->mModuleObjects[$modObject->getVar('mid')]=&$modObject; + foreach ($objects as $modObject) { + $this->mModuleObjects[$modObject->get('mid')] =& $modObject; unset($modObject); } return LEGACY_FRAME_VIEW_INPUT; } - function _processSave(&$controller,&$xoopsUser) + function _processSave(&$controller, &$xoopsUser) { - $moduleHandler=&xoops_gethandler('module'); - $objects=$moduleHandler->getObjects(); + $moduleHandler =& xoops_gethandler('module'); + $objects =& $moduleHandler->getObjects(); - $successFlag=true; + $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)); + $mid = $modObject->get('mid'); + $modObject->set('name', $this->mActionForm->get('name', $mid)); + $modObject->set('weight', $this->mActionForm->get('weight', $mid)); + $modObject->set('isactive', $this->mActionForm->get('isactive', $mid)); // // Store. // - $successFlag&=$moduleHandler->insert($modObject); + $successFlag &= $moduleHandler->insert($modObject); } return $successFlag ? LEGACY_FRAME_VIEW_SUCCESS : LEGACY_FRAME_VIEW_ERROR; @@ -95,43 +93,46 @@ /** * To support a template writer, this send the list of mid that actionForm kept. */ - function executeViewInput(&$controller,&$xoopsUser,&$renderer) + function executeViewInput(&$controller, &$xoopsUser, &$render) { - $renderer->setTemplateName("modulelist_confirm.html"); - $renderer->setAttribute('moduleObjects',$this->mModuleObjects); - $renderer->setAttribute('actionForm',$this->mForm); + $render->setTemplateName("module_list_confirm.html"); + $render->setAttribute('moduleObjects', $this->mModuleObjects); + $render->setAttribute('actionForm', $this->mActionForm); // // 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)); + $tarray=&$this->mActionForm->get('name'); + $render->setAttribute('mids', array_keys($tarray)); } - function executeViewIndex(&$controller,&$xoopsUser,&$renderer) + function executeViewIndex(&$controller, &$xoopsUser, &$render) { - $renderer->setTemplateName("module_list.html"); + $render->setTemplateName("module_list.html"); + $render->setAttribute('actionForm', $this->mActionForm); // // Load adminmenu before we assign these to template. // foreach(array_keys($this->mModuleObjects) as $key) { $this->mModuleObjects[$key]->loadAdminMenu(); - $this->mModuleObjects[$key]->loadInfo($this->mModuleObjects[$key]->getVar('dirname')); + $this->mModuleObjects[$key]->loadInfo($this->mModuleObjects[$key]->get('dirname')); } - - $renderer->setAttribute('moduleObjects',$this->mModuleObjects); + $render->setAttribute('moduleObjects', $this->mModuleObjects); } function executeViewSuccess(&$controller,&$xoopsUser,&$renderer) { - XCube_Utils::redirectHeader('./index.php?action=ModuleList',1,"*SUCCESS*"); + $controller->executeForward('./index.php?action=ModuleList'); } - function executeViewError(&$controller,&$xoopsUser,&$renderer) + function executeViewError(&$controller, &$xoopsUser, &$renderer) { - XCube_Utils::redirectHeader('./index.php?action=ModuleList',1,"*ERROR*"); + // + // TODO removed + // + XCube_Utils::redirectHeader('./index.php?action=ModuleList', 1, "*ERROR*"); } }