diff --git a/modules/addon/addon.controller.php b/modules/addon/addon.controller.php index 6ac36813b..b02884759 100644 --- a/modules/addon/addon.controller.php +++ b/modules/addon/addon.controller.php @@ -17,8 +17,19 @@ * @brief 애드온의 활성/비활성 체인지 **/ function procToggleActivateAddon() { + // addon값을 받아옴 $addon = Context::get('addon'); + if($addon) { + $oAddonModel = &getModel('addon'); + // 활성화 되어 있으면 비활성화 시킴 + if($oAddonModel->isActivatedAddon($addon)) $this->doDeactivate($addon); + + // 비활성화 되어 있으면 활성화 시킴 + else $this->doActivate($addon); + } + + // 페이지를 애드온 목록으로 이동 $this->setRedirectUrl("./?module=admin&act=dispAddonList"); } diff --git a/modules/addon/addon.model.php b/modules/addon/addon.model.php index e68b3a69c..fe6ac6ea3 100644 --- a/modules/addon/addon.model.php +++ b/modules/addon/addon.model.php @@ -119,6 +119,7 @@ $args->list_order = 'addon'; $output = $oDB->executeQuery('addon.getAddons', $args); if(!$output->data) return array(); + if(!is_array($output->data)) $output->data = array($output->data); $activated_count = count($output->data); for($i=0;$i<$activated_count;$i++) { @@ -128,5 +129,17 @@ return $addon_list; } + /** + * @brief 애드온이 활성화 되어 있는지 체크 + **/ + function isActivatedAddon($addon) { + $oDB = &DB::getInstance(); + $args->addon = $addon; + $output = $oDB->executeQuery('addon.getAddonIsActivated', $args); + if($output->data->count>0) return true; + return false; + } + + } ?> diff --git a/modules/addon/conf/module.xml b/modules/addon/conf/module.xml index 7770852a2..000a88e93 100644 --- a/modules/addon/conf/module.xml +++ b/modules/addon/conf/module.xml @@ -1,6 +1,6 @@ - + diff --git a/modules/addon/queries/getAddonIsActivated.xml b/modules/addon/queries/getAddonIsActivated.xml new file mode 100644 index 000000000..63c925c4f --- /dev/null +++ b/modules/addon/queries/getAddonIsActivated.xml @@ -0,0 +1,11 @@ + + + + + + + + + + +