1: <?php
2: 3: 4: 5: 6: 7: 8: 9:
10:
11: if (!defined('XOOPS_ROOT_PATH')) exit();
12:
13: 14: 15: 16:
17: class Legacy_AbstractModuleInstallAction extends Legacy_Action
18: {
19: 20: 21:
22: var $mModuleObject = null;
23: var $mLog = null;
24:
25: var $mActionForm = null;
26:
27: function prepare(&$controller, &$xoopsUser)
28: {
29: $this->_setupActionForm();
30: }
31:
32: function _setupActionForm()
33: {
34: }
35:
36: 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: 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:
76:
77:
78: if ($installer->hasAgree()) {
79: return LEGACY_FRAME_VIEW_INPUT;
80: }
81: else {
82: return LEGACY_FRAME_VIEW_INDEX;
83: }
84: }
85:
86: if (!is_object($this->mModuleObject)) {
87: return LEGACY_FRAME_VIEW_ERROR;
88: }
89:
90: $installer->setForceMode($this->mActionForm->get('force'));
91: $installer->execute($this->mActionForm->get('dirname'));
92:
93: $this->mLog =& $installer->getLog();
94:
95: return LEGACY_FRAME_VIEW_SUCCESS;
96: }
97:
98: 99: 100:
101: function &_getInstaller($dirname)
102: {
103: }
104:
105: function _loadAgreement()
106: {
107: }
108:
109: function executeViewError(&$controller,&$xoopsUser,&$renderer)
110: {
111: $renderer->setTemplateName("install_wizard_error.html");
112: $renderer->setAttribute('log', $this->mLog);
113: }
114: }
115:
116: ?>
117: