73 public $mUninstallSuccess =
null;
79 public $mUninstallFail =
null;
85 public $mXoopsModule =
null;
91 public $mInstaller =
null;
97 public $mActionForm =
null;
99 public function __construct($flag)
101 parent::__construct($flag);
104 $this->mUninstallSuccess->register(
'Legacy_ModuleUninstallAction.UninstallSuccess');
107 $this->mUninstallFail->register(
'Legacy_ModuleUninstallAction.UninstallFail');
110 public function prepare(&$controller, &$xoopsUser)
112 $dirname = $controller->mRoot->mContext->mRequest->getRequest(
'dirname');
114 $handler =& xoops_gethandler(
'module');
115 $this->mXoopsModule =& $handler->getByDirname($dirname);
117 if (!(is_object($this->mXoopsModule) && 0 == $this->mXoopsModule->get(
'isactive'))) {
120 $this->mXoopsModule->loadInfoAsVar($dirname);
122 $this->_setupActionForm();
124 $this->mInstaller =& $this->_getInstaller();
129 $this->mInstaller->setCurrentXoopsModule($this->mXoopsModule);
134 public function &_getInstaller()
136 $dirname = $this->mXoopsModule->get(
'dirname');
141 public function _setupActionForm()
144 $this->mActionForm->prepare();
147 public function getDefaultView(&$controller, &$xoopsUser)
149 $this->mActionForm->load($this->mXoopsModule);
151 return LEGACY_FRAME_VIEW_INPUT;
154 public function execute(&$controller, &$xoopsUser)
156 if (isset($_REQUEST[
'_form_control_cancel'])) {
157 return LEGACY_FRAME_VIEW_CANCEL;
160 $this->mActionForm->fetch();
161 $this->mActionForm->validate();
163 if ($this->mActionForm->hasError()) {
164 return $this->getDefaultView($controller, $xoopsUser);
167 $this->mInstaller->setForceMode($this->mActionForm->get(
'force'));
168 $this->mInstaller->executeUninstall();
170 return LEGACY_FRAME_VIEW_SUCCESS;
173 public function executeViewSuccess(&$controller, &$xoopsUser, &$renderer)
175 if (!$this->mInstaller->mLog->hasError()) {
176 $this->mUninstallSuccess->call(
new XCube_Ref($this->mXoopsModule),
new XCube_Ref($this->mInstaller->mLog));
177 XCube_DelegateUtils::call(
'Legacy.Admin.Event.ModuleUninstall.' . ucfirst($this->mXoopsModule->get(
'dirname') .
'.Success'),
new XCube_Ref($this->mXoopsModule),
new XCube_Ref($this->mInstaller->mLog));
178 XCube_DelegateUtils::call(
'Legacy.Admin.Event.ModuleUninstall.Success',
new XCube_Ref($this->mXoopsModule),
new XCube_Ref($this->mInstaller->mLog));
180 $this->mUninstallFail->call(
new XCube_Ref($this->mXoopsModule),
new XCube_Ref($this->mInstaller->mLog));
181 XCube_DelegateUtils::call(
'Legacy.Admin.Event.ModuleUninstall.' . ucfirst($this->mXoopsModule->get(
'dirname') .
'.Fail'),
new XCube_Ref($this->mXoopsModule),
new XCube_Ref($this->mInstaller->mLog));
182 XCube_DelegateUtils::call(
'Legacy.Admin.Event.ModuleUninstall.Fail',
new XCube_Ref($this->mXoopsModule),
new XCube_Ref($this->mInstaller->mLog));
185 $renderer->setTemplateName(
'module_uninstall_success.html');
186 $renderer->setAttribute(
'module', $this->mXoopsModule);
187 $renderer->setAttribute(
'log', $this->mInstaller->mLog->mMessages);
190 public function executeViewInput(&$controller, &$xoopsUser, &$renderer)
192 $renderer->setTemplateName(
'module_uninstall.html');
193 $renderer->setAttribute(
'actionForm', $this->mActionForm);
194 $renderer->setAttribute(
'module', $this->mXoopsModule);
195 $renderer->setAttribute(
'currentVersion', round($this->mXoopsModule->get(
'version') / 100, 2));
198 public function executeViewCancel(&$controller, &$xoopsUser, &$renderer)
200 $controller->executeForward(
'./index.php?action=ModuleList');