From: <txm...@us...> - 2015-05-02 13:42:48
|
Revision: 13052 http://sourceforge.net/p/xoops/svn/13052 Author: txmodxoops Date: 2015-05-02 13:42:44 +0000 (Sat, 02 May 2015) Log Message: ----------- Updated Fixed minor bugs Modified Paths: -------------- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/fields.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/class/fields.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/classes/ClassFiles.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/language/LanguageAdmin.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/language/LanguageDefines.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/sql/SqlFile.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/templates/admin/TemplatesAdminPages.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/user/UserIndex.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/user/UserObjects.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/include/install.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/sql/mysql.sql XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/templates/admin/tdmcreate_fields_item.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 Added Paths: ----------- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/SplClassLoader.php XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/language/english/mail_template/ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/language/english/mail_template/index.html Modified: XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/fields.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/fields.php 2015-05-01 16:05:55 UTC (rev 13051) +++ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/fields.php 2015-05-02 13:42:44 UTC (rev 13052) @@ -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,277 +18,284 @@ * @author Txmod Xoops http://www.txmodxoops.org * @version $Id: 1.91 fields.php 12258 2014-01-02 09:33:29Z timgno $ */ -include __DIR__ . '/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'); -$fieldOrder = XoopsRequest::getInt('field_order'); -$fieldName = XoopsRequest::getString('field_name', ''); +$fieldMid = XoopsRequest::getInt('field_mid'); +$fieldTid = XoopsRequest::getInt('field_tid'); +$fieldNumb = XoopsRequest::getInt('field_numb'); +$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 (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); + $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('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); + $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); $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, $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()) { + $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': + // + if ( !$GLOBALS['xoopsSecurity']->check() ) { redirect_header('fields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - $fieldId = XoopsRequest::getInt('field_id'); - // Fields Handler - $fields = $tdmcreate->getHandler('fields'); - // - $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); + } + $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(); + } + $fieldOrder = XoopsRequest::getInt('field_order'); + $order = $fieldsObj->isNew() ? $fieldOrder++ : $fieldOrder; + // Set Data + $fieldsObj->setVar( 'field_mid', $fieldMid ); + $fieldsObj->setVar( 'field_tid', $fieldTid ); + $fieldsObj->setVar( 'field_order', $order ); + $fieldsObj->setVar( 'field_name', $_POST['field_name'][$key]); + $fieldsObj->setVar( 'field_type', $_POST['field_type'][$key]); + $fieldsObj->setVar( 'field_value', $_POST['field_value'][$key]); + $fieldsObj->setVar( 'field_attribute', $_POST['field_attribute'][$key]); + $fieldsObj->setVar( 'field_null', $_POST['field_null'][$key]); + $fieldsObj->setVar( 'field_default', $_POST['field_default'][$key]); + $fieldsObj->setVar( 'field_key', $_POST['field_key'][$key]); + $fieldsObj->setVar( 'field_element', $_POST['field_element'][$key]); + $fieldsObj->setVar( 'field_parent', (1 == $_REQUEST['field_parent'][$key]) ? 1 : 0); + $fieldsObj->setVar( 'field_inlist', (1 == $_REQUEST['field_inlist'][$key]) ? 1 : 0); + $fieldsObj->setVar( 'field_inform', (1 == $_REQUEST['field_inform'][$key]) ? 1 : 0); + $fieldsObj->setVar( 'field_admin', (1 == $_REQUEST['field_admin'][$key]) ? 1 : 0); + $fieldsObj->setVar( 'field_user', (1 == $_REQUEST['field_user'][$key]) ? 1 : 0); + $fieldsObj->setVar( 'field_block', (1 == $_REQUEST['field_block'][$key]) ? 1 : 0); + $fieldsObj->setVar( 'field_main', ($key == $_REQUEST['field_main'] ? 1 : 0)); + $fieldsObj->setVar( 'field_search', (1 == $_REQUEST['field_search'][$key]) ? 1 : 0); + $fieldsObj->setVar( 'field_required', (1 == $_REQUEST['field_required'][$key]) ? 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)); - } + } + // 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); - $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']) && 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': + 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(); + } + } 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_parent', (1 == $_REQUEST['field_parent'][$key]) ? 0 : 1); + $fieldsObj->setVar('field_inlist', (1 == $_REQUEST['field_inlist'][$key]) ? 0 : 1); + $fieldsObj->setVar('field_inform', (1 == $_REQUEST['field_inform'][$key]) ? 0 : 1); + $fieldsObj->setVar('field_admin', (1 == $_REQUEST['field_admin'][$key]) ? 0 : 1); + $fieldsObj->setVar('field_user', (1 == $_REQUEST['field_user'][$key]) ? 0 : 1); + $fieldsObj->setVar('field_block', (1 == $_REQUEST['field_block'][$key]) ? 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); + $fieldsObj->setVar('field_search', (1 == $_REQUEST['field_search'][$key]) ? 0 : 1); + $fieldsObj->setVar('field_required', (1 == $_REQUEST['field_required'][$key]) ? 0 : 1); } 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__ . '/footer.php'; +include __DIR__ . '/footer.php'; \ No newline at end of file Modified: XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/tables.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/tables.php 2015-05-01 16:05:55 UTC (rev 13051) +++ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/tables.php 2015-05-02 13:42:44 UTC (rev 13052) @@ -28,7 +28,6 @@ $tableMid = XoopsRequest::getInt('table_mid'); $tableName = XoopsRequest::getInt('table_name'); $tableNumbFields = XoopsRequest::getInt('table_nbfields'); -$tableOrder = XoopsRequest::getInt('table_order'); $tableFieldname = XoopsRequest::getString('table_fieldname', ''); // switch ($op) { @@ -39,6 +38,7 @@ // Define main template $template_main = 'tdmcreate_tables.tpl'; $GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css'); + $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/sortable.js'); $GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('tables.php')); @@ -147,10 +147,12 @@ redirect_header('tables.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } // + $tables =& $tdmcreate->getHandler('tables'); + // if (isset($tableId)) { $tablesObj =& $tables->get($tableId); } else { - // Checking if table name exist + // Checking if table name exist in the same module $criteria = new CriteriaCompo(); $criteria->add(new Criteria('table_mid', $tableMid)); $table_name_search = $tables->getObjects($criteria); @@ -163,12 +165,13 @@ } $tablesObj =& $tables->create(); } + $tableOrder = XoopsRequest::getInt('table_order'); $order = $tablesObj->isNew() ? $tableOrder + 1 : $tableOrder; // Form save tables $tablesObj->setVars(array( 'table_mid' => $tableMid, 'table_name' => $_POST['table_name'], - 'table_category' => $_REQUEST['table_category'], + 'table_category' => ((1 == $_REQUEST['table_category']) ? 1 : 0), 'table_nbfields' => $tableNumbFields, 'table_order' => $order, 'table_fieldname' => $tableFieldname)); @@ -189,24 +192,24 @@ $tablesObj->setVar('table_image', $_POST['table_image']); } $tablesObj->setVars(array( - 'table_autoincrement' => $_REQUEST['table_autoincrement'], - 'table_blocks' => $_REQUEST['table_blocks'], - 'table_admin' => $_REQUEST['table_admin'], - 'table_user' => $_REQUEST['table_user'], - 'table_submenu' => $_REQUEST['table_submenu'], - 'table_submit' => $_REQUEST['table_submit'], - 'table_tag' => $_REQUEST['table_tag'], - 'table_broken' => $_REQUEST['table_broken'], - 'table_search' => $_REQUEST['table_search'], - 'table_comments' => $_REQUEST['table_comments'], - 'table_notifications' => $_REQUEST['table_notifications'], - 'table_permissions' => $_REQUEST['table_permissions'], - 'table_rate' => $_REQUEST['table_rate'], - 'table_print' => $_REQUEST['table_print'], - 'table_pdf' => $_REQUEST['table_pdf'], - 'table_rss' => $_REQUEST['table_rss'], - 'table_single' => $_REQUEST['table_single'], - 'table_visit' => $_REQUEST['table_visit'] + 'table_autoincrement' => ((1 == $_REQUEST['table_autoincrement']) ? 1 : 0), + 'table_blocks' => ((1 == $_REQUEST['table_blocks']) ? 1 : 0), + 'table_admin' => ((1 == $_REQUEST['table_admin']) ? 1 : 0), + 'table_user' => ((1 == $_REQUEST['table_user']) ? 1 : 0), + 'table_submenu' => ((1 == $_REQUEST['table_submenu']) ? 1 : 0), + 'table_submit' => ((1 == $_REQUEST['table_submit']) ? 1 : 0), + 'table_tag' => ((1 == $_REQUEST['table_tag']) ? 1 : 0), + 'table_broken' => ((1 == $_REQUEST['table_broken']) ? 1 : 0), + 'table_search' => ((1 == $_REQUEST['table_search']) ? 1 : 0), + 'table_comments' => ((1 == $_REQUEST['table_comments']) ? 1 : 0), + 'table_notifications' => ((1 == $_REQUEST['table_notifications']) ? 1 : 0), + 'table_permissions' => ((1 == $_REQUEST['table_permissions']) ? 1 : 0), + 'table_rate' => ((1 == $_REQUEST['table_rate']) ? 1 : 0), + 'table_print' => ((1 == $_REQUEST['table_print']) ? 1 : 0), + 'table_pdf' => ((1 == $_REQUEST['table_pdf']) ? 1 : 0), + 'table_rss' => ((1 == $_REQUEST['table_rss']) ? 1 : 0), + 'table_single' => ((1 == $_REQUEST['table_single']) ? 1 : 0), + 'table_visit' => ((1 == $_REQUEST['table_visit']) ? 1 : 0) )); // if ($tables->insert($tablesObj)) { @@ -215,11 +218,6 @@ $tableAction = '&field_mid=' . $tableMid . '&field_tid=' . $tableTid . '&field_numb=' . $tableNumbFields . '&field_name=' . $tableFieldname; redirect_header('fields.php?op=new' . $tableAction, 5, sprintf(_AM_TDMCREATE_TABLE_FORM_CREATED_OK, $_POST['table_name'])); } else { - // Get fields where table id - $fields =& $tdmcreate->getHandler('fields'); - $fieldsObj = $fields->get($tableId); - $fieldsObj->setVar('field_numb', $tableNumbFields); - $fields->insert($fieldsObj); redirect_header('tables.php', 5, sprintf(_AM_TDMCREATE_TABLE_FORM_UPDATED_OK, $_POST['table_name'])); } } @@ -284,13 +282,13 @@ foreach ($_POST['mod_id'] as $key => $value) { if ($key > 0) { $modulesObj =& $tdmcreate->getHandler('modules')->get($value); - $modulesObj->setVar('mod_admin', ($_REQUEST['mod_admin'][$key] == 1) ? 0 : 1); - $modulesObj->setVar('mod_user', ($_REQUEST['mod_user'][$key] == 1) ? 0 : 1); - $modulesObj->setVar('mod_blocks', ($_REQUEST['mod_blocks'][$key] == 1) ? 0 : 1); - $modulesObj->setVar('mod_search', ($_REQUEST['mod_search'][$key] == 1) ? 0 : 1); - $modulesObj->setVar('mod_comments', ($_REQUEST['mod_comments'][$key] == 1) ? 0 : 1); - $modulesObj->setVar('mod_notifications', ($_REQUEST['mod_notifications'][$key] == 1) ? 0 : 1); - $modulesObj->setVar('mod_permissions', ($_REQUEST['mod_permissions'][$key] == 1) ? 0 : 1); + $modulesObj->setVar('mod_admin', (1 == $_REQUEST['mod_admin'][$key]) ? 0 : 1); + $modulesObj->setVar('mod_user', (1 == $_REQUEST['mod_user'][$key]) ? 0 : 1); + $modulesObj->setVar('mod_blocks', (1 == $_REQUEST['mod_blocks'][$key]) ? 0 : 1); + $modulesObj->setVar('mod_search', (1 == $_REQUEST['mod_search'][$key]) ? 0 : 1); + $modulesObj->setVar('mod_comments', (1 == $_REQUEST['mod_comments'][$key]) ? 0 : 1); + $modulesObj->setVar('mod_notifications', (1 == $_REQUEST['mod_notifications'][$key]) ? 0 : 1); + $modulesObj->setVar('mod_permissions', (1 == $_REQUEST['mod_permissions'][$key]) ? 0 : 1); } } if ($modules->insert($modulesObj, true)) { @@ -302,16 +300,17 @@ case 'display_tables': $tables = $tdmcreate->getHandler('tables'); + // foreach ($_POST['table_id'] as $key => $value) { if ($key > 0) { $tablesObj =& $tables->get($value); - $tablesObj->setVar('table_admin', ($_REQUEST['table_admin'][$key] == 1) ? 0 : 1); - $tablesObj->setVar('table_user', ($_REQUEST['table_user'][$key] == 1) ? 0 : 1); - $tablesObj->setVar('table_blocks', ($_REQUEST['table_blocks'][$key] == 1) ? 0 : 1); - $tablesObj->setVar('table_submenu', ($_REQUEST['table_submenu'][$key] == 1) ? 0 : 1); - $tablesObj->setVar('table_search', ($_REQUEST['table_search'][$key] == 1) ? 0 : 1); - $tablesObj->setVar('table_comments', ($_REQUEST['table_comments'][$key] == 1) ? 0 : 1); - $tablesObj->setVar('table_notifications', ($_REQUEST['table_notifications'][$key] == 1) ? 0 : 1); + $tablesObj->setVar('table_admin', (1 == $_REQUEST['table_admin'][$key]) ? 0 : 1); + $tablesObj->setVar('table_user', (1 == $_REQUEST['table_user'][$key]) ? 0 : 1); + $tablesObj->setVar('table_blocks', (1 == $_REQUEST['table_blocks'][$key]) ? 0 : 1); + $tablesObj->setVar('table_submenu', (1 == $_REQUEST['table_submenu'][$key]) ? 0 : 1); + $tablesObj->setVar('table_search', (1 == $_REQUEST['table_search'][$key]) ? 0 : 1); + $tablesObj->setVar('table_comments', (1 == $_REQUEST['table_comments'][$key]) ? 0 : 1); + $tablesObj->setVar('table_notifications', (1 == $_REQUEST['table_notifications'][$key]) ? 0 : 1); } } if ($tables->insert($tablesObj, true)) { Modified: XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/assets/css/admin/style.css =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/assets/css/admin/style.css 2015-05-01 16:05:55 UTC (rev 13051) +++ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/assets/css/admin/style.css 2015-05-02 13:42:44 UTC (rev 13052) @@ -26,12 +26,16 @@ text-shadow: 1px 1px 1px #fff; } -table { margin: 0; padding: 0; } +table { margin: 0; padding: 0; width: 100%; } /* Sortable tables & fields */ +tbody tr td.sortable { + text-align: center; + width: 100%; +} + tbody tr td.sortable img.move { cursor: move; - text-align: center; } tbody tr:hover { @@ -138,7 +142,7 @@ background-color: #efefef; } -.table-list tr { margin: 0; padding: 0; } +.table-list tr { margin: 0; padding: 0; width: 100%; } .table-list tr td img.move { margin-right: 20px; @@ -209,16 +213,16 @@ width: 5%; } -.field-list tr { margin: 0; padding: 0; } +.field-list tr { margin: 0; padding: 0; width: 100%; } .field-list tr td { padding: 5px 2px; margin-bottom: 3px; - background-color: #efefef; + /* background-color: #efefef; background-image: -moz-linear-gradient(top, #efefef, #e1e1e1); background-image: -webkit-gradient(linear, left top,left bottom, from(#efefef), to(#e1e1e1)); background-image: linear-gradient(top, #efefef, #e1e1e1); - filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, StartColorStr=#efefef, EndColorStr=#e1e1e1); /* vale solo per IE */ + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, StartColorStr=#efefef, EndColorStr=#e1e1e1); vale solo per IE */ text-shadow:1px 1px 0 #fff; color:#ff8400; } @@ -230,4 +234,4 @@ } .field-list tr td strong { vertical-align: middle; -} +} \ No newline at end of file Added: XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/SplClassLoader.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/SplClassLoader.php (rev 0) +++ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/SplClassLoader.php 2015-05-02 13:42:44 UTC (rev 13052) @@ -0,0 +1,155 @@ +<?php + +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the MIT license. For more information, see + * <http://www.doctrine-project.org>. + */ + +/** + * SplClassLoader implementation that implements the technical interoperability + * standards for PHP 5.3 namespaces and class names. + * + * http://groups.google.com/group/php-standards/web/psr-0-final-proposal?pli=1 + * + * // Example which loads classes for the Doctrine Common package in the + * // Doctrine\Common namespace. + * $classLoader = new SplClassLoader('Doctrine\Common', '/path/to/doctrine'); + * $classLoader->register(); + * + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @author Jonathan H. Wage <jo...@gm...> + * @author Roman S. Borschel <ro...@co...> + * @author Matthew Weier O'Phinney <ma...@ze...> + * @author Kris Wallsmith <kri...@gm...> + * @author Fabien Potencier <fab...@sy...> + */ +class SplClassLoader +{ + private $_fileExtension = '.php'; + private $_namespace; + private $_includePath; + private $_namespaceSeparator = '\\'; + + /** + * Creates a new <tt>SplClassLoader</tt> that loads classes of the + * specified namespace. + * + * @param string $ns The namespace to use. + */ + public function __construct($ns = null, $includePath = null) + { + $this->_namespace = $ns; + $this->_includePath = $includePath; + } + + /** + * Sets the namespace separator used by classes in the namespace of this class loader. + * + * @param string $sep The separator to use. + */ + public function setNamespaceSeparator($sep) + { + $this->_namespaceSeparator = $sep; + } + + /** + * Gets the namespace seperator used by classes in the namespace of this class loader. + * + * @return void + */ + public function getNamespaceSeparator() + { + return $this->_namespaceSeparator; + } + + /** + * Sets the base include path for all class files in the namespace of this class loader. + * + * @param string $includePath + */ + public function setIncludePath($includePath) + { + $this->_includePath = $includePath; + } + + /** + * Gets the base include path for all class files in the namespace of this class loader. + * + * @return string $includePath + */ + public function getIncludePath() + { + return $this->_includePath; + } + + /** + * Sets the file extension of class files in the namespace of this class loader. + * + * @param string $fileExtension + */ + public function setFileExtension($fileExtension) + { + $this->_fileExtension = $fileExtension; + } + + /** + * Gets the file extension of class files in the namespace of this class loader. + * + * @return string $fileExtension + */ + public function getFileExtension() + { + return $this->_fileExtension; + } + + /** + * Installs this class loader on the SPL autoload stack. + */ + public function register() + { + spl_autoload_register(array($this, 'loadClass')); + } + + /** + * Uninstalls this class loader from the SPL autoloader stack. + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + } + + /** + * Loads the given class or interface. + * + * @param string $className The name of the class to load. + * @return void + */ + public function loadClass($className) + { + if (null === $this->_namespace || $this->_namespace.$this->_namespaceSeparator === substr($className, 0, strlen($this->_namespace.$this->_namespaceSeparator))) { + $fileName = ''; + $namespace = ''; + if (false !== ($lastNsPos = strripos($className, $this->_namespaceSeparator))) { + $namespace = substr($className, 0, $lastNsPos); + $className = substr($className, $lastNsPos + 1); + $fileName = str_replace($this->_namespaceSeparator, DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; + } + $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . $this->_fileExtension; + + require ($this->_includePath !== null ? $this->_includePath . DIRECTORY_SEPARATOR : '') . $fileName; + } + } +} \ No newline at end of file Modified: XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/fields.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/fields.php 2015-05-01 16:05:55 UTC (rev 13051) +++ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/fields.php 2015-05-02 13:42:44 UTC (rev 13052) @@ -85,10 +85,8 @@ } /* - * @static function &getInstance - * @param null - */ - /** + * @static function &getInstance + * * @return TDMCreateFields */ public static function &getInstance() @@ -102,10 +100,8 @@ } /* - * @private function getHeaderForm - * @param mixed $action - */ - /** + * @private function getHeaderForm + * * @param bool $action * @return TDMCreateThemeForm */ @@ -143,15 +139,8 @@ } /* - * @public function getFormNew - * - * @param integer $field_mid - * @param integer $field_tid - * @param integer $field_numb - * @param string $field_name - * @param mixed $action - */ - /** + * @public function getFormNew + * * @param null $field_mid * @param null $field_tid * @param null $field_numb @@ -179,20 +168,9 @@ return $fieldsForm->getFooterForm($form); } - /* - * @private function getFormNewLine - * - * @param mixed $form - * @param mixed $class - * @param integer $i - * @param integer $field_mid - * @param integer $field_tid - * @param mixed $f_name - * @param integer $table_autoincrement - * - * @author timgno - modified in getFormNewLine by goffy - */ /** + * @private function getFormNewLine + * * @param $form * @param $class * @param $i @@ -311,30 +289,24 @@ } /* - * @public function getFormEdit - * - * @param integer $field_mid - * @param integer $field_tid - * @param mixed $action - */ - /** + * @public function getFormEdit + * * @param null $field_mid * @param null $field_tid - * @param null $field_numb * @param bool $action * @return mixed */ public function getFormEdit($field_mid = null, $field_tid = null, $action = false) { // Header function class - $fields_form = TDMCreateFields::getInstance(); - $form = $fields_form->getHeaderForm($action); + $fieldsForm = TDMCreateFields::getInstance(); + $form = $fieldsForm->getHeaderForm($action); // $class = 'even'; // Get the number of fields - goffy $tablesHandler =& $this->tdmcreate->getHandler('tables'); $table_autoincrement = $tablesHandler->get($field_tid)->getVar('table_autoincrement'); - $field_numb = $tablesHandler->get($field_tid)->getVar('table_nbfields'); + $field_numb = $tablesHandler->get($field_tid)->getVar('table_nbfields'); $f_name = $tablesHandler->get($field_tid)->getVar('table_fieldname'); // Get the list of fields @@ -353,10 +325,10 @@ $this->tdmcreate->getHandler('fields')->delete($fieldsObj, true); } else { // show field with settings - $form->addElement(new XoopsFormHidden('field_id[' . $field_id . ']', $field_id)); - $form->addElement(new XoopsFormHidden('field_mid', $field_mid)); - $form->addElement(new XoopsFormHidden('field_tid', $field_tid)); - + $form->addElement(new XoopsFormHidden('field_id[' . $id . ']', $field_id)); + //$form->addElement(new XoopsFormHidden('field_mid', $field_mid)); + //$form->addElement(new XoopsFormHidden('field_tid', $field_tid)); + $form->addElement(new TDMCreateFormLabel('<tr class="' . $class . '">')); // Index ID $form->addElement(new TDMCreateFormLabel('<td class="center">' . $id . '</td>')); @@ -457,7 +429,7 @@ unset($id); // Footer form - return $fields_form->getFooterForm($form); + return $fieldsForm->getFooterForm($form); } /* Modified: XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/AdminObjects.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/AdminObjects.php 2015-05-01 16:05:55 UTC (rev 13051) +++ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/AdminObjects.php 2015-05-02 13:42:44 UTC (rev 13052) @@ -38,7 +38,6 @@ if (!$instance) { $instance = new self(); } - return $instance; } @@ -46,19 +45,14 @@ * @public function getSimpleSetVar * @param string $tableName * @param string $fieldName + * @return string */ - /** - * @param $tableName - * @param $fieldName - * @return string - */ public function getSimpleSetVar($tableName, $fieldName) { $ret = <<<EOT // Set Var {$fieldName} \${$tableName}Obj->setVar('{$fieldName}', \$_POST['{$fieldName}']);\n EOT; - return $ret; } @@ -66,19 +60,14 @@ * @public function getTextDateSelectSetVar * @param string $tableName * @param string $fieldName + * @return string */ - /** - * @param $tableName - * @param $fieldName - * @return string - */ public function getTextDateSelectSetVar($tableName, $fieldName) { $ret = <<<EOT // Set Var {$fieldName} \${$tableName}Obj->setVar('{$fieldName}', strtotime(\$_POST['{$fieldName}']));\n EOT; - return $ret; } @@ -86,19 +75,14 @@ * @public function getCheckBoxOrRadioYNSetVar * @param string $tableName * @param string $fieldName + * @return string */ - /** - * @param $tableName - * @param $fieldName - * @return string - */ public function getCheckBoxOrRadioYNSetVar($tableName, $fieldName) { $ret = <<<EOT // Set Var {$fieldName} \${$tableName}Obj->setVar('{$fieldName}', ((1 == \$_REQUEST['{$fieldName}']) ? '1' : '0'));\n EOT; - return $ret; } @@ -106,19 +90,14 @@ * @public function getUrlFileSetVar * @param string $tableName * @param string $fieldName + * @return string */ - /** - * @param $tableName - * @param $fieldName - * @return string - */ public function getUrlFileSetVar($tableName, $fieldName) { $ret = <<<EOT // Set Var {$fieldName} - \${$tableName}Obj->setVar('{$fieldName}', formtUrl(\$_REQUEST['{$fieldName}']));\n + \${$tableName}Obj->setVar('{$fieldName}', formatUrl(\$_REQUEST['{$fieldName}']));\n EOT; - return $ret; } @@ -127,13 +106,8 @@ * @param string $moduleDirname * @param string $tableName * @param string $fieldName + * @return string */ - /** - * @param $moduleDirname - * @param $tableName - * @param $fieldName - * @return string - */ public function getImageListSetVar($moduleDirname, $tableName, $fieldName) { $ret = <<<EOT @@ -155,7 +129,6 @@ \${$tableName}Obj->setVar('{$fieldName}', \$_POST['{$fieldName}']); }\n EOT; - return $ret; } @@ -164,13 +137,8 @@ * @param string $moduleDirname * @param string $tableName * @param string $fieldName + * @return string */ - /** - * @param $moduleDirname - * @param $tableName - * @param $fieldName - * @return string - */ public function getUploadImageSetVar($moduleDirname, $tableName, $fieldName) { $stuModuleDirname = strtoupper($moduleDirname); @@ -193,7 +161,6 @@ \${$tableName}Obj->setVar('{$fieldName}', \$_POST['{$fieldName}']); }\n EOT; - return $ret; } @@ -202,13 +169,8 @@ * @param string $moduleDirname * @param string $tableName * @param string $fieldName + * @return string */ - /** - * @param $moduleDirname - * @param $tableName - * @param $fieldName - * @return string - */ public function getUploadFileSetVar($moduleDirname, $tableName, $fieldName) { $stuModuleDirname = strtoupper($moduleDirname); @@ -229,7 +191,6 @@ } }\n EOT; - return $ret; } @@ -239,21 +200,14 @@ * @param string $rpFieldName * @param string $tableName * @param string $fieldName + * @return string */ - /** - * @param $lpFieldName - * @param $rpFieldName - * @param $tableName - * @param $fieldName - * @return string - */ public function getSimpleGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { $ret = <<<EOT \t\t\t\t// Get Var {$fieldName} \t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = \${$tableName}All[\$i]->getVar('{$fieldName}');\n EOT; - return $ret; } @@ -265,16 +219,8 @@ * @param string $tableNameTopic * @param string $fieldNameParent * @param string $fieldNameTopic + * @return string */ - /** - * @param $lpFieldName - * @param $rpFieldName - * @param $tableName - * @param $tableNameTopic - * @param $fieldNameParent - * @param $fieldNameTopic - * @return string - */ public function getTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableNameTopic, $fieldNameParent, $fieldNameTopic) { $ret = <<<EOT @@ -282,7 +228,6 @@ \t\t\t\t\${$rpFieldName} =& \${$tableNameTopic}Handler->get(\${$tableName}All[\$i]->getVar('{$fieldNameParent}')); \t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = \${$rpFieldName}->getVar('{$fieldNameTopic}');\n EOT; - return $ret; } @@ -292,14 +237,8 @@ * @param string $rpFieldName * @param string $tableName * @param string $fieldName + * @return string */ - /** - * @param $lpFieldName - * @param $rpFieldName - * @param $tableName - * @param $fieldName - * @return string - */ public function getUploadImageGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { $ret = <<<EOT @@ -308,7 +247,6 @@ \t\t\t\t\$upload_image = \${$fieldName} ? \${$fieldName} : 'blank.gif'; \t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = \$upload_image;\n EOT; - return $ret; } /* @@ -319,22 +257,13 @@ * @param string $fieldName * @return string */ - /* - * @public function getUrlFileGetVar - * @param $lpFieldName - * @param $rpFieldName - * @param $tableName - * @param $fieldName - * @return string - */ public function getUrlFileGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { $ret = <<<EOT \t\t\t\t// Get Var {$fieldName} \t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = \${$tableName}All[\$i]->getVar('{$fieldName}');\n EOT; - - return $ret; + return $ret; } /* * @public function getTextAreaGetVar @@ -342,21 +271,14 @@ * @param string $rpFieldName * @param string $tableName * @param string $fieldName + * @return string */ - /** - * @param $lpFieldName - * @param $rpFieldName - * @param $tableName - * @param $fieldName - * @return string - */ public function getTextAreaGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { $ret = <<<EOT \t\t\t\t// Get Var {$fieldName} \t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = strip_tags(\${$tableName}All[\$i]->getVar('{$fieldName}'));\n EOT; - return $ret; } @@ -366... [truncated message content] |