1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10:
11:
12: 13: 14: 15: 16: 17: 18: 19: 20: 21:
22:
23: class MaintenanceMaintenanceForm extends Xoops\Form\ThemeForm
24: {
25: 26: 27:
28: public function __construct($obj = null)
29: {
30: }
31:
32: 33: 34: 35:
36: public function getMaintenance()
37: {
38: $maintenance = new Maintenance();
39: parent::__construct('', "form_maintenance", "center.php", 'post', true);
40:
41: $cache = new Xoops\Form\Select(_AM_MAINTENANCE_CENTER_CACHE, "cache", '', 3, true);
42: $cache->setDescription(\XoopsBaseConfig::get('var-path') . "/cache/smarty_cache/<br />" . \XoopsBaseConfig::get('var-path') . "/cache/smarty_compile/<br />" . \XoopsBaseConfig::get('var-path') . "/cache/xoops_cache/");
43: $cache_arr = array(1 => _AM_MAINTENANCE_CENTER_SMARTY_CACHE, 2 => _AM_MAINTENANCE_CENTER_SMARTY_COMPILE, 3 => _AM_MAINTENANCE_CENTER_XOOPS_CACHE);
44: $cache->addOptionArray($cache_arr);
45: $this->addElement($cache);
46:
47: $this->addElement(new Xoops\Form\RadioYesNo(_AM_MAINTENANCE_CENTER_SESSION, 'session', ''));
48:
49: $tables_tray = new Xoops\Form\ElementTray(_AM_MAINTENANCE_CENTER_TABLES, ' ');
50: $tables_tray->setDescription(_AM_MAINTENANCE_CENTER_TABLES_DESC);
51: $select_tables = new Xoops\Form\Select('', "tables", '', 7, true);
52: $select_tables->addOptionArray($maintenance->displayTables(true));
53: $tables_tray->addElement($select_tables, false);
54: $choice = new Xoops\Form\Select(' ' . _AM_MAINTENANCE_AND . ' ', "maintenance", '', 4, true);
55: $options = array(
56: '1' => _AM_MAINTENANCE_CENTER_CHOICE1, '2' => _AM_MAINTENANCE_CENTER_CHOICE2,
57: '3' => _AM_MAINTENANCE_CENTER_CHOICE3, '4' => _AM_MAINTENANCE_CENTER_CHOICE4
58: );
59: $choice->addOptionArray($options);
60: $tables_tray->addElement($choice, false);
61: $this->addElement($tables_tray);
62:
63: $this->addElement(new Xoops\Form\Hidden("op", "maintenance_save"));
64: $this->addElement(new Xoops\Form\Button("", "maintenance_save", XoopsLocale::A_SUBMIT, "submit"));
65: }
66:
67: 68: 69:
70: public function getDump()
71: {
72: $xoops = Xoops::getInstance();
73: $maintenance = new Maintenance();
74: parent::__construct('', "form_dump", "dump.php", 'post', true);
75:
76: $dump_tray = new Xoops\Form\ElementTray(_AM_MAINTENANCE_DUMP_TABLES_OR_MODULES, '');
77: $select_tables1 = new Xoops\Form\Select('', "dump_tables", '', 7, true);
78: $select_tables1->addOptionArray($maintenance->displayTables(true));
79: $dump_tray->addElement($select_tables1, false);
80: $ele = new Xoops\Form\Select(' ' . _AM_MAINTENANCE_OR . ' ', 'dump_modules', '', 7, true);
81: $module_list = XoopsLists::getModulesList();
82: $module_handler = $xoops->getHandlerModule();
83: foreach ($module_list as $file) {
84: if (XoopsLoad::fileExists(\XoopsBaseConfig::get('root-path') . '/modules/' . $file . '/xoops_version.php')) {
85: clearstatcache();
86: $file = trim($file);
87: $module = $module_handler->create();
88: $module->loadInfo($file);
89: if ($module->getInfo('tables') && $xoops->isActiveModule($file)) {
90: $ele->addOption($module->getInfo('dirname'), $module->getInfo('name'));
91: }
92: unset($module);
93: }
94: }
95: $dump_tray->addElement($ele);
96: $this->addElement($dump_tray);
97:
98: $this->addElement(new Xoops\Form\RadioYesNo(_AM_MAINTENANCE_DUMP_DROP, 'drop', 1));
99:
100: $this->addElement(new Xoops\Form\Hidden("op", "dump_save"));
101: $this->addElement(new Xoops\Form\Button("", "dump_save", XoopsLocale::A_SUBMIT, "submit"));
102: }
103: }
104: