From: <txm...@us...> - 2015-05-01 16:05:59
|
Revision: 13051 http://sourceforge.net/p/xoops/svn/13051 Author: txmodxoops Date: 2015-05-01 16:05:55 +0000 (Fri, 01 May 2015) Log Message: ----------- Updated Fixed bugs Database new use Engine=InnoDB Deleted field_numb: This field can be called from the table_nbfield in tables Modified includes with __DIR__ Needed a fresh installation Modified Paths: -------------- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/about.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/building.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/fields.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/footer.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/header.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/index.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/menu.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/modules.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/tables.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/assets/css/admin/style.css XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/assets/js/sortable.js XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/TDMCreateAutoload.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/TDMCreateHelper.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/TDMCreateSession.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/building.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/fieldattributes.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/fieldelements.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/fieldkey.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/fieldnull.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/fields.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/fieldtype.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/TDMCreateAbstract.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/TDMCreateArchitecture.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/TDMCreateFile.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/TDMCreateHtmlSmartyCodes.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/TDMCreateStructure.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/TDMCreateTableFields.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/AdminAbout.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/AdminFooter.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/AdminHeader.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/AdminIndex.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/AdminMenu.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/AdminObjects.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/AdminPages.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/AdminPermissions.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/blocks/BlocksFiles.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/classes/ClassFiles.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/classes/ClassFormElements.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/classes/ClassHelper.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/css/CssStyles.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/docs/DocsChangelog.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/docs/DocsFiles.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/include/IncludeCommentFunctions.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/include/IncludeComments.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/include/IncludeCommon.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/include/IncludeFunctions.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/include/IncludeInstall.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/include/IncludeJquery.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/include/IncludeNotifications.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/include/IncludeSearch.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/include/IncludeUpdate.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/language/LanguageAdmin.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/language/LanguageBlocks.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/language/LanguageDefines.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/language/LanguageHelp.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/language/LanguageMailTpl.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/language/LanguageMain.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/language/LanguageModinfo.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/sql/SqlFile.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/templates/TDMCreateHtmlSmartyCodes.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/templates/admin/TemplatesAdminAbout.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/templates/admin/TemplatesAdminFooter.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/templates/admin/TemplatesAdminHeader.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/templates/admin/TemplatesAdminIndex.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/templates/admin/TemplatesAdminPages.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/templates/admin/TemplatesAdminPermissions.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/templates/blocks/TemplatesBlocks.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/templates/user/TemplatesUserFooter.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/templates/user/TemplatesUserHeader.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/templates/user/TemplatesUserIndex.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/templates/user/TemplatesUserPages.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/user/UserFooter.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/user/UserHeader.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/user/UserIndex.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/user/UserNotificationUpdate.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/user/UserObjects.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/user/UserPages.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/user/UserPrint.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/user/UserRss.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/user/UserSubmit.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/user/UserXoopsVersion.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/form/TDMCreateFormRadio.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/form/TDMCreateThemeForm.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/html/TDMCreateFormLabel.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/logoGenerator.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/modules.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/tables.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/include/common.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/include/functions.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/language/english/admin.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/language/english/modinfo.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/sql/mysql.sql XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/templates/admin/tdmcreate_fields.tpl XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/templates/admin/tdmcreate_fields_item.tpl XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/templates/admin/tdmcreate_modules.tpl XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/templates/admin/tdmcreate_tables.tpl XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/templates/admin/tdmcreate_tables_item.tpl XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/xoops_version.php Modified: XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/about.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/about.php 2015-04-28 21:55:41 UTC (rev 13050) +++ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/about.php 2015-05-01 16:05:55 UTC (rev 13051) @@ -18,8 +18,8 @@ * @author Txmod Xoops http://www.txmodxoops.org * @version $Id: about.php 11084 2013-02-23 15:44:20Z timgno $ */ -include 'header.php'; -$template_main = 'tdmcreate_about.tpl'; +include __DIR__ . '/header.php'; +$template_main = 'tdmcreate_about.tpl'; $GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('about.php')); $GLOBALS['xoopsTpl']->assign('about', $adminMenu->renderAbout('6KJ7RW5DR3VTJ', false)); -include 'footer.php'; \ No newline at end of file +include __DIR__ . '/footer.php'; Modified: XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/building.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/building.php 2015-04-28 21:55:41 UTC (rev 13050) +++ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/building.php 2015-05-01 16:05:55 UTC (rev 13051) @@ -18,78 +18,72 @@ * @author Txmod Xoops http://www.txmodxoops.org * @version $Id: building.php 12258 2014-01-02 09:33:29Z timgno $ */ -include __DIR__ . DIRECTORY_SEPARATOR . 'header.php'; -$op = XoopsRequest::getString('op', 'default'); -$mid = XoopsRequest::getInt('mod_id'); -$moduleObj = $tdmcreate->getHandler('modules')->get( $mid ); +include __DIR__ . '/header.php'; +$op = XoopsRequest::getString('op', 'default'); +$mid = XoopsRequest::getInt('mod_id'); +$moduleObj = $tdmcreate->getHandler('modules')->get($mid); // Switch option switch ($op) { - case 'build': - $template_main = 'tdmcreate_building.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('building.php')); - // Get var module dirname - $moduleDirname = $moduleObj->getVar('mod_dirname'); - // Directories for copy from to - $fromDir = TDMC_UPLOAD_REPOSITORY_PATH.'/'.strtolower($moduleDirname); - $toDir = XOOPS_ROOT_PATH.'/modules/'.strtolower($moduleDirname); - if(isset($moduleDirname)) { - // Clear this module if it's in repository - if(is_dir($fromDir)) { - TDMCreate_clearDir($fromDir); - } - // Clear this module if it's in root/modules - if(is_dir($toDir)) { - TDMCreate_clearDir($toDir); - } - } - // Structure - include_once TDMC_PATH . '/class/files/TDMCreateArchitecture.php'; - $handler = TDMCreateArchitecture::getInstance(); - // Creation of the structure of folders and files - $base_architecture = $handler->createBaseFoldersFiles( $moduleObj ); - if(false !== $base_architecture) { - $GLOBALS['xoopsTpl']->assign('base_architecture', true); - } else { - $GLOBALS['xoopsTpl']->assign('base_architecture', false); - } - // Get files - $build = array(); - $files = $handler->createFilesToBuilding( $moduleObj ); - foreach($files as $file) { - if($file) { - $build['list'] = $file; - } - $GLOBALS['xoopsTpl']->append('builds', $build); - } - unset($build); - // Directory to saved all files - $GLOBALS['xoopsTpl']->assign('building_directory', sprintf(_AM_TDMCREATE_BUILDING_DIRECTORY, $moduleDirname)); - // Copy this module in root modules - if( $moduleObj->getVar('mod_inroot_copy') == 1 ) { - TDMCreate_copyr($fromDir, $toDir); + case 'build': + $template_main = 'tdmcreate_building.tpl'; + $GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('building.php')); + // Get var module dirname + $moduleDirname = $moduleObj->getVar('mod_dirname'); + // Directories for copy from to + $fromDir = TDMC_UPLOAD_REPOSITORY_PATH . '/' . strtolower($moduleDirname); + $toDir = XOOPS_ROOT_PATH . '/modules/' . strtolower($moduleDirname); + if (isset($moduleDirname)) { + // Clear this module if it's in repository + if (is_dir($fromDir)) { + TDMCreate_clearDir($fromDir); + } + // Clear this module if it's in root/modules + if (is_dir($toDir)) { + TDMCreate_clearDir($toDir); + } } - break; - - case 'default': - default: - $template_main = 'tdmcreate_building.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('building.php')); - // Redirect if there aren't modules - $nbModules = $tdmcreate->getHandler('modules')->getCount(); - if( $nbModules == 0 ) { - redirect_header('modules.php?op=new', 2, _AM_TDMCREATE_NOTMODULES ); - } - unset($nbModules); - // Redirect if there aren't tables - /*$nbTables = $tdmcreate->getHandler('tables')->getCount(); - if($nbTables == 0) { - redirect_header('tables.php?op=new', 2, _AM_TDMCREATE_NOTTABLES ); - } - unset($nbTables);*/ - include_once TDMC_PATH . '/class/building.php'; - $handler = TDMCreateBuilding::getInstance(); - $form = $handler->getForm(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; + // Structure + include_once TDMC_PATH . '/class/files/TDMCreateArchitecture.php'; + $handler = TDMCreateArchitecture::getInstance(); + // Creation of the structure of folders and files + $base_architecture = $handler->createBaseFoldersFiles($moduleObj); + if (false !== $base_architecture) { + $GLOBALS['xoopsTpl']->assign('base_architecture', true); + } else { + $GLOBALS['xoopsTpl']->assign('base_architecture', false); + } + // Get files + $build = array(); + $files = $handler->createFilesToBuilding($moduleObj); + foreach ($files as $file) { + if ($file) { + $build['list'] = $file; + } + $GLOBALS['xoopsTpl']->append('builds', $build); + } + unset($build); + // Directory to saved all files + $GLOBALS['xoopsTpl']->assign('building_directory', sprintf(_AM_TDMCREATE_BUILDING_DIRECTORY, $moduleDirname)); + // Copy this module in root modules + if (1 == $moduleObj->getVar('mod_inroot_copy')) { + TDMCreate_copyr($fromDir, $toDir); + } + break; + + case 'default': + default: + $template_main = 'tdmcreate_building.tpl'; + $GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('building.php')); + // Redirect if there aren't modules + $nbModules = $tdmcreate->getHandler('modules')->getCount(); + if (0 == $nbModules) { + redirect_header('modules.php?op=new', 2, _AM_TDMCREATE_NOTMODULES); + } + unset($nbModules); + include_once TDMC_PATH . '/class/building.php'; + $handler = TDMCreateBuilding::getInstance(); + $form = $handler->getForm(); + $GLOBALS['xoopsTpl']->assign('form', $form->render()); + break; } -include __DIR__ . DIRECTORY_SEPARATOR . 'footer.php'; \ No newline at end of file +include __DIR__ . '/footer.php'; Modified: XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/fields.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/fields.php 2015-04-28 21:55:41 UTC (rev 13050) +++ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/fields.php 2015-05-01 16:05:55 UTC (rev 13051) @@ -1,4 +1,4 @@ -<?php +<?php /* You may not change or alter any portion of this comment or credits of supporting developers from this source code or any supporting source code @@ -18,289 +18,277 @@ * @author Txmod Xoops http://www.txmodxoops.org * @version $Id: 1.91 fields.php 12258 2014-01-02 09:33:29Z timgno $ */ -include __DIR__ . DIRECTORY_SEPARATOR . 'header.php'; +include __DIR__ . '/header.php'; // Recovered value of arguments op in the URL $ $op = XoopsRequest::getString('op', 'list'); // Get fields Variables -$fieldMid = XoopsRequest::getInt('field_mid'); -$fieldTid = XoopsRequest::getInt('field_tid'); -$fieldNumb = XoopsRequest::getInt('field_numb'); +$fieldMid = XoopsRequest::getInt('field_mid'); +$fieldTid = XoopsRequest::getInt('field_tid'); +$fieldNumb = XoopsRequest::getInt('field_numb'); $fieldOrder = XoopsRequest::getInt('field_order'); -$fieldName = XoopsRequest::getString('field_name', ''); +$fieldName = XoopsRequest::getString('field_name', ''); // switch op -switch ($op) -{ - case 'list': +switch ($op) { + case 'list': default: $start = XoopsRequest::getInt('start', 0); - $limit = XoopsRequest::getInt('limit', $tdmcreate->getConfig('tables_adminpager')); - // Define main template - $template_main = 'tdmcreate_fields.tpl'; - $GLOBALS['xoTheme']->addStylesheet( 'modules/tdmcreate/assets/css/admin/style.css' ); - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/sortable.js'); - $GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('fields.php')); - $adminMenu->addItemButton(_AM_TDMCREATE_ADD_TABLE, 'tables.php?op=new', 'add'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminMenu->renderButton()); - $GLOBALS['xoopsTpl']->assign('tdmc_url', TDMC_URL); - $GLOBALS['xoopsTpl']->assign('tdmc_icons_url', TDMC_ICONS_URL); - $GLOBALS['xoopsTpl']->assign('tdmc_upload_url', TDMC_UPLOAD_URL); - $GLOBALS['xoopsTpl']->assign('tdmc_upload_imgtab_url', TDMC_UPLOAD_IMGTAB_URL); - $GLOBALS['xoopsTpl']->assign('modPathIcon16', $modPathIcon16); - $GLOBALS['xoopsTpl']->assign('sysPathIcon32', $sysPathIcon32); - // Redirect if there aren't modules - $countModules = $tdmcreate->getHandler('modules')->getCount(); - if ( $countModules == 0 ) { - redirect_header('modules.php?op=new', 2, _AM_TDMCREATE_NOTMODULES ); - } - unset($countModules); - // Redirect if there aren't tables - $handlerTables = $tdmcreate->getHandler('tables'); - $countTables = $handlerTables->getCount(); - if ($countTables == 0) { - redirect_header('tables.php?op=new', 2, _AM_TDMCREATE_NOTTABLES ); - } - unset($countTables); - // Get the list of tables - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('table_mid', $handlerTables->getVar('table_mid'))); - $criteria->setStart($start); + $limit = XoopsRequest::getInt('limit', $tdmcreate->getConfig('tables_adminpager')); + // Define main template + $template_main = 'tdmcreate_fields.tpl'; + $GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css'); + $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); + $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/sortable.js'); + $GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('fields.php')); + $adminMenu->addItemButton(_AM_TDMCREATE_ADD_TABLE, 'tables.php?op=new', 'add'); + $GLOBALS['xoopsTpl']->assign('buttons', $adminMenu->renderButton()); + $GLOBALS['xoopsTpl']->assign('tdmc_url', TDMC_URL); + $GLOBALS['xoopsTpl']->assign('tdmc_icons_url', TDMC_ICONS_URL); + $GLOBALS['xoopsTpl']->assign('tdmc_upload_url', TDMC_UPLOAD_URL); + $GLOBALS['xoopsTpl']->assign('tdmc_upload_imgtab_url', TDMC_UPLOAD_IMGTAB_URL); + $GLOBALS['xoopsTpl']->assign('modPathIcon16', $modPathIcon16); + $GLOBALS['xoopsTpl']->assign('sysPathIcon32', $sysPathIcon32); + // Redirect if there aren't modules + $countModules = $tdmcreate->getHandler('modules')->getCount(); + if (0 == $countModules) { + redirect_header('modules.php?op=new', 2, _AM_TDMCREATE_NOTMODULES); + } + unset($countModules); + // Redirect if there aren't tables + $handlerTables = $tdmcreate->getHandler('tables'); + $countTables = $handlerTables->getCount(); + if (0 == $countTables) { + redirect_header('tables.php?op=new', 2, _AM_TDMCREATE_NOTTABLES); + } + unset($countTables); + // Get the list of tables + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('table_mid', $handlerTables->getVar('table_mid'))); + $criteria->setStart($start); $criteria->setLimit($limit); - $criteria->setSort('table_id ASC, table_order ASC, table_name'); - $criteria->setOrder('ASC'); - $countTables = $tdmcreate->getHandler('tables')->getCount($criteria); - $tablesAll = $tdmcreate->getHandler('tables')->getAll($criteria); - unset($criteria); - if ($countTables > 0) - { - $tlid = 1; - foreach (array_keys($tablesAll) as $tid) - { - // Display tables list - $table['id'] = $tid; - $table['lid'] = $tlid; - $table['mid'] = $tablesAll[$tid]->getVar('table_mid'); - $table['name'] = ucfirst($tablesAll[$tid]->getVar('table_name')); - $table['image'] = $tablesAll[$tid]->getVar('table_image'); - $table['nbfields'] = $tablesAll[$tid]->getVar('table_nbfields'); - $table['order'] = $tablesAll[$tid]->getVar('table_order'); - $table['autoincrement'] = $tablesAll[$tid]->getVar('table_autoincrement'); - $table['blocks'] = $tablesAll[$tid]->getVar('table_blocks'); - $table['admin'] = $tablesAll[$tid]->getVar('table_admin'); - $table['user'] = $tablesAll[$tid]->getVar('table_user'); - $table['search'] = $tablesAll[$tid]->getVar('table_search'); + $criteria->setSort('table_id ASC, table_order ASC, table_name'); + $criteria->setOrder('ASC'); + $countTables = $tdmcreate->getHandler('tables')->getCount($criteria); + $tablesAll = $tdmcreate->getHandler('tables')->getAll($criteria); + unset($criteria); + if ($countTables > 0) { + $tlid = 1; + foreach (array_keys($tablesAll) as $tid) { + // Display tables list + $table['id'] = $tid; + $table['lid'] = $tlid; + $table['mid'] = $tablesAll[$tid]->getVar('table_mid'); + $table['name'] = ucfirst($tablesAll[$tid]->getVar('table_name')); + $table['image'] = $tablesAll[$tid]->getVar('table_image'); + $table['nbfields'] = $tablesAll[$tid]->getVar('table_nbfields'); + $table['order'] = $tablesAll[$tid]->getVar('table_order'); + $table['autoincrement'] = $tablesAll[$tid]->getVar('table_autoincrement'); + $table['blocks'] = $tablesAll[$tid]->getVar('table_blocks'); + $table['admin'] = $tablesAll[$tid]->getVar('table_admin'); + $table['user'] = $tablesAll[$tid]->getVar('table_user'); + $table['search'] = $tablesAll[$tid]->getVar('table_search'); // Get the list of fields - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('field_mid', $table['mid'])); - $criteria->add(new Criteria('field_tid', $tid)); - $criteria->setSort('field_order ASC, field_id ASC, field_name'); - $criteria->setOrder('ASC'); - $countFields = $tdmcreate->getHandler('fields')->getCount($criteria); - $fieldsAll = $tdmcreate->getHandler('fields')->getObjects($criteria); - unset($criteria); - // Display fields list - $fields = array(); - $lid = 1; - if ( $countFields > 0 ) - { - foreach (array_keys($fieldsAll) as $fid) - { - $field['id'] = $fid; - $field['lid'] = $lid; - $field['order'] = $fieldsAll[$fid]->getVar('field_order'); - $field['name'] = str_replace('_', ' ', ucfirst($fieldsAll[$fid]->getVar('field_name'))); - $field['parent'] = $fieldsAll[$fid]->getVar('field_parent'); - $field['inlist'] = $fieldsAll[$fid]->getVar('field_inlist'); - $field['inform'] = $fieldsAll[$fid]->getVar('field_inform'); - $field['admin'] = $fieldsAll[$fid]->getVar('field_admin'); - $field['user'] = $fieldsAll[$fid]->getVar('field_user'); - $field['block'] = $fieldsAll[$fid]->getVar('field_block'); - $field['main'] = $fieldsAll[$fid]->getVar('field_main'); - $field['search'] = $fieldsAll[$fid]->getVar('field_search'); - $field['required'] = $fieldsAll[$fid]->getVar('field_required'); - $fields[] = $field; - unset($field); - $lid++; - } - } - $tlid++; - unset($lid); - $table['fields'] = $fields; - $GLOBALS['xoopsTpl']->append('tables_list', $table); - unset($table); - } - unset($tlid); - unset($fields); - if ( $countTables > $limit ) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new XoopsPageNav($countTables, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); - } - } else { - $GLOBALS['xoopsTpl']->assign('error', _AM_TDMCREATE_THEREARENT_FIELDS); - } - break; - - case 'new': - // Define main template - $template_main = 'tdmcreate_fields.tpl'; - $GLOBALS['xoTheme']->addStylesheet( 'modules/tdmcreate/assets/css/admin/style.css' ); - $GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('fields.php')); - $adminMenu->addItemButton(_AM_TDMCREATE_TABLES_LIST, 'tables.php', 'list'); - $adminMenu->addItemButton(_AM_TDMCREATE_FIELDS_LIST, 'fields.php', 'list'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminMenu->renderButton()); - // Form Add - $fieldsObj =& $tdmcreate->getHandler('fields')->create(); - $form = $fieldsObj->getFormNew($fieldMid, $fieldTid, $fieldNumb, $fieldName); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; - - case 'save': + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('field_mid', $table['mid'])); + $criteria->add(new Criteria('field_tid', $tid)); + $criteria->setSort('field_order ASC, field_id ASC, field_name'); + $criteria->setOrder('ASC'); + $countFields = $tdmcreate->getHandler('fields')->getCount($criteria); + $fieldsAll = $tdmcreate->getHandler('fields')->getObjects($criteria); + unset($criteria); + // Display fields list + $fields = array(); + $lid = 1; + if ($countFields > 0) { + foreach (array_keys($fieldsAll) as $fid) { + $field['id'] = $fid; + $field['lid'] = $lid; + $field['order'] = $fieldsAll[$fid]->getVar('field_order'); + $field['name'] = str_replace('_', ' ', ucfirst($fieldsAll[$fid]->getVar('field_name'))); + $field['parent'] = $fieldsAll[$fid]->getVar('field_parent'); + $field['inlist'] = $fieldsAll[$fid]->getVar('field_inlist'); + $field['inform'] = $fieldsAll[$fid]->getVar('field_inform'); + $field['admin'] = $fieldsAll[$fid]->getVar('field_admin'); + $field['user'] = $fieldsAll[$fid]->getVar('field_user'); + $field['block'] = $fieldsAll[$fid]->getVar('field_block'); + $field['main'] = $fieldsAll[$fid]->getVar('field_main'); + $field['search'] = $fieldsAll[$fid]->getVar('field_search'); + $field['required'] = $fieldsAll[$fid]->getVar('field_required'); + $fields[] = $field; + unset($field); + ++$lid; + } + } + ++$tlid; + unset($lid); + $table['fields'] = $fields; + $GLOBALS['xoopsTpl']->append('tables_list', $table); + unset($table); + } + unset($tlid, $fields); + if ($countTables > $limit) { + include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; + $pagenav = new XoopsPageNav($countTables, $limit, $start, 'start', 'op=list&limit=' . $limit); + $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); + } + } else { + $GLOBALS['xoopsTpl']->assign('error', _AM_TDMCREATE_THEREARENT_FIELDS); + } + break; + + case 'new': + // Define main template + $template_main = 'tdmcreate_fields.tpl'; + $GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css'); + $GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('fields.php')); + $adminMenu->addItemButton(_AM_TDMCREATE_TABLES_LIST, 'tables.php', 'list'); + $adminMenu->addItemButton(_AM_TDMCREATE_FIELDS_LIST, 'fields.php', 'list'); + $GLOBALS['xoopsTpl']->assign('buttons', $adminMenu->renderButton()); + // Form Add + $fieldsObj =& $tdmcreate->getHandler('fields')->create(); + $form = $fieldsObj->getFormNew($fieldMid, $fieldTid, $fieldNumb, $fieldName); + $GLOBALS['xoopsTpl']->assign('form', $form->render()); + break; + + case 'save': + // + if (!$GLOBALS['xoopsSecurity']->check()) { + redirect_header('fields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + } + $fieldId = XoopsRequest::getInt('field_id'); + // Fields Handler + $fields = $tdmcreate->getHandler('fields'); // - if ( !$GLOBALS['xoopsSecurity']->check() ) { - redirect_header('fields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - $fieldId = XoopsRequest::getInt('field_id'); - // Fields Handler - $fields = $tdmcreate->getHandler('fields'); - // Set Variables - foreach($_POST['field_id'] as $key => $value) - { - if(isset($value)){ - $fieldsObj =& $fields->get($value); - } else { - $fieldsObj =& $fields->create(); - } - $order = $fieldsObj->isNew() ? $fieldOrder + 1 : $fieldOrder; - if (isset($fieldMid) && isset($fieldTid) && !empty($_POST['field_name'][$key])) { - // Set Data - $fieldsObj->setVar( 'field_mid', $fieldMid ); - $fieldsObj->setVar( 'field_tid', $fieldTid ); - $fieldsObj->setVar( 'field_numb', $fieldNumb ); - $fieldsObj->setVar( 'field_order', (isset($_POST['field_order'][$key]) ? $_POST['field_order'][$key] : $order) ); - $fieldsObj->setVar( 'field_name', (!empty($_POST['field_name'][$key]) ? $_POST['field_name'][$key] : '') ); - $fieldsObj->setVar( 'field_type', (!empty($_POST['field_type'][$key]) ? $_POST['field_type'][$key] : '') ); - $fieldsObj->setVar( 'field_value', (!empty($_POST['field_value'][$key]) ? $_POST['field_value'][$key] : '') ); - $fieldsObj->setVar( 'field_attribute', (!empty($_POST['field_attribute'][$key]) ? $_POST['field_attribute'][$key] : '') ); - $fieldsObj->setVar( 'field_null', (!empty($_POST['field_null'][$key]) ? $_POST['field_null'][$key] : '') ); - $fieldsObj->setVar( 'field_default', (!empty($_POST['field_default'][$key]) ? $_POST['field_default'][$key] : '') ); - $fieldsObj->setVar( 'field_key', (!empty($_POST['field_key'][$key]) ? $_POST['field_key'][$key] : '') ); - $fieldsObj->setVar( 'field_element', (!empty($_POST['field_element'][$key]) ? $_POST['field_element'][$key] : '') ); - $fieldsObj->setVar( 'field_parent', ((isset($_REQUEST['field_parent'][$key]) == 1) ? 1 : 0) ); - $fieldsObj->setVar( 'field_inlist', ((isset($_REQUEST['field_inlist'][$key]) == 1) ? 1 : 0) ); - $fieldsObj->setVar( 'field_inform', ((isset($_REQUEST['field_inform'][$key]) == 1) ? 1 : 0) ); - $fieldsObj->setVar( 'field_admin', ((isset($_REQUEST['field_admin'][$key]) == 1) ? 1 : 0) ); - $fieldsObj->setVar( 'field_user', ((isset($_REQUEST['field_user'][$key]) == 1) ? 1 : 0) ); - $fieldsObj->setVar( 'field_block', ((isset($_REQUEST['field_block'][$key]) == 1) ? 1 : 0) ); - $fieldsObj->setVar( 'field_main', (($key == $_REQUEST['field_main']) ? 1 : 0) ); - $fieldsObj->setVar( 'field_search', ((isset($_REQUEST['field_search'][$key]) == 1) ? 1 : 0) ); - $fieldsObj->setVar( 'field_required', ((isset($_REQUEST['field_required'][$key]) == 1) ? 1 : 0) ); - // Insert Data - $tdmcreate->getHandler('fields')->insert($fieldsObj); - } - $orderId++; - } - unset($orderId); - // Get table name from field table id - $tables =& $tdmcreate->getHandler('tables')->get($fieldTid); - $tableName = $tables->getVar('table_name'); - // Set field elements - if ($fieldsObj->isNew()) { - // Fields Elements Handler - $fieldelementObj =& $tdmcreate->getHandler('fieldelements')->create(); - $fieldelementObj->setVar( 'fieldelement_mid', $fieldMid ); - $fieldelementObj->setVar( 'fieldelement_tid', $fieldTid ); - $fieldelementObj->setVar( 'fieldelement_name', 'Table : '.ucfirst($tableName) ); - $fieldelementObj->setVar( 'fieldelement_value', 'XoopsFormTables-'.ucfirst($tableName) ); - // Insert new field element id for table name - if (!$tdmcreate->getHandler('fieldelements')->insert($fieldelementObj) ) { - $GLOBALS['xoopsTpl']->assign('error', $fieldelementObj->getHtmlErrors() . ' Field element'); - } - redirect_header('fields.php', 2, sprintf(_AM_TDMCREATE_FIELDS_FORM_SAVED_OK, $tableName)); - } else { - // Needed code from table name by field_tid - redirect_header('fields.php', 2, sprintf(_AM_TDMCREATE_FIELDS_FORM_UPDATED_OK, $tableName)); - } + $order = $fieldsObj->isNew() ? $fieldOrder + 1 : $fieldOrder; + // Set Variables + foreach ($_POST['field_id'] as $key => $value) { + if (isset($value)) { + $fieldsObj =& $fields->get($value); + } else { + $fieldsObj =& $fields->create(); + } + // Set Data + $fieldsObj->setVar('field_mid', $fieldMid); + $fieldsObj->setVar('field_tid', $fieldTid); + $fieldsObj->setVar('field_order', $_POST['field_name'][$key] ? $_POST['field_name'][$key] : $order); + $fieldsObj->setVar('field_name', $_POST['field_name'][$key] ? $_POST['field_name'][$key] : ''); + $fieldsObj->setVar('field_type', $_POST['field_type'][$key] ? $_POST['field_type'][$key] : ''); + $fieldsObj->setVar('field_value', $_POST['field_value'][$key] ? $_POST['field_value'][$key] : ''); + $fieldsObj->setVar('field_attribute', ($_POST['field_attribute'][$key] ? $_POST['field_attribute'][$key] : ''); + $fieldsObj->setVar('field_null', $_POST['field_null'][$key] ? $_POST['field_null'][$key] : ''); + $fieldsObj->setVar('field_default', $_POST['field_default'][$key] ? $_POST['field_default'][$key] : ''); + $fieldsObj->setVar('field_key', $_POST['field_key'][$key] ? $_POST['field_key'][$key] : ''); + $fieldsObj->setVar('field_element', $_POST['field_element'][$key] ? $_POST['field_element'][$key] : ''); + $fieldsObj->setVar('field_parent', ($_REQUEST['field_parent'][$key] == 1) ? 1 : 0); + $fieldsObj->setVar('field_inlist', ($_REQUEST['field_inlist'][$key] == 1) ? 1 : 0); + $fieldsObj->setVar('field_inform', ($_REQUEST['field_inform'][$key] == 1) ? 1 : 0); + $fieldsObj->setVar('field_admin', ($_REQUEST['field_admin'][$key] == 1) ? 1 : 0); + $fieldsObj->setVar('field_user', ($_REQUEST['field_user'][$key] == 1) ? 1 : 0); + $fieldsObj->setVar('field_block', ($_REQUEST['field_block'][$key] == 1) ? 1 : 0); + $fieldsObj->setVar('field_main', ($key == $_REQUEST['field_main'] ? 1 : 0)); + $fieldsObj->setVar('field_search', ($_REQUEST['field_search'][$key] == 1) ? 1 : 0); + $fieldsObj->setVar('field_required', ($_REQUEST['field_required'][$key] == 1) ? 1 : 0); + // Insert Data + $tdmcreate->getHandler('fields')->insert($fieldsObj); + } + // Get table name from field table id + $tables =& $tdmcreate->getHandler('tables')->get($fieldTid); + $tableName = $tables->getVar('table_name'); + // Set field elements + if ($fieldsObj->isNew()) { + // Fields Elements Handler + $fieldelementObj =& $tdmcreate->getHandler('fieldelements')->create(); + $fieldelementObj->setVar('fieldelement_mid', $fieldMid); + $fieldelementObj->setVar('fieldelement_tid', $fieldTid); + $fieldelementObj->setVar('fieldelement_name', 'Table : ' . ucfirst($tableName)); + $fieldelementObj->setVar('fieldelement_value', 'XoopsFormTables-' . ucfirst($tableName)); + // Insert new field element id for table name + if (!$tdmcreate->getHandler('fieldelements')->insert($fieldelementObj)) { + $GLOBALS['xoopsTpl']->assign('error', $fieldelementObj->getHtmlErrors() . ' Field element'); + } + redirect_header('fields.php', 2, sprintf(_AM_TDMCREATE_FIELDS_FORM_SAVED_OK, $tableName)); + } else { + // Needed code from table name by field_tid + redirect_header('fields.php', 2, sprintf(_AM_TDMCREATE_FIELDS_FORM_UPDATED_OK, $tableName)); + } // - $GLOBALS['xoopsTpl']->assign('error', $fieldsObj->getHtmlErrors()); - $form = $fieldsObj->getForm(null, $fieldTid); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; - - case 'edit': - // Define main template - $template_main = 'tdmcreate_fields.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('fields.php')); - $adminMenu->addItemButton(_AM_TDMCREATE_ADD_TABLE, 'tables.php?op=new', 'add'); - $adminMenu->addItemButton(_AM_TDMCREATE_TABLES_LIST, 'tables.php', 'list'); - $adminMenu->addItemButton(_AM_TDMCREATE_FIELDS_LIST, 'fields.php', 'list'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminMenu->renderButton()); - // Form Edit - $fieldId = XoopsRequest::getInt('field_id'); - $fieldsObj = $tdmcreate->getHandler('fields')->get( $fieldId ); - $form = $fieldsObj->getFormEdit($fieldMid, $fieldTid, $fieldNumb); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; - - case 'order': - // Initialize fields handler + $GLOBALS['xoopsTpl']->assign('error', $fieldsObj->getHtmlErrors()); + $form = $fieldsObj->getForm(null, $fieldTid); + $GLOBALS['xoopsTpl']->assign('form', $form->render()); + break; + + case 'edit': + // Define main template + $template_main = 'tdmcreate_fields.tpl'; + $GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('fields.php')); + $adminMenu->addItemButton(_AM_TDMCREATE_ADD_TABLE, 'tables.php?op=new', 'add'); + $adminMenu->addItemButton(_AM_TDMCREATE_TABLES_LIST, 'tables.php', 'list'); + $adminMenu->addItemButton(_AM_TDMCREATE_FIELDS_LIST, 'fields.php', 'list'); + $GLOBALS['xoopsTpl']->assign('buttons', $adminMenu->renderButton()); + // Form Edit + $fieldId = XoopsRequest::getInt('field_id'); + $fieldsObj = $tdmcreate->getHandler('fields')->get($fieldId); + $form = $fieldsObj->getFormEdit($fieldMid, $fieldTid); + $GLOBALS['xoopsTpl']->assign('form', $form->render()); + break; + + case 'order': + // Initialize fields handler $fieldsObj = $tdmcreate->getHandler('fields'); - if ( isset($_POST['forder'] ) ) { + if (isset($_POST['forder'])) { $i = 0; - foreach($_POST['forder'] as $order) { - if( $order > 0 ) { + foreach ($_POST['forder'] as $order) { + if ($order > 0) { $fieldOrder = $fieldsObj->get($order); $fieldOrder->setVar('field_order', $i); if (!$fieldsObj->insert($fieldOrder)) { - $error=true; + $error = true; } - $i++; + ++$i; } } - redirect_header('fields.php', 5, _AM_TDMCREATE_FIELD_ORDER_ERROR); - unset($i); + redirect_header('fields.php', 5, _AM_TDMCREATE_FIELD_ORDER_ERROR); + unset($i); } exit; - break; + break; - case 'delete': - $tablesObj =& $tdmcreate->getHandler('tables')->get($fieldTid); - if (isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1) { - if ( !$GLOBALS['xoopsSecurity']->check() ) { - redirect_header('fields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - if ($tdmcreate->getHandler('tables')->delete($tablesObj)) { - redirect_header('fields.php', 3, _AM_TDMCREATE_FORMDELOK); - } else { - echo $tablesObj->getHtmlErrors(); - } + case 'delete': + $tablesObj =& $tdmcreate->getHandler('tables')->get($fieldTid); + if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { + if (!$GLOBALS['xoopsSecurity']->check()) { + redirect_header('fields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + } + if ($tdmcreate->getHandler('tables')->delete($tablesObj)) { + redirect_header('fields.php', 3, _AM_TDMCREATE_FORMDELOK); + } else { + echo $tablesObj->getHtmlErrors(); + } + } else { + xoops_confirm(array('ok' => 1, 'field_tid' => $fieldTid, 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_TDMCREATE_FORMSUREDEL, $tablesObj->getVar('table_name'))); + } + break; + + case 'display': + // Fields Handler + $fields = $tdmcreate->getHandler('fields'); + // + foreach ($_POST['field_id'] as $key => $value) { + $fieldsObj =& $fields->get($value); + $fieldsObj->setVar('field_parent', ($_REQUEST['field_parent'][$key] == 1) ? 0 : 1); + $fieldsObj->setVar('field_inlist', ($_REQUEST['field_inlist'][$key] == 1) ? 0 : 1); + $fieldsObj->setVar('field_inform', ($_REQUEST['field_inform'][$key] == 1) ? 0 : 1); + $fieldsObj->setVar('field_admin', ($_REQUEST['field_admin'][$key] == 1) ? 0 : 1); + $fieldsObj->setVar('field_user', ($_REQUEST['field_user'][$key] == 1) ? 0 : 1); + $fieldsObj->setVar('field_block', ($_REQUEST['field_block'][$key] == 1) ? 0 : 1); + $fieldsObj->setVar('field_main', ($key == $_REQUEST['field_main']) ? 0 : 1); + $fieldsObj->setVar('field_search', ($_REQUEST['field_search'][$key] == 1) ? 0 : 1); + $fieldsObj->setVar('field_required', ($_REQUEST['field_required'][$key] == 1) ? 0 : 1); + } + if ($fieldsObj->insert($fieldsObj, true)) { + redirect_header('fields.php', 3, _AM_TDMCREATE_TOGGLE_SUCCESS); } else { - xoops_confirm(array('ok' => 1, 'field_tid' => $fieldTid, 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_TDMCREATE_FORMSUREDEL, $tablesObj->getVar('table_name'))); + redirect_header('fields.php', 3, _AM_TDMCREATE_TOGGLE_FAILED); } - break; - - case 'display': - // - $fields = $tdmcreate->getHandler('fields'); - // Fields Handler - foreach($_POST['field_id'] as $key => $value) - { - $fieldsObj =& $fields->get($value); - $fieldsObj->setVar( 'field_parent', ((isset($_REQUEST['field_parent'][$key]) == 1) ? 1 : 0) ); - $fieldsObj->setVar( 'field_inlist', ((isset($_REQUEST['field_inlist'][$key]) == 1) ? 1 : 0) ); - $fieldsObj->setVar( 'field_inform', ((isset($_REQUEST['field_inform'][$key]) == 1) ? 1 : 0) ); - $fieldsObj->setVar( 'field_admin', ((isset($_REQUEST['field_admin'][$key]) == 1) ? 1 : 0) ); - $fieldsObj->setVar( 'field_user', ((isset($_REQUEST['field_user'][$key]) == 1) ? 1 : 0) ); - $fieldsObj->setVar( 'field_block', ((isset($_REQUEST['field_block'][$key]) == 1) ? 1 : 0) ); - $fieldsObj->setVar( 'field_main', (($key == $_REQUEST['field_main']) ? 1 : 0) ); - $fieldsObj->setVar( 'field_search', ((isset($_REQUEST['field_search'][$key]) == 1) ? 1 : 0) ); - $fieldsObj->setVar( 'field_required', ((isset($_REQUEST['field_required'][$key]) == 1) ? 1 : 0) ); - if ($fieldsObj->insert($fieldsObj, true)) { - redirect_header('fields.php', 3, _AM_TDMCREATE_TOGGLE_SUCCESS); - } else { - redirect_header('fields.php', 3, _AM_TDMCREATE_TOGGLE_FAILED); - } - } - break; + break; } -include __DIR__ . DIRECTORY_SEPARATOR . 'footer.php'; \ No newline at end of file +include __DIR__ . '/footer.php'; Modified: XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/footer.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/footer.php 2015-04-28 21:55:41 UTC (rev 13050) +++ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/footer.php 2015-05-01 16:05:55 UTC (rev 13051) @@ -19,8 +19,7 @@ * @version $Id: footer.php 12207 2013-10-23 02:46:52Z beckmi $ */ $GLOBALS['xoopsTpl']->assign('module_name', $GLOBALS['xoopsModule']->getVar('name')); -if ( isset($template_main) ) { +if (isset($template_main)) { $GLOBALS['xoopsTpl']->display("db:{$template_main}"); } xoops_cp_footer(); -?> \ No newline at end of file Modified: XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/header.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/header.php 2015-04-28 21:55:41 UTC (rev 13050) +++ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/header.php 2015-05-01 16:05:55 UTC (rev 13051) @@ -17,25 +17,25 @@ * @since 2.5.0 * @author Txmod Xoops http://www.txmodxoops.org * @version $Id: header.php 12258 2014-01-02 09:33:29Z timgno $ -*/ -include_once dirname(dirname(dirname(dirname(__FILE__)))) . '/include/cp_header.php'; -include_once dirname(dirname(__FILE__)) . '/include/common.php'; + */ +include_once dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php'; +include_once dirname(__DIR__) . '/include/common.php'; // $thisDirname = $GLOBALS['xoopsModule']->getVar('dirname'); // Link System Icons $sysPathIcon16 = $GLOBALS['xoopsModule']->getInfo('sysicons16'); $sysPathIcon32 = $GLOBALS['xoopsModule']->getInfo('sysicons32'); // Link Local Icons -$modPathIcon16 = $GLOBALS['xoopsModule']->getInfo('modicons16'); -$modPathIcon32 = $GLOBALS['xoopsModule']->getInfo('modicons32'); +$modPathIcon16 = $GLOBALS['xoopsModule']->getInfo('modicons16'); +$modPathIcon32 = $GLOBALS['xoopsModule']->getInfo('modicons32'); $pathModuleAdmin = $GLOBALS['xoopsModule']->getInfo('dirmoduleadmin'); // TDMCreate Instance $tdmcreate = TDMCreateHelper::getInstance(); // MyTextSanitizer $myts =& MyTextSanitizer::getInstance(); if (!isset($xoopsTpl) || !is_object($xoopsTpl)) { - include_once(XOOPS_ROOT_PATH."/class/template.php"); - $xoopsTpl = new XoopsTpl(); + include_once(XOOPS_ROOT_PATH . "/class/template.php"); + $xoopsTpl = new XoopsTpl(); } // System Icons $GLOBALS['xoopsTpl']->assign('sysPathIcon16', $sysPathIcon16); @@ -48,10 +48,10 @@ xoops_loadLanguage('modinfo', $thisDirname); xoops_loadLanguage('main', $thisDirname); // Locad admin menu class -if ( file_exists($GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'))){ - include_once $GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'); -}else{ - redirect_header("../../../admin.php", 5, _AM_MODULEADMIN_MISSING, false); +if (file_exists($GLOBALS['xoops']->path($pathModuleAdmin . '/moduleadmin.php'))) { + include_once $GLOBALS['xoops']->path($pathModuleAdmin . '/moduleadmin.php'); +} else { + redirect_header("../../../admin.php", 5, _AM_MODULEADMIN_MISSING, false); } xoops_cp_header(); -$adminMenu = new ModuleAdmin(); \ No newline at end of file +$adminMenu = new ModuleAdmin(); Modified: XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/index.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/index.php 2015-04-28 21:55:41 UTC (rev 13050) +++ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/index.php 2015-05-01 16:05:55 UTC (rev 13051) @@ -18,18 +18,18 @@ * @author Txmod Xoops http://www.txmodxoops.org * @version $Id: index.php 11084 2013-02-23 15:44:20Z timgno $ */ -include __DIR__ . DIRECTORY_SEPARATOR . 'header.php'; -$criteria = new CriteriaCompo(); +include __DIR__ . '/header.php'; +$criteria = new CriteriaCompo(); $count_modules = $tdmcreate->getHandler('modules')->getCount($criteria); -$count_tables = $tdmcreate->getHandler('tables')->getCount($criteria); -$count_fields = $tdmcreate->getHandler('fields')->getCount($criteria); +$count_tables = $tdmcreate->getHandler('tables')->getCount($criteria); +$count_fields = $tdmcreate->getHandler('fields')->getCount($criteria); unset($criteria); $template_main = 'tdmcreate_index.tpl'; -$adminMenu->addInfoBox(_AM_TDMCREATE_ADMIN_NUMMODULES) ; -$adminMenu->addInfoBoxLine(_AM_TDMCREATE_ADMIN_NUMMODULES, '<label>' ._AM_TDMCREATE_THEREARE_NUMMODULES. '</label>', $count_modules, 'Green') ; -$adminMenu->addInfoBoxLine(_AM_TDMCREATE_ADMIN_NUMMODULES, '<label>' ._AM_TDMCREATE_THEREARE_NUMTABLES. '</label>', $count_tables, 'Orange'); -$adminMenu->addInfoBoxLine(_AM_TDMCREATE_ADMIN_NUMMODULES, '<label>' ._AM_TDMCREATE_THEREARE_NUMFIELDS. '</label>', $count_fields, 'Gray'); -//$xoopsOption['template_main'] = 'tdmcreate_index.html'; +$adminMenu->addInfoBox(_AM_TDMCREATE_ADMIN_NUMMODULES); +$adminMenu->addInfoBoxLine(_AM_TDMCREATE_ADMIN_NUMMODULES, '<label>' . _AM_TDMCREATE_THEREARE_NUMMODULES . '</label>', $count_modules, 'Green'); +$adminMenu->addInfoBoxLine(_AM_TDMCREATE_ADMIN_NUMMODULES, '<label>' . _AM_TDMCREATE_THEREARE_NUMTABLES . '</label>', $count_tables, 'Orange'); +$adminMenu->addInfoBoxLine(_AM_TDMCREATE_ADMIN_NUMMODULES, '<label>' . _AM_TDMCREATE_THEREARE_NUMFIELDS . '</label>', $count_fields, 'Gray'); +//$xoopsOption['template_main'] = 'tdmcreate_index.html'; $GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('index.php')); $GLOBALS['xoopsTpl']->assign('index', $adminMenu->renderIndex()); -include __DIR__ . DIRECTORY_SEPARATOR . 'footer.php'; \ No newline at end of file +include __DIR__ . '/footer.php'; Modified: XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/menu.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/menu.php 2015-04-28 21:55:41 UTC (rev 13050) +++ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/menu.php 2015-05-01 16:05:55 UTC (rev 13051) @@ -18,33 +18,33 @@ * @author Txmod Xoops http://www.txmodxoops.org * @version $Id: menu.php 11084 2013-02-23 15:44:20Z timgno $ */ -$module_handler =& xoops_gethandler('module'); -$xoopsModule =& XoopsModule::getByDirname('TDMCreate'); -$moduleInfo =& $module_handler->get($xoopsModule->getVar('mid')); -$sysPathIcon32 = $moduleInfo->getInfo('sysicons32'); -$adminmenu = array(); -$i = 1; +$module_handler =& xoops_gethandler('module'); +$xoopsModule =& XoopsModule::getByDirname('TDMCreate'); +$moduleInfo =& $module_handler->get($xoopsModule->getVar('mid')); +$sysPathIcon32 = $moduleInfo->getInfo('sysicons32'); +$adminmenu = array(); +$i = 1; $adminmenu[$i]['title'] = _MI_TDMCREATE_ADMENU1; -$adminmenu[$i]['link'] = 'admin/index.php'; -$adminmenu[$i]['icon'] = $sysPathIcon32.'/dashboard.png'; +$adminmenu[$i]['link'] = 'admin/index.php'; +$adminmenu[$i]['icon'] = $sysPathIcon32 . '/dashboard.png'; $i++; $adminmenu[$i]['title'] = _MI_TDMCREATE_ADMENU2; -$adminmenu[$i]['link'] = 'admin/modules.php'; -$adminmenu[$i]['icon'] = 'assets/icons/32/addmodule.png'; +$adminmenu[$i]['link'] = 'admin/modules.php'; +$adminmenu[$i]['icon'] = 'assets/icons/32/addmodule.png'; $i++; $adminmenu[$i]['title'] = _MI_TDMCREATE_ADMENU3; -$adminmenu[$i]['link'] = 'admin/tables.php'; -$adminmenu[$i]['icon'] = 'assets/icons/32/addtable.png'; +$adminmenu[$i]['link'] = 'admin/tables.php'; +$adminmenu[$i]['icon'] = 'assets/icons/32/addtable.png'; $i++; $adminmenu[$i]['title'] = _MI_TDMCREATE_ADMENU4; -$adminmenu[$i]['link'] = 'admin/fields.php'; -$adminmenu[$i]['icon'] = 'assets/icons/32/fields.png'; +$adminmenu[$i]['link'] = 'admin/fields.php'; +$adminmenu[$i]['icon'] = 'assets/icons/32/fields.png'; $i++; $adminmenu[$i]['title'] = _MI_TDMCREATE_ADMENU5; -$adminmenu[$i]['link'] = 'admin/building.php'; -$adminmenu[$i]['icon'] = 'assets/icons/32/builder.png'; +$adminmenu[$i]['link'] = 'admin/building.php'; +$adminmenu[$i]['icon'] = 'assets/icons/32/builder.png'; $i++; $adminmenu[$i]['title'] = _MI_TDMCREATE_ADMENU6; -$adminmenu[$i]['link'] = 'admin/about.php'; -$adminmenu[$i]['icon'] = $sysPathIcon32.'/about.png'; -unset($i); \ No newline at end of file +$adminmenu[$i]['link'] = 'admin/about.php'; +$adminmenu[$i]['icon'] = $sysPathIcon32 . '/about.png'; +unset($i); Modified: XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/modules.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/modules.php 2015-04-28 21:55:41 UTC (rev 13050) +++ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/modules.php 2015-05-01 16:05:55 UTC (rev 13051) @@ -1,4 +1,4 @@ -<?php +<?php /* You may not change or alter any portion of this comment or credits of supporting developers from this source code or any supporting source code @@ -18,237 +18,235 @@ * @author Txmod Xoops <su...@tx...> * @version $Id: 1.59 modules.php 11297 2013-03-24 10:58:10Z timgno $ */ -include __DIR__ . DIRECTORY_SEPARATOR . 'header.php'; -// Recovered value of argument op in the URL $ +include __DIR__ . '/header.php'; +// Recovered value of argument op in the URL $ $op = XoopsRequest::getString('op', 'list'); // $mod_id = XoopsRequest::getInt('mod_id'); // -switch ($op) -{ - case 'list': - default: - $start = XoopsRequest::getInt('start', 0); +switch ($op) { + case 'list': + default: + $start = XoopsRequest::getInt('start', 0); $limit = XoopsRequest::getInt('limit', $tdmcreate->getConfig('modules_adminpager')); - // Define main template - $template_main = 'tdmcreate_modules.tpl'; - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); - $GLOBALS['xoTheme']->addStylesheet( 'modules/tdmcreate/assets/css/admin/style.css' ); + // Define main template + $template_main = 'tdmcreate_modules.tpl'; + $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); + $GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css'); $GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('modules.php')); - $adminMenu->addItemButton(_AM_TDMCREATE_ADD_MODULE, 'modules.php?op=new', 'add'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminMenu->renderButton()); - $GLOBALS['xoopsTpl']->assign('tdmc_url', TDMC_URL); - $GLOBALS['xoopsTpl']->assign('tdmc_upload_imgmod_url', TDMC_UPLOAD_IMGMOD_URL); - $GLOBALS['xoopsTpl']->assign('modPathIcon16', $modPathIcon16); - $GLOBALS['xoopsTpl']->assign('sysPathIcon32', $sysPathIcon32); - $criteria = new CriteriaCompo(); - $criteria->setStart($start); + $adminMenu->addItemButton(_AM_TDMCREATE_ADD_MODULE, 'modules.php?op=new', 'add'); + $GLOBALS['xoopsTpl']->assign('buttons', $adminMenu->renderButton()); + $GLOBALS['xoopsTpl']->assign('tdmc_url', TDMC_URL); + $GLOBALS['xoopsTpl']->assign('tdmc_upload_imgmod_url', TDMC_UPLOAD_IMGMOD_URL); + $GLOBALS['xoopsTpl']->assign('modPathIcon16', $modPathIcon16); + $GLOBALS['xoopsTpl']->assign('sysPathIcon32', $sysPathIcon32); + $criteria = new CriteriaCompo(); + $criteria->setStart($start); $criteria->setLimit($limit); - $criteria->setSort('mod_id ASC, mod_name'); - $criteria->setOrder('ASC'); - $nb_modules = $tdmcreate->getHandler('modules')->getCount( $criteria ); - $mods_arr = $tdmcreate->getHandler('modules')->getAll( $criteria ); - unset($criteria); - // Redirect if there aren't modules - if ( $nb_modules == 0 ) { - redirect_header('modules.php?op=new', 2, _AM_TDMCREATE_NOTMODULES ); - } - // Display modules list - if ( $nb_modules > 0 ) { - foreach (array_keys($mods_arr) as $i) { - $mod['id'] = $i; - $mod['name'] = $mods_arr[$i]->getVar('mod_name'); - $mod['version'] = $mods_arr[$i]->getVar('mod_version'); - $mod['image'] = $mods_arr[$i]->getVar('mod_image'); - $mod['release'] = $mods_arr[$i]->getVar('mod_release'); - $mod['status'] = $mods_arr[$i]->getVar('mod_status'); - $mod['admin'] = $mods_arr[$i]->getVar('mod_admin'); - $mod['user'] = $mods_arr[$i]->getVar('mod_user'); - $mod['blocks'] = $mods_arr[$i]->getVar('mod_blocks'); - $mod['search'] = $mods_arr[$i]->getVar('mod_search'); - $mod['comments'] = $mods_arr[$i]->getVar('mod_comments'); - $mod['notifications'] = $mods_arr[$i]->getVar('mod_notifications'); - $mod['permissions'] = $mods_arr[$i]->getVar('mod_permissions'); - $GLOBALS['xoopsTpl']->append('modules_list', $mod); - unset($mod); - } - if ( $nb_modules > $limit ) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new XoopsPageNav($nb_modules, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); - } - } else { - $GLOBALS['xoopsTpl']->assign('error', _AM_TDMCREATE_THEREARENT_MODULES); - } - break; + $criteria->setSort('mod_id ASC, mod_name'); + $criteria->setOrder('ASC'); + $nb_modules = $tdmcreate->getHandler('modules')->getCount($criteria); + $mods_arr = $tdmcreate->getHandler('modules')->getAll($criteria); + unset($criteria); + // Redirect if there aren't modules + if (0 == $nb_modules) { + redirect_header('modules.php?op=new', 2, _AM_TDMCREATE_NOTMODULES); + } + // Display modules list + if ($nb_modules > 0) { + foreach (array_keys($mods_arr) as $i) { + $mod['id'] = $i; + $mod['name'] = $mods_arr[$i]->getVar('mod_name'); + $mod['version'] = $mods_arr[$i]->getVar('mod_version'); + $mod['image'] = $mods_arr[$i]->getVar('mod_image'); + $mod['release'] = $mods_arr[$i]->getVar('mod_release'); + $mod['status'] = $mods_arr[$i]->getVar('mod_status'); + $mod['admin'] = $mods_arr[$i]->getVar('... [truncated message content] |