XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
AbstractModuleInstallAction.class.php
1<?php
12
13 if (!defined('XOOPS_ROOT_PATH')) {
14 exit();
15 }
16
17class Legacy_AbstractModuleInstallAction extends Legacy_Action
18{
22 public $mModuleObject = null;
23 public $mLog = null;
24
25 public $mActionForm = null;
26
27 public function prepare(&$controller, &$xoopsUser)
28 {
29 $this->_setupActionForm();
30 }
31
32 public function _setupActionForm()
33 {
34 }
35
36 public function getDefaultView(&$controller, &$xoopsUser)
37 {
38 $dirname = trim(xoops_getrequest('dirname'));
39
40 $installer =& $this->_getInstaller($dirname);
41
42 $this->mModuleObject =& $installer->loadModuleObject($dirname);
43
44 if (!is_object($this->mModuleObject)) {
45 $this->mLog =& $installer->getLog();
46 return LEGACY_FRAME_VIEW_ERROR;
47 }
48
49 $this->mActionForm->load($this->mModuleObject);
50
51 $this->mModuleObject->loadAdminMenu();
52 $this->mModuleObject->loadInfo($dirname);
53
54 return LEGACY_FRAME_VIEW_INDEX;
55 }
56
57 public function execute(&$controller, &$xoopsUser)
58 {
59 if (isset($_REQUEST['_form_control_cancel'])) {
60 return LEGACY_FRAME_VIEW_CANCEL;
61 }
62
63 $this->mActionForm->fetch();
64 $this->mActionForm->validate();
65
66 $installer =& $this->_getInstaller($this->mActionForm->get('dirname'));
67 $this->mModuleObject =& $installer->loadModuleObject($this->mActionForm->get('dirname'));
68
69 if ($installer->hasAgree()) {
70 $this->_loadAgreement();
71 }
72
73 if ($this->mActionForm->hasError()) {
74 //
75 // Normal modules doesn't have licence.txt. If it has licence.txt
76 // return 'INPUT' view.
77 //
78 if ($installer->hasAgree()) {
79 return LEGACY_FRAME_VIEW_INPUT;
80 } else {
81 return LEGACY_FRAME_VIEW_INDEX;
82 }
83 }
84
85 if (!is_object($this->mModuleObject)) {
86 return LEGACY_FRAME_VIEW_ERROR;
87 }
88
89 $installer->setForceMode($this->mActionForm->get('force'));
90 $installer->execute($this->mActionForm->get('dirname'));
91
92 $this->mLog =& $installer->getLog();
93
94 return LEGACY_FRAME_VIEW_SUCCESS;
95 }
96
101 public function &_getInstaller($dirname)
102 {
103 }
104
105 public function _loadAgreement()
106 {
107 }
108
109 public function executeViewError(&$controller, &$xoopsUser, &$renderer)
110 {
111 $renderer->setTemplateName('install_wizard_error.html');
112 $renderer->setAttribute('log', $this->mLog);
113 }
114}