Skip to content

Commit 6b51921

Browse files
committed
Merge branch 'master' of https://github.com/txmodxoops/tdmcreate
2 parents 2c92856 + 32c7406 commit 6b51921

93 files changed

Lines changed: 2464 additions & 596 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

_TODO.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Notifications:
2+
there are too much notification, which are not needed/working
3+
TODO:
4+
- reduce xoops_version.php to needed
5+
- adapt language/modinfo.php

admin/building.php

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,21 @@
2222
* @author Txmod Xoops http://www.txmodxoops.org
2323
*
2424
*/
25-
$GLOBALS['xoopsOption']['template_main'] = 'tdmcreate_building.tpl';
25+
26+
$templateMain = 'tdmcreate_building.tpl';
2627

2728
include __DIR__ . '/header.php';
28-
$op = \Xmf\Request::getString('op', 'default');
29-
$mid = \Xmf\Request::getInt('mod_id');
30-
$moduleObj = $helper->getHandler('Modules')->get($mid);
31-
$cachePath = XOOPS_VAR_PATH . '/caches/tdmcreate_cache';
29+
$op = \Xmf\Request::getString('op', 'default');
30+
$mid = \Xmf\Request::getInt('mod_id');
31+
$inroot_copy = \Xmf\Request::getInt('inroot_copy');
32+
$moduleObj = $helper->getHandler('Modules')->get($mid);
33+
$cachePath = XOOPS_VAR_PATH . '/caches/tdmcreate_cache';
34+
if (!is_dir($cachePath)) {
35+
if (!mkdir($cachePath, 0777) && !is_dir($cachePath)) {
36+
throw new \RuntimeException(sprintf('Directory "%s" was not created', $cachePath));
37+
}
38+
chmod($cachePath, 0777);
39+
}
3240
// Clear cache
3341
if (file_exists($cache = $cachePath . '/classpaths.cache')) {
3442
unlink($cache);
@@ -39,7 +47,6 @@
3947
// Switch option
4048
switch ($op) {
4149
case 'build':
42-
// $templateMain = 'tdmcreate_building.tpl';
4350
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('building.php'));
4451
// Get var module dirname
4552
$moduleDirname = $moduleObj->getVar('mod_dirname');
@@ -75,9 +82,10 @@
7582
}
7683
unset($build);
7784
// Directory to saved all files
78-
$GLOBALS['xoopsTpl']->assign('building_directory', sprintf(_AM_TDMCREATE_BUILDING_DIRECTORY, $moduleDirname));
85+
$building_directory = sprintf(_AM_TDMCREATE_BUILDING_DIRECTORY, $moduleDirname);
86+
7987
// Copy this module in root modules
80-
if (1 == $moduleObj->getVar('mod_inroot_copy')) {
88+
if (1 === $inroot_copy) {
8189
$building = Tdmcreate\Building::getInstance();
8290
if (isset($moduleDirname)) {
8391
// Clear this module if it's in root/modules
@@ -89,11 +97,12 @@
8997
}
9098
}
9199
$building->copyDir($fromDir, $toDir);
100+
$building_directory .= sprintf(_AM_TDMCREATE_BUILDING_DIRECTORY_INROOT, $toDir);
92101
}
102+
$GLOBALS['xoopsTpl']->assign('building_directory', $building_directory);
93103
break;
94104
case 'default':
95105
default:
96-
// $templateMain = 'tdmcreate_building.tpl';
97106
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('building.php'));
98107
// Redirect if there aren't modules
99108
$nbModules = $helper->getHandler('Modules')->getCount();

admin/fields.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
* @author Txmod Xoops http://www.txmodxoops.org
3131
*
3232
*/
33-
$GLOBALS['xoopsOption']['template_main'] = 'tdmcreate_fields.tpl';
33+
34+
// Define main template
35+
$templateMain = 'tdmcreate_fields.tpl';
3436

3537
include __DIR__ . '/header.php';
3638
// Recovered value of arguments op in the URL $
@@ -46,8 +48,6 @@
4648
default:
4749
$start = \Xmf\Request::getInt('start', 0);
4850
$limit = \Xmf\Request::getInt('limit', $helper->getConfig('tables_adminpager'));
49-
// Define main template
50-
// $templateMain = 'tdmcreate_fields.tpl';
5151
$GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css');
5252
$GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js');
5353
$GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js');
@@ -109,8 +109,6 @@
109109
}
110110
break;
111111
case 'new':
112-
// Define main template
113-
// $templateMain = 'tdmcreate_fields.tpl';
114112
$GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css');
115113
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('fields.php'));
116114
$adminObject->addItemButton(_AM_TDMCREATE_TABLES_LIST, 'tables.php', 'list');
@@ -183,8 +181,6 @@
183181
$GLOBALS['xoopsTpl']->assign('form', $form->render());
184182
break;
185183
case 'edit':
186-
// Define main template
187-
// $templateMain = 'tdmcreate_fields.tpl';
188184
$GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css');
189185
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('fields.php'));
190186
$adminObject->addItemButton(_AM_TDMCREATE_ADD_TABLE, 'tables.php?op=new', 'add');

admin/footer.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
*/
2424
$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32);
2525

26-
echo "<div class='adminfooter'>\n" . " <div style='text-align: center;'>\n" . " <a href='https://xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n" . " </div>\n" . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . '</div>';
27-
26+
if (isset($templateMain)) {
27+
$GLOBALS['xoopsTpl']->display("db:{$templateMain}");
28+
}
2829
xoops_cp_footer();

admin/modules.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,20 @@
2121
* @author Txmod Xoops <support@txmodxoops.org>
2222
*
2323
*/
24-
$GLOBALS['xoopsOption']['template_main'] = 'tdmcreate_modules.tpl';
24+
25+
// Define main template
26+
$templateMain = 'tdmcreate_modules.tpl';
2527

2628
include __DIR__ . '/header.php';
2729
// Recovered value of argument op in the URL $
28-
$op = \Xmf\Request::getString('op', 'list');
29-
30+
$op = \Xmf\Request::getString('op', 'list');
3031
$modId = \Xmf\Request::getInt('mod_id');
3132

3233
switch ($op) {
3334
case 'list':
3435
default:
3536
$start = \Xmf\Request::getInt('start', 0);
3637
$limit = \Xmf\Request::getInt('limit', $helper->getConfig('modules_adminpager'));
37-
// Define main template
38-
// $templateMain = 'tdmcreate_modules.tpl';
3938
$GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js');
4039
$GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css');
4140
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('modules.php'));
@@ -68,8 +67,6 @@
6867

6968
break;
7069
case 'new':
71-
// Define main template
72-
// $templateMain = 'tdmcreate_modules.tpl';
7370
$GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js');
7471
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('modules.php'));
7572
$adminObject->addItemButton(_AM_TDMCREATE_MODULES_LIST, 'modules.php', 'list');
@@ -152,7 +149,7 @@
152149
$modulesObj->setVar('mod_comments', in_array('comments', $moduleOption));
153150
$modulesObj->setVar('mod_notifications', in_array('notifications', $moduleOption));
154151
$modulesObj->setVar('mod_permissions', in_array('permissions', $moduleOption));
155-
$modulesObj->setVar('mod_inroot_copy', in_array('inroot_copy', $moduleOption));
152+
//$modulesObj->setVar('mod_inroot_copy', in_array('inroot_copy', $moduleOption));
156153

157154
if ($helper->getHandler('Modules')->insert($modulesObj)) {
158155
if ($modulesObj->isNew()) {
@@ -167,8 +164,6 @@
167164
$GLOBALS['xoopsTpl']->assign('form', $form->render());
168165
break;
169166
case 'edit':
170-
// Define main template
171-
// $templateMain = 'tdmcreate_modules.tpl';
172167
$GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js');
173168
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('modules.php'));
174169
$adminObject->addItemButton(_AM_TDMCREATE_ADD_MODULE, 'modules.php?op=new', 'add');

admin/morefiles.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
* @author Txmod Xoops <support@txmodxoops.org>
2222
*
2323
*/
24-
$GLOBALS['xoopsOption']['template_main'] = 'tdmcreate_morefiles.tpl';
24+
25+
// Define main template
26+
$templateMain = 'tdmcreate_morefiles.tpl';
2527

2628
include __DIR__ . '/header.php';
2729
// Recovered value of argument op in the URL $
@@ -34,8 +36,6 @@
3436
default:
3537
$start = \Xmf\Request::getInt('start', 0);
3638
$limit = \Xmf\Request::getInt('limit', $helper->getConfig('morefiles_adminpager'));
37-
// Define main template
38-
// $templateMain = 'tdmcreate_morefiles.tpl';
3939
$GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js');
4040
$GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css');
4141
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('morefiles.php'));
@@ -69,8 +69,6 @@
6969
}
7070
break;
7171
case 'new':
72-
// Define main template
73-
// $templateMain = 'tdmcreate_morefiles.tpl';
7472
$GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js');
7573
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('morefiles.php'));
7674
$adminObject->addItemButton(_AM_TDMCREATE_MORE_FILES_LIST, 'morefiles.php', 'list');

admin/settings.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,21 @@
2121
* @author Txmod Xoops <support@txmodxoops.org>
2222
*
2323
*/
24-
$GLOBALS['xoopsOption']['template_main'] = 'tdmcreate_settings.tpl';
24+
25+
// Define main template
26+
$templateMain = 'tdmcreate_settings.tpl';
2527

2628
include __DIR__ . '/header.php';
2729

2830
// Recovered value of argument op in the URL $
29-
$op = \Xmf\Request::getString('op', 'list');
30-
31+
$op = \Xmf\Request::getString('op', 'list');
3132
$setId = \Xmf\Request::getInt('set_id');
3233

3334
switch ($op) {
3435
case 'list':
3536
default:
3637
$start = \Xmf\Request::getInt('start', 0);
3738
$limit = \Xmf\Request::getInt('limit', $helper->getConfig('settings_adminpager'));
38-
// Define main template
39-
// $templateMain = 'tdmcreate_settings.tpl';
4039
$GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js');
4140
$GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css');
4241
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php'));
@@ -65,8 +64,6 @@
6564
}
6665
break;
6766
case 'new':
68-
// Define main template
69-
// $templateMain = 'tdmcreate_settings.tpl';
7067
$GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js');
7168
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php'));
7269
$adminObject->addItemButton(_AM_TDMCREATE_SETTINGS_LIST, 'settings.php', 'list');
@@ -135,7 +132,7 @@
135132
$settingsObj->setVar('set_comments', in_array('comments', $settingOption));
136133
$settingsObj->setVar('set_notifications', in_array('notifications', $settingOption));
137134
$settingsObj->setVar('set_permissions', in_array('permissions', $settingOption));
138-
$settingsObj->setVar('set_inroot_copy', in_array('inroot', $settingOption));
135+
//$settingsObj->setVar('set_inroot_copy', in_array('inroot', $settingOption));
139136
if (\Xmf\Request::hasVar('set_type')) {
140137
$settingsObj->setVar('set_type', \Xmf\Request::getString('set_type', '', 'POST'));
141138
}
@@ -149,8 +146,6 @@
149146
$GLOBALS['xoopsTpl']->assign('form', $form->render());
150147
break;
151148
case 'edit':
152-
// Define main template
153-
// $templateMain = 'tdmcreate_settings.tpl';
154149
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php'));
155150
$adminObject->addItemButton(_AM_TDMCREATE_ADD_SETTING, 'settings.php?op=new', 'add');
156151
$adminObject->addItemButton(_AM_TDMCREATE_SETTINGS_LIST, 'settings.php', 'list');

admin/tables.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
* @author Txmod Xoops http://www.txmodxoops.org
2222
*
2323
*/
24-
$GLOBALS['xoopsOption']['template_main'] = 'tdmcreate_tables.tpl';
24+
25+
// Define main template
26+
$templateMain = 'tdmcreate_tables.tpl';
2527

2628
include __DIR__ . '/header.php';
2729
// Recovered value of arguments op in the URL $
@@ -40,8 +42,6 @@
4042
default:
4143
$start = \Xmf\Request::getInt('start', 0);
4244
$limit = \Xmf\Request::getInt('limit', $helper->getConfig('modules_adminpager'));
43-
// Define main template
44-
// $templateMain = 'tdmcreate_tables.tpl';
4545
$GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css');
4646
$GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js');
4747
$GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js');
@@ -98,13 +98,14 @@
9898
}
9999
break;
100100
case 'new':
101-
// Define main template
102-
// $templateMain = 'tdmcreate_tables.tpl';
103101
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('tables.php'));
104102
$adminObject->addItemButton(_AM_TDMCREATE_TABLES_LIST, 'tables.php', 'list');
105103
$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
106104

107105
$tablesObj = $helper->getHandler('Tables')->create();
106+
if ($tableMid > 0) {
107+
$tablesObj->setVar('table_mid', $tableMid);
108+
}
108109
$form = $tablesObj->getFormTables();
109110
$GLOBALS['xoopsTpl']->assign('form', $form->render());
110111
break;
@@ -208,8 +209,6 @@
208209
$GLOBALS['xoopsTpl']->assign('form', $form->render());
209210
break;
210211
case 'edit':
211-
// Define main template
212-
// $templateMain = 'tdmcreate_tables.tpl';
213212
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('tables.php'));
214213
$adminObject->addItemButton(_AM_TDMCREATE_ADD_TABLE, 'tables.php?op=new', 'add');
215214
$adminObject->addItemButton(_AM_TDMCREATE_TABLES_LIST, 'tables.php?op=list', 'list');

assets/images/logos/xoops2.png

-2.65 KB
Binary file not shown.

class/Building.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,23 @@ public static function getInstance()
5555
*/
5656
public function getForm($action = false)
5757
{
58-
$tc = Tdmcreate\Helper::getInstance();
58+
$helper = Tdmcreate\Helper::getInstance();
5959
if (false === $action) {
6060
$action = \Xmf\Request::getString('REQUEST_URI', '', 'SERVER');
6161
}
6262
xoops_load('XoopsFormLoader');
6363
$form = new \XoopsThemeForm(_AM_TDMCREATE_ADMIN_CONST, 'buildform', $action, 'post', true);
6464
$form->setExtra('enctype="multipart/form-data"');
65-
$moduleObj = $tc->getHandler('modules')->getObjects(null);
65+
$moduleObj = $helper->getHandler('modules')->getObjects(null);
6666
$mod_select = new \XoopsFormSelect(_AM_TDMCREATE_CONST_MODULES, 'mod_id', 'mod_id');
6767
$mod_select->addOption('', _AM_TDMCREATE_BUILD_MODSELOPT);
6868
foreach ($moduleObj as $mod) {
6969
$mod_select->addOption($mod->getVar('mod_id'), $mod->getVar('mod_name'));
7070
}
7171
$form->addElement($mod_select, true);
72-
72+
73+
$form->addElement(new \XoopsFormRadioYN(_AM_TDMCREATE_MODULE_INROOT_COPY, 'inroot_copy', $helper->getConfig('inroot_copy')));
74+
7375
$form->addElement(new \XoopsFormHidden('op', 'build'));
7476
$form->addElement(new \XoopsFormButton(_REQUIRED . ' <sup class="red bold">*</sup>', 'submit', _SUBMIT, 'submit'));
7577

0 commit comments

Comments
 (0)