XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
InstallWizardAction.class.php
1<?php
11
12 if (!defined('XOOPS_ROOT_PATH')) {
13 exit();
14 }
15
16require_once XOOPS_LEGACY_PATH . '/admin/actions/AbstractModuleInstallAction.class.php';
17require_once XOOPS_LEGACY_PATH . '/admin/class/ModuleInstaller.class.php';
18require_once XOOPS_LEGACY_PATH . '/admin/forms/InstallWizardForm.class.php';
19
20/***
21 * @internal
22 * @public
23 * Install module
24 */
26{
27 public $mLicence;
28 public $mLicenceText;
29
30 public function &_getInstaller($dirname)
31 {
32 $installer =new Legacy_ModuleInstaller($dirname);
33 return $installer;
34 }
35
36 public function _setupActionForm()
37 {
38 $this->mActionForm =new Legacy_InstallWizardForm();
39 $this->mActionForm->prepare();
40 }
41
42 public function _loadAgreement()
43 {
44 $root =& XCube_Root::getSingleton();
45
46 $this->mLicence = $this->mModuleObject->modinfo['installer']['licence']['title'];
47
48 $file = $this->mModuleObject->modinfo['installer']['licence']['file'];
49 $language = $root->mContext->getXoopsConfig('language');
50
51 //
52 // TODO Replace with language manager.
53 //
54 $path = XOOPS_MODULE_PATH . '/' . $this->mModuleObject->get('dirname') . '/language/' . $language . '/' . $file;
55 if (!file_exists($path)) {
56 $path = XOOPS_MODULE_PATH . '/' . $this->mModuleObject->get('dirname') . '/language/english/' . $file;
57 if (!file_exists($path)) {
58 return;
59 }
60 }
61
62 $this->mLicenceText = file_get_contents($path);
63 }
64
65 public function executeViewSuccess(&$controller, &$xoopsUser, &$render)
66 {
67 $render->setTemplateName('module_install_success.html');
68 $render->setAttribute('log', $this->mLog->mMessages);
69 }
70
71 public function executeViewIndex(&$controller, &$xoopsUser, &$render)
72 {
73 $render->setAttribute('module', $this->mModuleObject);
74 $render->setAttribute('actionForm', $this->mActionForm);
75
76 if (isset($this->mModuleObject->modinfo['installer'])) {
77 $render->setAttribute('image', $this->mModuleObject->modinfo['installer']['image']);
78 $render->setAttribute('description', $this->mModuleObject->modinfo['installer']['description']);
79 $render->setTemplateName('install_wizard.html');
80 } else {
81 $controller->executeForward('index.php?action=ModuleInstall&dirname=' . $this->mModuleObject->get('dirname'));
82 }
83 }
84
85 public function executeViewInput(&$controller, &$xoopsUser, &$render)
86 {
87 $render->setTemplateName('install_wizard_licence.html');
88 $render->setAttribute('module', $this->mModuleObject);
89 $render->setAttribute('actionForm', $this->mActionForm);
90 $render->setAttribute('licence', $this->mLicence);
91 $render->setAttribute('licenceText', $this->mLicenceText);
92 }
93}