コード例 #1
0
 public function uninstall()
 {
     $aId = I('id', 0, 'intval');
     $aNav = I('remove_nav', 0, 'intval');
     $moduleModel = new ModuleModel();
     $module = $moduleModel->getModuleById($aId);
     if (IS_POST) {
         $aWithoutData = I('withoutData', 1, 'intval');
         //是否保留数据
         $res = $this->moduleModel->uninstall($aId, $aWithoutData);
         if ($res == true) {
             if (file_exists(APP_PATH . '/' . $module['name'] . '/Info/uninstall.php')) {
                 require_once APP_PATH . '/' . $module['name'] . '/Info/uninstall.php';
             }
             if ($aNav) {
                 M('Channel')->where(array('url' => $module['entry']))->delete();
                 S('common_nav', null);
             }
             S('admin_modules', null);
             $this->success(L('_THE_SUCCESS_OF_THE_UNLOADING_MODULE_'), U('lists'));
         } else {
             $this->error(L('_FAILURE_OF_THE_UNLOADING_MODULE_') . $this->moduleModel->error);
         }
     }
     $builder = new AdminConfigBuilder();
     $builder->title($module['alias'] . L('_DASH_') . L('_UNLOADING_MODULE_'));
     $module['remove_nav'] = 1;
     $builder->keyReadOnly('id', L('_MODULE_NUMBER_'));
     $builder->suggest('<span class="text-danger">' . L('_OPERATE_CAUTION_') . '</span>');
     $builder->keyReadOnly('alias', L('_UNINSTALL_MODULE_'));
     $builder->keyBool('withoutData', L('_KEEP_DATA_MODULE_') . '?', L('_DEFAULT_RESERVATION_MODULE_DATA_'))->keyBool('remove_nav', L('_REMOVE_NAVIGATION_'), L('_UNINSTALL_AUTO_UNINSTALL_MENU_', array('link' => U('channel/index'))));
     $module['withoutData'] = 1;
     $builder->data($module);
     $builder->buttonSubmit();
     $builder->buttonBack();
     $builder->display();
 }
コード例 #2
0
 public function uninstall()
 {
     $aId = I('id', 0, 'intval');
     $aNav = I('remove_nav', 0, 'intval');
     $moduleModel = new ModuleModel();
     $module = $moduleModel->getModuleById($aId);
     if (IS_POST) {
         $aWithoutData = I('withoutData', 1, 'intval');
         //是否保留数据
         $res = $this->moduleModel->uninstall($aId, $aWithoutData);
         if ($res == true) {
             if (file_exists(APP_PATH . '/' . $module['name'] . '/Info/uninstall.php')) {
                 require_once APP_PATH . '/' . $module['name'] . '/Info/uninstall.php';
             }
             if ($aNav) {
                 M('Channel')->where(array('url' => $module['entry']))->delete();
                 S('common_nav', null);
             }
             S('admin_modules', null);
             $this->success('卸载模块成功。', U('lists'));
         } else {
             $this->error('卸载模块失败。' . $this->moduleModel->error);
         }
     }
     $builder = new AdminConfigBuilder();
     $builder->title($module['alias'] . '——卸载模块');
     $module['remove_nav'] = 1;
     $builder->keyReadOnly('id', '模块编号');
     $builder->suggest('<span class="text-danger">请谨慎操作,此操作无法还原。</span>');
     $builder->keyReadOnly('alias', '卸载的模块');
     $builder->keyBool('withoutData', '是否保留模块数据?', '默认保留模块数据')->keyBool('remove_nav', '移除导航', '卸载后自动卸载掉对应的菜单,或者<a target="_blank" href="' . U('channel/index') . '">手动设置</a>');
     $module['withoutData'] = 1;
     $builder->data($module);
     $builder->buttonSubmit();
     $builder->buttonBack();
     $builder->display();
 }