From af75450611cae1a24e76cc8162c40c5e9c30e88f Mon Sep 17 00:00:00 2001 From: BJRambo Date: Thu, 12 May 2016 17:23:34 +0900 Subject: [PATCH] add trash module config --- modules/trash/conf/module.xml | 2 ++ modules/trash/tpl/config.html | 1 + modules/trash/trash.admin.controller.php | 17 +++++++++++++++++ modules/trash/trash.admin.view.php | 9 +++++++++ modules/trash/trash.model.php | 24 ++++++++++++++++++++++++ 5 files changed, 53 insertions(+) create mode 100644 modules/trash/tpl/config.html diff --git a/modules/trash/conf/module.xml b/modules/trash/conf/module.xml index 5ffec0ed9..2f1dd69a2 100644 --- a/modules/trash/conf/module.xml +++ b/modules/trash/conf/module.xml @@ -7,10 +7,12 @@ + + diff --git a/modules/trash/tpl/config.html b/modules/trash/tpl/config.html new file mode 100644 index 000000000..51187a017 --- /dev/null +++ b/modules/trash/tpl/config.html @@ -0,0 +1 @@ + diff --git a/modules/trash/trash.admin.controller.php b/modules/trash/trash.admin.controller.php index ea37bf41d..9789e3e65 100644 --- a/modules/trash/trash.admin.controller.php +++ b/modules/trash/trash.admin.controller.php @@ -226,6 +226,23 @@ class trashAdminController extends trash return true; } + + /** + * set trash module config + * @return void|Object + */ + function procTrashAdminConfig() + { + $oTrashModel = getModel('trash'); + $config = $oTrashModel->getConfig(); + + $obj = Context::getRequestVars(); + + $this->setMessage('success_updated'); + + $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispTrashAdminConfig'); + $this->setRedirectUrl($returnUrl); + } } /* End of file trash.admin.controller.php */ /* Location: ./modules/trash/trash.admin.controller.php */ diff --git a/modules/trash/trash.admin.view.php b/modules/trash/trash.admin.view.php index a3c6e561d..c5b2e8f3a 100644 --- a/modules/trash/trash.admin.view.php +++ b/modules/trash/trash.admin.view.php @@ -111,6 +111,15 @@ class trashAdminView extends trash $this->setTemplateFile('trash_view'); } + function dispTrashAdminConfig() + { + $oTrashModel = getModel('trash'); + $config = $oTrashModel->getConfig(); + + Context::set('config', $config); + + $this->setTemplateFile('config'); + } } /* End of file trash.admin.view.php */ /* Location: ./modules/trash/trash.admin.view.php */ diff --git a/modules/trash/trash.model.php b/modules/trash/trash.model.php index c56a59349..089eddd84 100644 --- a/modules/trash/trash.model.php +++ b/modules/trash/trash.model.php @@ -10,6 +10,30 @@ */ class trashModel extends trash { + private static $config = NULL; + + /** + * get Tresh Module Config + * + * @return trash config + */ + function getConfig() + { + if(self::$config === NULL) + { + $oModuleModel = getModel('module'); + $config = $oModuleModel->getModuleConfig('trash'); + if(!$config) + { + $config = new stdClass(); + } + + self::$config = $config; + } + + return self::$config; + } + /** * Get one trash object * @param int $trashSrl