|
39 | 39 | $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); |
40 | 40 | $GLOBALS['xoTheme']->addStylesheet('modules/modulebuilder/assets/css/admin/style.css'); |
41 | 41 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php')); |
42 | | - $adminObject->addItemButton(_AM_MODULEBUILDER_ADD_SETTING, 'settings.php?op=new', 'add'); |
| 42 | + $adminObject->addItemButton(_AM_MODULEBUILDER_SETTINGS_ADD, 'settings.php?op=new', 'add'); |
43 | 43 | $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
44 | 44 | $GLOBALS['xoopsTpl']->assign('tdmc_upload_imgmod_url', TDMC_UPLOAD_IMGMOD_URL); |
45 | 45 | $GLOBALS['xoopsTpl']->assign('tdmc_url', TDMC_URL); |
|
132 | 132 | $settingsObj->setVar('set_comments', in_array('comments', $settingOption)); |
133 | 133 | $settingsObj->setVar('set_notifications', in_array('notifications', $settingOption)); |
134 | 134 | $settingsObj->setVar('set_permissions', in_array('permissions', $settingOption)); |
135 | | - //$settingsObj->setVar('set_inroot_copy', in_array('inroot', $settingOption)); |
136 | | - if (\Xmf\Request::hasVar('set_type')) { |
137 | | - $settingsObj->setVar('set_type', \Xmf\Request::getString('set_type', '', 'POST')); |
| 135 | + $settingsObj->setVar('set_inroot_copy', in_array('inroot', $settingOption)); |
| 136 | + $setType = \Xmf\Request::getString('set_type', '', 'POST'); |
| 137 | + if (1 == $setType) { |
| 138 | + // reset all |
| 139 | + $strSQL = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_settings') . ' SET ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_settings') . '.set_type = 0'; |
| 140 | + $GLOBALS['xoopsDB']->queryF($strSQL); |
138 | 141 | } |
| 142 | + $settingsObj->setVar('set_type', $setType); |
139 | 143 |
|
140 | 144 | if ($helper->getHandler('Settings')->insert($settingsObj)) { |
141 | 145 | redirect_header('settings.php', 5, sprintf(_AM_MODULEBUILDER_MODULE_FORM_UPDATED_OK, \Xmf\Request::getString('set_name', '', 'POST'))); |
|
147 | 151 | break; |
148 | 152 | case 'edit': |
149 | 153 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php')); |
150 | | - $adminObject->addItemButton(_AM_MODULEBUILDER_ADD_SETTING, 'settings.php?op=new', 'add'); |
| 154 | + $adminObject->addItemButton(_AM_MODULEBUILDER_SETTINGS_ADD, 'settings.php?op=new', 'add'); |
151 | 155 | $adminObject->addItemButton(_AM_MODULEBUILDER_SETTINGS_LIST, 'settings.php', 'list'); |
152 | 156 | $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
153 | 157 | $settingsObj = $helper->getHandler('Settings')->get($setId); |
|
170 | 174 | } |
171 | 175 | break; |
172 | 176 | case 'display': |
173 | | - $id = \Xmf\Request::getInt('set_id', 0, 'POST'); |
174 | | - if ($id > 0) { |
175 | | - $settingsObj = $helper->getHandler('Settings')->get($id); |
176 | | - if (isset($_POST['set_type'])) { |
177 | | - $setType = $settingsObj->getVar('set_type'); |
178 | | - $settingsObj->setVar('set_type', !$setType); |
| 177 | + $setId = \Xmf\Request::getInt('set_id', 0); |
| 178 | + if ($setId > 0) { |
| 179 | + $settingsHandler = $helper->getHandler('Settings'); |
| 180 | + $settingsObj = $settingsHandler->get($id); |
| 181 | + $setType = $settingsObj->getVar('set_type'); |
| 182 | + // reset all |
| 183 | + $strSQL = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_settings') . ' SET ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_settings') . '.set_type = 0'; |
| 184 | + $GLOBALS['xoopsDB']->queryF($strSQL); |
| 185 | + $strSQL = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_settings') . ' SET ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_settings') . '.set_type = 1 WHERE ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_settings') . '.set_id = ' . $setId; |
| 186 | + if ($GLOBALS['xoopsDB']->queryF($strSQL)) { |
| 187 | + redirect_header('settings.php', 5, sprintf(_AM_MODULEBUILDER_MODULE_FORM_UPDATED_OK, \Xmf\Request::getString('set_name', '', 'POST'))); |
179 | 188 | } |
180 | 189 | $GLOBALS['xoopsTpl']->assign('error', $settingsObj->getHtmlErrors()); |
181 | 190 | } |
|
0 commit comments