1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace XoopsModules\Xoositemap\Form; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Xoositemap module |
7
|
|
|
* |
8
|
|
|
* You may not change or alter any portion of this comment or credits |
9
|
|
|
* of supporting developers from this source code or any supporting source code |
10
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
11
|
|
|
* This program is distributed in the hope that it will be useful, |
12
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
14
|
|
|
* |
15
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
16
|
|
|
* @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
17
|
|
|
* @package Xoositemap |
18
|
|
|
* @since 2.6.0 |
19
|
|
|
* @author Laurent JEN (Aka DuGris) |
20
|
|
|
|
21
|
|
|
*/ |
22
|
|
|
class PreferencesForm extends \Xoops\Form\ThemeForm |
23
|
|
|
{ |
24
|
|
|
private $config = []; |
|
|
|
|
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @param string $config |
28
|
|
|
* @internal param null $obj |
29
|
|
|
*/ |
30
|
|
|
public function __construct($config) |
31
|
|
|
{ |
32
|
|
|
extract($config); |
|
|
|
|
33
|
|
|
|
34
|
|
|
parent::__construct('', 'form_preferences', 'preferences.php', 'post', true); |
35
|
|
|
$this->setExtra('enctype="multipart/form-data"'); |
36
|
|
|
|
37
|
|
|
$tabTray = new \Xoops\Form\TabTray('', 'uniqueid'); |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Main page |
41
|
|
|
*/ |
42
|
|
|
$tab1 = new \Xoops\Form\Tab(_XOO_CONFIG_MAINPAGE, 'tabid-1'); |
43
|
|
|
$tab1->addElement(new \Xoops\Form\RadioYesNo(_XOO_CONFIG_MAIN, 'xoositemap_main', $xoositemap_main)); |
44
|
|
|
|
45
|
|
|
// main |
46
|
|
|
$tab1->addElement(new \Xoops\Form\RadioYesNo(_XOO_CONFIG_SUBCAT, 'xoositemap_subcat', $xoositemap_subcat)); |
47
|
|
|
|
48
|
|
|
// welcome |
49
|
|
|
$tab1->addElement(new \Xoops\Form\TextArea(_XOO_CONFIG_WELCOME, 'xoositemap_welcome', $xoositemap_welcome, 12, 12)); |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Main page |
53
|
|
|
*/ |
54
|
|
|
$tab2 = new \Xoops\Form\Tab(_XOO_CONFIG_MODULES, 'tabid-2'); |
55
|
|
|
$systemModule = new \SystemModule(); |
56
|
|
|
$installed = $systemModule->getModuleList(); |
57
|
|
|
$modules = new \Xoops\Form\Select(_XOO_CONFIG_MODULES_SELECT, 'xoositemapModule', $xoositemapModule, count($installed) - 1, true); |
58
|
|
|
foreach ($installed as $module) { |
59
|
|
|
$plugin = \Xoops\Module\Plugin::getPlugin($module->getVar('dirname'), 'xoositemap'); |
60
|
|
|
if (is_object($plugin)) { |
61
|
|
|
$modules->addOption($module->getVar('dirname'), $module->getVar('dirname')); |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
$tab2->addElement($modules); |
65
|
|
|
|
66
|
|
|
$tabTray->addElement($tab1); |
67
|
|
|
$tabTray->addElement($tab2); |
68
|
|
|
$this->addElement($tabTray); |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Buttons |
72
|
|
|
*/ |
73
|
|
|
$buttonTray = new \Xoops\Form\ElementTray('', ''); |
74
|
|
|
$buttonTray->addElement(new \Xoops\Form\Hidden('op', 'save')); |
75
|
|
|
|
76
|
|
|
$buttonSubmit = new \Xoops\Form\Button('', 'submit', \XoopsLocale::A_SUBMIT, 'submit'); |
77
|
|
|
$buttonSubmit->setClass('btn btn-success'); |
78
|
|
|
$buttonTray->addElement($buttonSubmit); |
79
|
|
|
|
80
|
|
|
$buttonReset = new \Xoops\Form\Button('', 'reset', \XoopsLocale::A_RESET, 'reset'); |
81
|
|
|
$buttonReset->setClass('btn btn-warning'); |
82
|
|
|
$buttonTray->addElement($buttonReset); |
83
|
|
|
|
84
|
|
|
$buttonCancel = new \Xoops\Form\Button('', 'cancel', \XoopsLocale::A_CANCEL, 'button'); |
85
|
|
|
$buttonCancel->setExtra("onclick='javascript:history.go(-1);'"); |
|
|
|
|
86
|
|
|
$buttonCancel->setClass('btn btn-danger'); |
87
|
|
|
$buttonTray->addElement($buttonCancel); |
88
|
|
|
|
89
|
|
|
$this->addElement($buttonTray); |
90
|
|
|
} |
91
|
|
|
} |
92
|
|
|
|