|
From: <txm...@us...> - 2014-03-27 00:26:35
|
Revision: 12410
http://sourceforge.net/p/xoops/svn/12410
Author: txmodxoops
Date: 2014-03-27 00:26:31 +0000 (Thu, 27 Mar 2014)
Log Message:
-----------
Updated
Work in progress
The base module is created
Modified Paths:
--------------
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/building.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/fields.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/header.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/modules.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/tables.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/architecture.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/htmltable.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/logoGenerator.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/modules.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/tables.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/themeform.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/language/english/admin.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/templates/admin/tdmcreate_fields.html
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/templates/admin/tdmcreate_header.html
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/templates/admin/tdmcreate_tables.html
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/xoops_version.php
Removed Paths:
-------------
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields_class.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields_database.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/css/admin.css
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/images/default_slogo.png
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/images/icons/arrow.gif
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/images/icons/off.png
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/images/icons/on.png
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/images/module_logo.png
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/images/txmodxoops_logo.png
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/images/uploads/
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/images/xoops2.png
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/include/functions_const.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/modules/
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/building.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/building.php 2014-03-25 08:52:13 UTC (rev 12409)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/building.php 2014-03-27 00:26:31 UTC (rev 12410)
@@ -32,14 +32,15 @@
$template_main = 'tdmcreate_building.html';
$GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('building.php'));
// Clear repertory of new module if there are
- TDMCreate_clearDir(TDMC_UPLOAD_MODULE_PATH . '/' . strtolower($modules->getVar('mod_name')));
+ TDMCreate_clearDir(TDMC_UPLOAD_MODULES_PATH . '/' . $modules->getVar('mod_name'));
// Debut
/************************************************/
/*Structure*/
/************************************************/
include_once TDMC_PATH . '/class/files/architecture.php';
$handler = TDMCreateArchitecture::getInstance();
- $handler->getUploadPath( TDMC_UPLOAD_MODULE_PATH );
+ $handler->getPath( TDMC_PATH );
+ $handler->getUploadPath( TDMC_UPLOAD_PATH );
$handler->getArchitectureFiles( $modules );
// Creation of the structure of folders and files
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/fields.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/fields.php 2014-03-25 08:52:13 UTC (rev 12409)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/fields.php 2014-03-27 00:26:31 UTC (rev 12410)
@@ -22,22 +22,22 @@
// Recovered value of arguments op in the URL $
$op = TDMCreate_CleanVars($_REQUEST, 'op', 'list', 'string');
// Get table Variables
-$table_id = TDMCreate_CleanVars($_REQUEST, 'table_id', 0, 'int');
-$table_mid = TDMCreate_CleanVars($_REQUEST, 'table_mid', 0, 'int');
-$table_nbfields = TDMCreate_CleanVars($_REQUEST, 'table_nbfields', 0, 'int');
+$table_id = TDMCreate_CleanVars($_REQUEST, 'table_id');
+$table_mid = TDMCreate_CleanVars($_REQUEST, 'table_mid');
+$table_nbfields = TDMCreate_CleanVars($_REQUEST, 'table_nbfields');
$table_fieldname = TDMCreate_CleanVars($_REQUEST, 'table_fieldname', '', 'string');
// Get field Variables
-$field_id = TDMCreate_CleanVars($_REQUEST, 'field_id', 0, 'int');
-$field_tid = TDMCreate_CleanVars($_REQUEST, 'field_tid', 0, 'int');
-$field_mid = TDMCreate_CleanVars($_REQUEST, 'field_mid', 0, 'int');
-$field_numb = TDMCreate_CleanVars($_REQUEST, 'field_numb', 0, 'int');
+$field_id = TDMCreate_CleanVars($_REQUEST, 'field_id');
+$field_tid = TDMCreate_CleanVars($_REQUEST, 'field_tid');
+$field_mid = TDMCreate_CleanVars($_REQUEST, 'field_mid');
+$field_numb = TDMCreate_CleanVars($_REQUEST, 'field_numb');
$field_name = TDMCreate_CleanVars($_REQUEST, 'field_name', '', 'string');
//
switch ($op)
{
case 'list':
default:
- $limit = xoops_getModuleOption('mod_adminpager');
+ $limit = xoops_getModuleOption('fields_adminpager');
$start = TDMCreate_CleanVars($_REQUEST, 'start', 0);
// Define main template
$template_main = 'tdmcreate_fields.html';
@@ -95,7 +95,7 @@
$GLOBALS['xoopsTpl']->assign('button_new', $adminMenu->renderButton());
$obj =& $fieldsHandler->create();
- $form = $obj->getForm($table_id, $table_mid, $table_nbfields, $table_fieldname);
+ $form = $obj->getForm($field_mid, $field_tid, $field_numb, $field_name);
$GLOBALS['xoopsTpl']->assign('form', $form->render());
break;
@@ -125,13 +125,13 @@
'field_blocks' => (($_REQUEST['field_blocks'] == 1) ? '1' : '0'),
'field_mainfield' => (($_REQUEST['field_mainfield'] == 1) ? '1' : '0'),
'field_search' => (($_REQUEST['field_search'] == 1) ? '1' : '0'),
- 'field_required' => (($_REQUEST['field_required'] == 1) ? '1' : '0')),
+ 'field_required' => (($_REQUEST['field_required'] == 1) ? '1' : '0'),
'field_fields' => $_POST['field_fields'],
- 'field_parameters' => $_POST['field_parameters']
+ 'field_parameters' => $_POST['field_parameters'])
);
if ($fieldsHandler->insert($obj)) {
- redirect_header('tables.php', 2, _AM_TDMCREATE_FORMOK);
+ redirect_header('fields.php', 2, _AM_TDMCREATE_FORMOK);
}
echo $obj->getHtmlErrors();
$form = $obj->getForm();
@@ -143,10 +143,12 @@
$template_main = 'tdmcreate_tables.html';
$GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('fields.php'));
$adminMenu->addItemButton(_AM_TDMCREATE_TABLES_LIST, 'tables.php', 'list');
- $GLOBALS['xoopsTpl']->assign('button_new', $adminMenu->renderButton());
+ $GLOBALS['xoopsTpl']->assign('button_tables_list', $adminMenu->renderButton());
+ $adminMenu->addItemButton(_AM_TDMCREATE_FIELDS_LIST, 'fields.php', 'list');
+ $GLOBALS['xoopsTpl']->assign('button_fields_list', $adminMenu->renderButton());
$obj = $fieldsHandler->get($field_id);
- $form = $obj->getForm($field_tid, $field_mid, $field_numb, $field_name);
+ $form = $obj->getForm($field_mid, $field_tid, $field_numb, $field_name);
$GLOBALS['xoopsTpl']->assign('form', $form->render());
break;
}
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/header.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/header.php 2014-03-25 08:52:13 UTC (rev 12409)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/header.php 2014-03-27 00:26:31 UTC (rev 12410)
@@ -19,8 +19,8 @@
* @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('../include/common.php');
-include_once('../include/functions.php');
+include_once dirname(dirname(__FILE__)) . '/include/common.php';
+include_once dirname(dirname(__FILE__)) . '/include/functions.php';
//include_once 'includes.php';
//
$thisDirname = $GLOBALS['xoopsModule']->getVar('dirname');
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/modules.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/modules.php 2014-03-25 08:52:13 UTC (rev 12409)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/modules.php 2014-03-27 00:26:31 UTC (rev 12410)
@@ -94,16 +94,24 @@
$obj =& $modulesHandler->create();
}
//Form module save
- $obj->setVars(array('mod_name' => $_POST['mod_name'], 'mod_version' => $_POST['mod_version'],
- 'mod_min_php' => $_POST['mod_min_php'], 'mod_min_xoops' => $_POST['mod_min_xoops'],
- 'mod_min_admin' => $_POST['mod_min_admin'], 'mod_min_mysql' => $_POST['mod_min_mysql'],
- 'mod_description' => $_POST['mod_description'], 'mod_author' => $_POST['mod_author'], 'mod_author_mail' => $_POST['mod_author_mail'],
+ $obj->setVars(array('mod_name' => $_POST['mod_name'],
+ 'mod_version' => $_POST['mod_version'],
+ 'mod_since' => $_POST['mod_since'],
+ 'mod_min_php' => $_POST['mod_min_php'],
+ 'mod_min_xoops' => $_POST['mod_min_xoops'],
+ 'mod_min_admin' => $_POST['mod_min_admin'],
+ 'mod_min_mysql' => $_POST['mod_min_mysql'],
+ 'mod_description' => $_POST['mod_description'],
+ 'mod_author' => $_POST['mod_author'],
+ 'mod_author_mail' => $_POST['mod_author_mail'],
'mod_author_website_url' => $_POST['mod_author_website_url'],
'mod_author_website_name' => $_POST['mod_author_website_name'],
- 'mod_credits' => $_POST['mod_credits'], 'mod_license' => $_POST['mod_license'],
+ 'mod_credits' => $_POST['mod_credits'],
+ 'mod_license' => $_POST['mod_license'],
'mod_release_info' => $_POST['mod_release_info'],
'mod_release_file' => $_POST['mod_release_file'],
- 'mod_manual' => $_POST['mod_manual'], 'mod_manual_file' => $_POST['mod_manual_file']));
+ 'mod_manual' => $_POST['mod_manual'],
+ 'mod_manual_file' => $_POST['mod_manual_file']));
//Form mod_image
include_once XOOPS_ROOT_PATH . '/class/uploader.php';
$uploaddir = TDMC_UPLOAD_PATH.'/images/modules/';
@@ -136,7 +144,10 @@
'mod_submenu' => (($_REQUEST['mod_submenu'] == 1) ? '1' : '0'),
'mod_search' => (($_REQUEST['mod_search'] == 1) ? '1' : '0'),
'mod_comments' => (($_REQUEST['mod_comments'] == 1) ? '1' : '0'),
- 'mod_notifications' => (($_REQUEST['mod_notifications'] == 1) ? '1' : '0')));
+ 'mod_notifications' => (($_REQUEST['mod_notifications'] == 1) ? '1' : '0'),
+ 'mod_donations' => $_POST['mod_donations'],
+ 'mod_subversion' => $_POST['mod_subversion'])
+ );
if ($modulesHandler->insert($obj)) {
redirect_header('modules.php', 2, _AM_TDMCREATE_FORMOK);
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/tables.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/tables.php 2014-03-25 08:52:13 UTC (rev 12409)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/tables.php 2014-03-27 00:26:31 UTC (rev 12410)
@@ -22,10 +22,10 @@
// Recovered value of arguments op in the URL $
$op = TDMCreate_CleanVars($_REQUEST, 'op', 'list', 'string');
//
-$mod_id = TDMCreate_CleanVars($_REQUEST, 'mod_id', 0);
-$table_id = TDMCreate_CleanVars($_REQUEST, 'table_id', 0);
-$table_mid = TDMCreate_CleanVars($_REQUEST, 'table_mid', 0);
-$table_nbfields = TDMCreate_CleanVars($_REQUEST, 'table_nbfields', 0);
+$mod_id = TDMCreate_CleanVars($_REQUEST, 'mod_id');
+$table_id = TDMCreate_CleanVars($_REQUEST, 'table_id');
+$table_mid = TDMCreate_CleanVars($_REQUEST, 'table_mid');
+$table_nbfields = TDMCreate_CleanVars($_REQUEST, 'table_nbfields');
$table_fieldname = TDMCreate_CleanVars($_REQUEST, 'table_fieldname', '', 'string');
//
switch ($op)
@@ -36,7 +36,7 @@
$start = TDMCreate_CleanVars($_REQUEST, 'start', 0);
// Define main template
$template_main = 'tdmcreate_tables.html';
- $GLOBALS['xoTheme']->addStylesheet( 'modules/TDMCreate/css/admin.css' );
+ $GLOBALS['xoTheme']->addStylesheet( 'modules/TDMCreate/css/admin/style.css' );
$GLOBALS['xoTheme']->addScript('modules/TDMCreate/js/functions.js');
$GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('tables.php'));
@@ -141,7 +141,8 @@
}
//Form tables
$obj->setVars(array('table_mid' => $table_mid,
- 'table_name' => $_POST['table_name'],
+ 'table_name' => $_POST['table_name'],
+ 'table_category' => (($_REQUEST['table_category'] == 1) ? '1' : '0'),
'table_nbfields' => $table_nbfields,
'table_fieldname' => $table_fieldname));
//Form table_image
@@ -178,7 +179,7 @@
if( $tablesHandler->insert($obj) ) {
if( $obj->isNew() ) {
$field_tid = $GLOBALS['xoopsDB']->getInsertId();
- redirect_header('fields.php?op=new&field_tid='.$field_tid, 3, _AM_TDMCREATE_FORMOK);
+ redirect_header('fields.php?op=new&field_mid='.$table_mid.'&field_tid='.$field_tid.'&field_numb='.$table_nbfields.'&field_name='.$table_fieldname, 3, _AM_TDMCREATE_FORMOK);
} else {
redirect_header('tables.php', 3, _AM_TDMCREATE_FORMOK);
}
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields.php 2014-03-25 08:52:13 UTC (rev 12409)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields.php 2014-03-27 00:26:31 UTC (rev 12410)
@@ -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,23 +18,38 @@
* @author Txmod Xoops http://www.txmodxoops.org
* @version $Id: fields.php 12258 2014-01-02 09:33:29Z timgno $
*/
-if (!defined("XOOPS_ROOT_PATH")) {
- die("XOOPS root path not defined");
-}
+defined('XOOPS_ROOT_PATH') or die('Restricted access');
require_once 'themeform.php';
/*
* @Class TDMCreateFields
-* @extends XoopsObject
+* @extends XoopsObject
*/
class TDMCreateFields extends XoopsObject
-{
+{
+ /**
+ * @var string
+ */
+ private $table = null;
+
+ /**
+ * @var string
+ */
+ private $htmltable = null;
+
+ /**
+ * @var string
+ */
+ private $htmltable_parameters = null;
+
/*
* @public function constructor class
* @param null
*/
public function __construct()
{
- $this->XoopsObject();
+ $this->table = TDMCreateTables::getInstance();
+ $this->htmltable = TDMCreateHtmlTable::getInstance();
+ $this->htmltable_parameters = TDMCreateHtmlTable::getInstance();
$this->initVar('field_id', XOBJ_DTYPE_INT);
$this->initVar('field_tid', XOBJ_DTYPE_INT);
$this->initVar('field_name', XOBJ_DTYPE_TXTBOX);
@@ -54,7 +69,7 @@
$this->initVar('field_fields',XOBJ_DTYPE_TXTAREA);
$this->initVar('field_parameters',XOBJ_DTYPE_TXTAREA);
}
-
+
/*
* @static function &getInstance
* @param null
@@ -82,9 +97,9 @@
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
-
+
$title = $this->isNew() ? sprintf(_AM_TDMCREATE_FIELD_ADD) : sprintf(_AM_TDMCREATE_FIELD_EDIT);
-
+
if ($this->isNew()) {
$field_tid = $table_id;
$nb_fields = $table_nbfields;
@@ -92,35 +107,37 @@
$field_tid = $this->getVar('field_tid');
$nb_fields = $this->getVar('field_numb');
}
-
- include_once(XOOPS_ROOT_PATH.'/class/xoopsformloader.php');
- include_once(XOOPS_ROOT_PATH.'/modules/TDMCreate/class/themeform.php');
+
+ $header_captions = array(_AM_TDMCREATE_FIELD_NUMBER, _AM_TDMCREATE_FIELD_NAME, _AM_TDMCREATE_FIELD_TYPE, _AM_TDMCREATE_FIELD_VALUE, _AM_TDMCREATE_FIELD_ATTRIBUTE, _AM_TDMCREATE_FIELD_NULL, _AM_TDMCREATE_FIELD_DEFAULT, _AM_TDMCREATE_FIELD_KEY, _AM_TDMCREATE_FIELD_OTHERS);
+ xoops_load('xoopsformloader');
$form = new TDMCreateThemeForm($title, 'form', $action, 'post', true);
- $form->setExtra('enctype="multipart/form-data"');
+ $form->setExtra('enctype="multipart/form-data"');
- //$option_tray = new XoopsFormElementTray(' ');
- //$option_tray->setExtra('colspan="2"');//_AM_TDMCREATE_FIELD_TYPE
- $tablesHandler = xoops_getModuleHandler('tables');
+ $tablesHandler = xoops_getModuleHandler('tables');
// New Object HtmlTable
- $tableForm = new TDMCreateHtmlTable(null, 'display outer');
+ //$this->htmltable->initTable(null, 'display outer');
// header row
- $tableForm->addRow('center bgblue');
- $cells = array(_AM_TDMCREATE_FIELD_NUMBER, _AM_TDMCREATE_FIELD_NAME, _AM_TDMCREATE_FIELD_TYPE, _AM_TDMCREATE_FIELD_VALUE, _AM_TDMCREATE_FIELD_ATTRIBUTE, _AM_TDMCREATE_FIELD_NULL, _AM_TDMCREATE_FIELD_DEFAULT, _AM_TDMCREATE_FIELD_KEY, _AM_TDMCREATE_FIELD_OTHERS);
- $tableForm->addCells($cells, 'first', 'header');
+ /*$this->htmltable->addRow('center bgblue');
+ $this->htmltable->addCells($cells, 'first', 'header');*/
+ $this->htmltable->initTable('display outer width100');
+ $this->htmltable->addRow() . NWLINE;
+ $this->htmltable->addCell($title, 'first', 'header', 'colspan="9"');
+ $this->htmltable->addRow('center bgblue') . NWLINE;
+ $this->htmltable->addCells($header_captions, 'first', 'header');
- for($i = 1; $i <= count($nb_fields); $i++)
- {
- $field_name = $this->isNew() ? $this->getVar('table_fieldname') : $this->getVar('field_name');
+ for($i = 1; $i <= intval($nb_fields); $i++)
+ {
+ $field_name = $this->isNew() ? $this->table->getVar('table_fieldname') : $this->getVar('field_name');
$field_name = new XoopsFormText(_AM_TDMCREATE_FIELD_NAME, 'field_name', 15, 255, $field_name);
// fieldtype
$fieldtypeHandler =& xoops_getModuleHandler('fieldtype');
$fieldtype_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_TYPE, 'field_type', $this->getVar('field_type'));
- $fieldtype_select->addOptionArray($fieldtypeHandler->getList());
- // fieldvalue
+ $fieldtype_select->addOptionArray($fieldtypeHandler->getList());
+ // fieldvalue
$field_value = new XoopsFormText(_AM_TDMCREATE_FIELD_VALUE, 'field_value', 5, 20, $this->getVar('field_value'));
// fieldattributes
- $fieldattrsHandler =& xoops_getModuleHandler('fieldattributes');
- $field_attributes_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_TYPE, 'field_attribute', $this->getVar('field_attribute'));
+ $fieldattrsHandler =& xoops_getModuleHandler('fieldattributes');
+ $field_attributes_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_TYPE, 'field_attribute', $this->getVar('field_attribute'));
$field_attributes_select->addOptionArray($fieldattrsHandler->getList());
// fieldnull
$fieldnullHandler =& xoops_getModuleHandler('fieldnull');
@@ -133,108 +150,99 @@
$field_key_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_KEY, 'field_key', $this->getVar('field_key'));
$field_key_select->addOptionArray($fieldkeyHandler->getList());
// render fields
- $tableFormDataArray = array($i, $field_name->render(), $fieldtype_select->render(), $field_value->render(), $field_attributes_select->render(), $field_null_select->render(), $field_default->render(), $field_key_select->render());
+ $htmltableDataArray = array($i, $field_name->render(), $fieldtype_select->render(), $field_value->render(), $field_attributes_select->render(), $field_null_select->render(), $field_default->render(), $field_key_select->render());
// data row
- $tableForm->addRow('center bgyellow');
- $tableForm->addCells($tableFormDataArray, 'first', 'data');
- $tableOtherForm = new TDMCreateHtmlTable(null, 'display');
- if($i == 1) {
+ $this->htmltable->addRow('center bgyellow');
+ $this->htmltable->addCells($htmltableDataArray, 'first', 'data');
+ $this->htmltable_parameters->initTable('display');
+ if($i == 1) {
$field_autoincrement = $this->isNew() ? 0 : $this->getVar('field_auto_increment');
$check_field_autoincrement = new XoopsFormCheckBox(' ', 'field_auto_increment', $field_autoincrement);
$check_field_autoincrement->addOption(1, _AM_TDMCREATE_FIELD_AUTO_INCREMENT);
// data row
- $tableOtherForm->addRow();
- $tableOtherForm->addCell($check_field_autoincrement->render(), null, 'data');
- } elseif($i > 1) {
+ $this->htmltable_parameters->addRow();
+ $this->htmltable_parameters->addCell($check_field_autoincrement->render(), null, 'data');
+ } elseif($i > 1) {
// Box header row
- $tableOtherForm->addRow('center bgyellow');
- $tableOtherForm->addCell(_AM_TDMCREATE_FIELD_ELEMENTS, 'first', 'header');
+ $this->htmltable_parameters->addRow('center bgyellow');
+ $this->htmltable_parameters->addCell(_AM_TDMCREATE_FIELD_ELEMENTS, 'first', 'header');
// fieldelements
$fieldelementsHandler=& xoops_getModuleHandler('fieldelements');
- $field_elements_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_ELEMENT_NAME, 'field_element_name', $this->getVar('field_element_name'));
- $field_elements_select->addOptionArray($fieldelementsHandler->getList());
+ $field_elements_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_ELEMENT_NAME, 'field_element_name', $this->getVar('field_element_name'));
+ $field_elements_select->addOptionArray($fieldelementsHandler->getList());
$criteria = new CriteriaCompo(new Criteria('table_id', $table_id));
- $criteria->add(new Criteria('table_mid', $table_mid));
+ $criteria->add(new Criteria('table_mid', $table_mid));
$criteria->setSort('table_name');
$criteria->setOrder('ASC');
$tbls_arr1 = $tablesHandler->getAll($criteria);
unset($criteria);
- foreach (array_keys($tbls_arr1) as $j)
- {
+ foreach (array_keys($tbls_arr1) as $j)
+ {
$tbls_name1 = $tbls_arr1[$j]->getVar('table_name');
- if ( $j[$i] == 'XoopsFormTables-'.$tbls_name1 ) {
- $field_elements_select->addOption('XoopsFormTables-'.$tbls_name1, 'Table : '.$tbls_name1);
- }
+ if ( $j[$i] == 'XoopsFormTables-'.$tbls_name1 ) {
+ $field_elements_select->addOption('XoopsFormTables-'.$tbls_name1, 'Table : '.$tbls_name1);
+ }
}
// data row
- $tableOtherForm->addRow();
- $tableOtherForm->addCell($field_elements_select->render(), null, 'data');
+ $this->htmltable_parameters->addRow();
+ $this->htmltable_parameters->addCell($field_elements_select->render(), null, 'data');
$field_display_admin = $this->isNew() ? 0 : $this->getVar('field_display_admin');
$check_field_display_admin = new XoopsFormCheckBox(' ', 'field_display_admin', $field_display_admin);
- $check_field_display_admin->addOption(1, _AM_TDMCREATE_FIELD_DISPLAY_ADMIN);
+ $check_field_display_admin->addOption(1, _AM_TDMCREATE_FIELD_ADMIN);
// data row
- $tableOtherForm->addRow();
- $tableOtherForm->addCell($check_field_display_admin->render(), null, 'data');
+ $this->htmltable_parameters->addRow();
+ $this->htmltable_parameters->addCell($check_field_display_admin->render(), null, 'data');
$field_display_user = $this->isNew() ? 0 : $this->getVar('field_display_user');
$check_field_display_user = new XoopsFormCheckBox(' ', 'field_display_user', $field_display_user);
- $check_field_display_user->addOption(1, _AM_TDMCREATE_FIELD_DISPLAY_USER);
+ $check_field_display_user->addOption(1, _AM_TDMCREATE_FIELD_USER);
// data row
- $tableOtherForm->addRow();
- $tableOtherForm->addCell($check_field_display_user->render(), null, 'data');
+ $this->htmltable_parameters->addRow();
+ $this->htmltable_parameters->addCell($check_field_display_user->render(), null, 'data');
$field_display_block = $this->isNew() ? 0 : $this->getVar('field_display_block');
$check_field_display_block = new XoopsFormCheckBox(' ', 'field_display_block', $field_display_block);
- $check_field_display_block->addOption(1, _AM_TDMCREATE_FIELD_DISPLAY_BLOCK);
+ $check_field_display_block->addOption(1, _AM_TDMCREATE_FIELD_BLOCK);
// data row
- $tableOtherForm->addRow();
- $tableOtherForm->addCell($check_field_display_block->render(), null, 'data');
+ $this->htmltable_parameters->addRow();
+ $this->htmltable_parameters->addCell($check_field_display_block->render(), null, 'data');
$field_mnfield = $this->isNew() ? 0 : $this->getVar('field_mainfield');
$field_mainfield = new XoopsFormRadio(' ', 'field_mainfield', $field_mnfield);
$field_mainfield->addOption( ' ', _AM_TDMCREATE_FIELD_MAINFIELD );
// data row
- $tableOtherForm->addRow();
- $tableOtherForm->addCell($field_mainfield->render(), null, 'data');
+ $this->htmltable_parameters->addRow();
+ $this->htmltable_parameters->addCell($field_mainfield->render(), null, 'data');
$field_search = $this->isNew() ? 0 : $this->getVar('field_search');
$check_field_search = new XoopsFormCheckBox(' ', 'field_search', $field_search);
- $check_field_search->addOption(1, _AM_TDMCREATE_FIELD_SEARCH);
+ $check_field_search->addOption(1, _AM_TDMCREATE_FIELD_SEARCH);
// data row
- $tableOtherForm->addRow();
- $tableOtherForm->addCell($check_field_search->render(), null, 'data');
+ $this->htmltable_parameters->addRow();
+ $this->htmltable_parameters->addCell($check_field_search->render(), null, 'data');
$field_required = $this->isNew() ? 0 : $this->getVar('field_required');
$check_field_required = new XoopsFormCheckBox(' ', 'field_required', $field_required);
$check_field_required->addOption(1, _AM_TDMCREATE_FIELD_REQUIRED);
// data row
- $tableOtherForm->addRow();
- $tableOtherForm->addCell($check_field_required->render(), null, 'data');
- }
- $tableForm->addCell($tableOtherForm->render(), null, 'data');
-
+ $this->htmltable_parameters->addRow();
+ $this->htmltable_parameters->addCell($check_field_required->render(), null, 'data');
+ }
+ $this->htmltable->addCell($this->htmltable_parameters->render(), null, 'data');
+
if (!$this->isNew()) {
- $tableFormHiddenId = new XoopsFormHidden('table_id', $this->getVar('table_id'));
- //$form->addElement(new XoopsFormHidden('fields_modified', true));
- }
+ $tableId_Hidden = new XoopsFormHidden('table_id', $this->table->getVar('table_id'));
+ $form->addElement($tableId_Hidden);
+ //$form->addElement(new XoopsFormHidden('fields_modified', true));
+ }
}
- $form->addElement($tableForm->render());
- /*if (!$this->isNew()) {
- $form->addElement(new XoopsFormHidden('table_id', $this->getVar('table_id')));
- $form->addElement(new XoopsFormHidden('fields_modified', true));
- }
-
- $form->addElement(new XoopsFormHidden('op', 'save_fields'));
- $form->addElement(new XoopsFormHidden('field_tid', $this->getVar('field_tid')));
- $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));*/
- $tableFormButton = new XoopsFormButton('', 'submit', _SUBMIT, 'submit');
- $tableForm->addRow('right grey');
- $tableForm->addCell($tableFormButton, null, 'data');
- $form->addElement(new XoopsFormHidden('op', 'save_fields'));
- $form->addElement($tableForm);
- $form->addElement($tableFormButton);
+ $formHidden = new XoopsFormHidden('op', 'save_fields');
+ $formButton = new XoopsFormButton('', 'submit', _SUBMIT, 'submit');
+ $this->htmltable->addCell($formHidden->render(), null, 'data');
+ $this->htmltable->addCell($formButton->render(), null, 'data');
+ $form->addElement($this->htmltable->render());
return $form;
}
}
-class TDMCreateFieldsHandler extends XoopsPersistableObjectHandler
+class TDMCreateFieldsHandler extends XoopsPersistableObjectHandler
{
- function __construct(&$db)
+ function __construct(&$db)
{
parent::__construct($db, 'mod_tdmcreate_fields', 'tdmcreatefields', 'field_id', 'field_tid');
}
-}
+}
\ No newline at end of file
Deleted: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields_class.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields_class.php 2014-03-25 08:52:13 UTC (rev 12409)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields_class.php 2014-03-27 00:26:31 UTC (rev 12410)
@@ -1,249 +0,0 @@
-<?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
- which is considered copyrighted (c) material of the original comment or credit authors.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- */
-/**
- * tdmcreate module
- *
- * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
- * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
- * @package tdmcreate
- * @since 2.5.0
- * @author Txmod Xoops http://www.txmodxoops.org
- * @version $Id: fields_class.php 12258 2014-01-02 09:33:29Z timgno $
- */
-if (!defined('XOOPS_ROOT_PATH')) {
- die('XOOPS root path not defined');
-}
-
-class FieldsClass /*extends HeaderFile*/
-{
- /*
- * @var string
- */
- public $_module = null;
- /*
- * @var array
- */
- public $_table = array();
- /*
- * @var array
- */
- public $_type = array();
- /*
- * @var string
- */
- public $file_name = null;
- /*
- * @public function constructor
- * @param string $modules
- */
- public function __construct($module, $table, $file_name) {
- $this->_module = $module;
- $this->_table[] = $table;
- $this->file_name = $file_name;
- }
- /*
- * @public function getInitVar
- * @param array $element_name
- * @param mixed $xobj_dtype
- */
- public function getInitVar(array $element_name, $xobj_dtype) {
- $ret = <<<EOT
- \$this->initVar('{$element_name[0]}', {$xobj_dtype});
-EOT;
- return $ret;
- }
- /*
- * @public function render
- * @param null
- */
- public function render() {
- $module_name = $this->getModuleName();
- $language = $this->getLanguage('_AM_', '_');
- // fpda = fields parameter display admin
- // fpe = fields parameter element
- // fprf = fields parameter required field
- $mod_name = strtolower($mod_name);
- $table_name = strtolower($table_name);
- $table_fieldname = strtolower($table_fieldname);
- $ret = '';
- // Counts the number of fields
- $fields = explode('|', $table_fields);
- $nb_fields = count($fields);
- // Retrieve the data
- if ( $option == 0 )
- {
- // Creation of the constructor
- for ($i = 0; $i < $nb_fields; $i++)
- {
- $struct = explode(':', $fields[$i]);
- if ( $struct[1] == 'int' || $struct[1] == 'tinyint' || $struct[1] == 'mediumint' || $struct[1] == 'smallint' ) {
- $ret .= <<<EOT
- \$this->initVar(\''.$struct[0].'\', XOBJ_DTYPE_INT);
-EOT;
- } elseif ( $struct[1] == 'char' || $struct[1] == 'varchar' ) {
- $ret .= <<<EOT
- \$this->initVar(\''.$struct[0].'\', XOBJ_DTYPE_TXTBOX);
-EOT;
- } elseif ( $struct[1] == 'text' || $struct[1] == 'tinytext' || $struct[1] == 'mediumtext' || $struct[1] == 'longtext' ) {
- $ret .= <<<EOT
- \$this->initVar(\''.$struct[0].'\', XOBJ_DTYPE_TXTAREA);';
- } elseif ( $struct[1] == 'float' ) {
- $ret .= <<<EOT
- \$this->initVar(\''.$struct[0].'\', XOBJ_DTYPE_FLOAT);';
- } elseif ( $struct[1] == 'decimal' || $struct[1] == 'double' ) {
- $ret .= <<<EOT
- \$this->initVar(\''.$struct[0].'\', XOBJ_DTYPE_DECIMAL);';
- } elseif ( $struct[1] == 'enum' ) {
- $ret .= <<<EOT
- \$this->initVar(\''.$struct[0].'\', XOBJ_DTYPE_ENUM);';
- } elseif ( $struct[1] == 'email' ) {
- $ret .= <<<EOT
- \$this->initVar(\''.$struct[0].'\', XOBJ_DTYPE_EMAIL);';
- } elseif ( $struct[1] == 'url' ) {
- $ret .= <<<EOT
- \$this->initVar(\''.$struct[0].'\', XOBJ_DTYPE_URL);';
- } elseif ( $struct[1] == 'date' || $struct[1] == 'datetime' || $struct[1] == 'timestamp' || $struct[1] == 'time' || $struct[1] == 'year' ) {
- $ret .= <<<EOT
- \$this->initVar(\''.$struct[0].'\', XOBJ_DTYPE_LTIME);';
- }/* elseif ( $struct[1] == 'other' ) {
- $ret .= <<<EOT
- \$this->initVar(\''.$struct[0].'\', XOBJ_DTYPE_OTHER, '.$struct[2].', false);';
- }*/
- }
- } else if ( $option == 1 ) {
- // Creation form
- for ($i=0; $i < $nb_fields; $i++)
- {
- if ( $i != 0 ) {
- $struct = explode(':', $fields[$i]);
- $lng_form = $language.strtoupper($struct[0]);
- $ret .= <<<EOT
- $this->form_elements($i, $mod_name, $table_name, $table_fieldname, $fpe, $fprf, $lng_form, $struct[0]);
- }
- }
- } else if ( $option == 2 ) {
- // Creation of file mysql.sql
- $ret .= <<<EOT
-
-#
-# Structure table for `mod_'.$mod_name.'_'.strtolower($table_name).'` '.$nb_fields.'
-#
-
-CREATE TABLE `mod_'.$mod_name.'_'.strtolower($table_name).'` (
-';
- $j = 0;
- for ($i=0; $i < $nb_fields; $i++)
- {
- $struct = explode(':', $fields[$i]);
-// echo "--- START ----------------- STRUCTURE -------------------------------------</br>";
-// var_dump($struct);
- //Debut
- if ( $struct[0] != ' ' )
- {
- //If as text, (not value)
- if ( $struct[1] == 'text' || $struct[1] == 'date' || $struct[1] == 'timestamp' ) {
- $type = $struct[1];
- } else {
- $type = $struct[1].' ('.$struct[2].')';
- }
- //If as empty is default not string(not value), if as text not default, if as numeric default is 0 or 0.0000
- //echo $struct[5]." struct[5] --------------- </br>";
- if ( $struct[5] == '' ) {
- $default = "default ''";
- //echo " default 1 </br>";
- } elseif ( $struct[1] == 'text' || $struct[1] == 'tinytext' || $struct[1] == 'mediumtext' || $struct[1] == 'longtext' ) {
- $default = "";
- // echo " default 2 </br>";
- } elseif ( $struct[1] == 'int' || $struct[1] == 'tinyint' || $struct[1] == 'mediumint' || $struct[1] == 'smallint') {
- $default = "default '0'";
- //echo " default 3 </br>";
- } elseif ( $struct[1] == 'decimal' || $struct[1] == 'double' || $struct[1] == 'float' ) {
- $default = "default '0.0000'";
- // echo " default 4 </br>";
- } elseif ( $struct[1] == 'date' ) {
- // echo " default 5 </br>";
- $default = "default '0000-00-00'";
- } elseif ( $struct[1] == 'datetime' || $struct[1] == 'timestamp') {
- $default = "default '0000-00-00 00:00:00'";
- //echo " default 6 </br>";
- } elseif ( $struct[1] == 'time' ) {
- $default = "default '00:00:00'";
- // echo " default 7 </br>";
- } elseif ( $struct[1] == 'year' ) {
- $default = "default '0000'";
- //echo " default 8 </br>";
- } elseif ( $struct[1] == 'other' ) {
- $default = "default '".$struct[5]."'";
- //echo " default 9 </br>";
- } else {
- $default = "default ''";
- //echo " default 10 </br>";
- }
-
-// echo $default." Default </br>";
-// echo $struct[0]." struct[0] </br>";
-// echo $struct[6]." struct[6] </br>";
-
- if ( $i == 0 ) {
- $comma[$j] = 'PRIMARY KEY (`'.$struct[0].'`)';
- $j++;
- $ret .= <<<EOT`'.$struct[0].'` '.$type.' '.$struct[3].' '.$struct[4].' auto_increment,
-';
- } else {
- if ( $struct[6] == 'unique' || $struct[6] == 'index' || $struct[6] == 'fulltext')
- {
- if ( $struct[6] == 'unique' ) {
- $ret .= <<<EOT`'.$struct[0].'` '.$type.' '.$struct[3].' '.$struct[4].' '.$default.',
-';
- $comma[$j] = 'KEY `'.$struct[0].'` (`'.$struct[0].'`)';
- } else if ( $struct[6] == 'index' ) {
- $ret .= <<<EOT`'.$struct[0].'` '.$type.' '.$struct[3].' '.$struct[4].' '.$default.',
-';
- $comma[$j] = 'INDEX (`'.$struct[0].'`)';
- } else if ( $struct[6] == 'fulltext' ) {
- $ret .= <<<EOT`'.$struct[0].'` '.$type.' '.$struct[3].' '.$struct[4].' '.$default.',
-';
- $comma[$j] = 'FULLTEXT KEY `'.$struct[0].'` (`'.$struct[0].'`)';
- }
- $j++;
- } else {
- $ret .= <<<EOT`'.$struct[0].'` '.$type.' '.$struct[3].' '.$struct[4].' '.$default.',
-';
- }
- }
- }
-// echo $i."--- i -------</br>";
-// echo $j."--- j -------</br>";
-// var_dump($comma);
-// echo $comma[$i]."comma[i] </br>";
-// echo $text."</br>";
- }
- //Problem comma
- $key = '';
- for ($i=0; $i < $j; $i++)
- {
- if ( $i != $j - 1 ) {
- $key .= $comma[$i].',
-';
- } else {
- $key .= $comma[$i].'
-';
- }
- }
- // echo $key."================= KEY ========================= </br>";
- $ret .= <<<EOT$key;
- $ret .= <<<EOT) ENGINE=MyISAM;';
- }
- return $text;
-EOT;
- return $ret;
- }
-}
\ No newline at end of file
Deleted: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields_database.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields_database.php 2014-03-25 08:52:13 UTC (rev 12409)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields_database.php 2014-03-27 00:26:31 UTC (rev 12410)
@@ -1,250 +0,0 @@
-<?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
- which is considered copyrighted (c) material of the original comment or credit authors.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- */
-/**
- * tdmcreate module
- *
- * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
- * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
- * @package tdmcreate
- * @since 2.5.0
- * @author Txmod Xoops http://www.txmodxoops.org
- * @version $Id: fields_database.php 12258 2014-01-02 09:33:29Z timgno $
- */
-if (!defined('XOOPS_ROOT_PATH')) {
- die('XOOPS root path not defined');
-}
-
-class FieldsDatabase /*extends HeaderFile*/
-{
- /*
- * @var string
- */
- public $_module = null;
- /*
- * @var string
- */
- public $_table = array();
- /*
- * @var string
- */
- public $file_name = null;
- /*
- * @public function constructor
- * @param string $modules
- */
- public function __construct($module, $table, $file_name) {
- $this->_module = $module;
- $this->_table[] = $table;
- $this->file_name = $file_name;
- }
- /*
- * @public function getSupportName
- * @param null
- */
- public function getDatabaseTypes() {
- $ret = $this->_module->getVar('mod_support_name');
- return $ret;
- }
- /*
- * @public function getSupportName
- * @param null
- */
- public function getDatabaseFields() {
- $ret = $this->_module->getVar('mod_support_url');
- return $ret;
- }
- /*
- * @public function render
- * @param null
- */
- public function render() {
- $module_name = $this->getModuleName();
- $language = $this->getLanguage('_AM_', '_');
- // fpda = fields parameter display admin
- // fpe = fields parameter element
- // fprf = fields parameter required field
- $mod_name = strtolower($mod_name);
- $table_name = strtolower($table_name);
- $table_fieldname = strtolower($table_fieldname);
- $text = '';
- // Counts the number of fields
- $fields = explode('|', $table_fields);
- $nb_fields = count($fields);
- // Retrieve the data
- if ( $option == 0 )
- {
- // Creation of the constructor
- for ($i = 0; $i < $nb_fields; $i++)
- {
- $struct = explode(':', $fields[$i]);
- if ( $struct[1] == 'int' || $struct[1] == 'tinyint' || $struct[1] == 'mediumint' || $struct[1] == 'smallint' ) {
- $ret .= <<<EOT
- \$this->initVar(\''.$struct[0].'\', XOBJ_DTYPE_INT);
-EOT;
- } elseif ( $struct[1] == 'char' || $struct[1] == 'varchar' ) {
- $ret .= <<<EOT
- \$this->initVar(\''.$struct[0].'\', XOBJ_DTYPE_TXTBOX);
-EOT;
- } elseif ( $struct[1] == 'text' || $struct[1] == 'tinytext' || $struct[1] == 'mediumtext' || $struct[1] == 'longtext' ) {
- $ret .= <<<EOT
- \$this->initVar(\''.$struct[0].'\', XOBJ_DTYPE_TXTAREA);';
- } elseif ( $struct[1] == 'float' ) {
- $ret .= <<<EOT
- \$this->initVar(\''.$struct[0].'\', XOBJ_DTYPE_FLOAT);';
- } elseif ( $struct[1] == 'decimal' || $struct[1] == 'double' ) {
- $ret .= <<<EOT
- \$this->initVar(\''.$struct[0].'\', XOBJ_DTYPE_DECIMAL);';
- } elseif ( $struct[1] == 'enum' ) {
- $ret .= <<<EOT
- \$this->initVar(\''.$struct[0].'\', XOBJ_DTYPE_ENUM);';
- } elseif ( $struct[1] == 'email' ) {
- $ret .= <<<EOT
- \$this->initVar(\''.$struct[0].'\', XOBJ_DTYPE_EMAIL);';
- } elseif ( $struct[1] == 'url' ) {
- $ret .= <<<EOT
- \$this->initVar(\''.$struct[0].'\', XOBJ_DTYPE_URL);';
- } elseif ( $struct[1] == 'date' || $struct[1] == 'datetime' || $struct[1] == 'timestamp' || $struct[1] == 'time' || $struct[1] == 'year' ) {
- $ret .= <<<EOT
- \$this->initVar(\''.$struct[0].'\', XOBJ_DTYPE_LTIME);';
- }/* elseif ( $struct[1] == 'other' ) {
- $ret .= <<<EOT
- \$this->initVar(\''.$struct[0].'\', XOBJ_DTYPE_OTHER, '.$struct[2].', false);';
- }*/
- }
- } else if ( $option == 1 ) {
- // Creation form
- for ($i=0; $i < $nb_fields; $i++)
- {
- if ( $i != 0 ) {
- $struct = explode(':', $fields[$i]);
- $lng_form = $language.strtoupper($struct[0]);
- $ret .= <<<EOT
- $this->form_elements($i, $mod_name, $table_name, $table_fieldname, $fpe, $fprf, $lng_form, $struct[0]);
- }
- }
- } else if ( $option == 2 ) {
- // Creation of file mysql.sql
- $ret .= <<<EOT
-
-#
-# Structure table for `mod_'.$mod_name.'_'.strtolower($table_name).'` '.$nb_fields.'
-#
-
-CREATE TABLE `mod_'.$mod_name.'_'.strtolower($table_name).'` (
-';
- $j = 0;
- for ($i=0; $i < $nb_fields; $i++)
- {
- $struct = explode(':', $fields[$i]);
-// echo "--- START ----------------- STRUCTURE -------------------------------------</br>";
-// var_dump($struct);
- //Debut
- if ( $struct[0] != ' ' )
- {
- //If as text, (not value)
- if ( $struct[1] == 'text' || $struct[1] == 'date' || $struct[1] == 'timestamp' ) {
- $type = $struct[1];
- } else {
- $type = $struct[1].' ('.$struct[2].')';
- }
- //If as empty is default not string(not value), if as text not default, if as numeric default is 0 or 0.0000
- //echo $struct[5]." struct[5] --------------- </br>";
- if ( $struct[5] == '' ) {
- $default = "default ''";
- //echo " default 1 </br>";
- } elseif ( $struct[1] == 'text' || $struct[1] == 'tinytext' || $struct[1] == 'mediumtext' || $struct[1] == 'longtext' ) {
- $default = "";
- // echo " default 2 </br>";
- } elseif ( $struct[1] == 'int' || $struct[1] == 'tinyint' || $struct[1] == 'mediumint' || $struct[1] == 'smallint') {
- $default = "default '0'";
- //echo " default 3 </br>";
- } elseif ( $struct[1] == 'decimal' || $struct[1] == 'double' || $struct[1] == 'float' ) {
- $default = "default '0.0000'";
- // echo " default 4 </br>";
- } elseif ( $struct[1] == 'date' ) {
- // echo " default 5 </br>";
- $default = "default '0000-00-00'";
- } elseif ( $struct[1] == 'datetime' || $struct[1] == 'timestamp') {
- $default = "default '0000-00-00 00:00:00'";
- //echo " default 6 </br>";
- } elseif ( $struct[1] == 'time' ) {
- $default = "default '00:00:00'";
- // echo " default 7 </br>";
- } elseif ( $struct[1] == 'year' ) {
- $default = "default '0000'";
- //echo " default 8 </br>";
- } elseif ( $struct[1] == 'other' ) {
- $default = "default '".$struct[5]."'";
- //echo " default 9 </br>";
- } else {
- $default = "default ''";
- //echo " default 10 </br>";
- }
-
-// echo $default." Default </br>";
-// echo $struct[0]." struct[0] </br>";
-// echo $struct[6]." struct[6] </br>";
-
- if ( $i == 0 ) {
- $comma[$j] = 'PRIMARY KEY (`'.$struct[0].'`)';
- $j++;
- $ret .= <<<EOT`'.$struct[0].'` '.$type.' '.$struct[3].' '.$struct[4].' auto_increment,
-';
- } else {
- if ( $struct[6] == 'unique' || $struct[6] == 'index' || $struct[6] == 'fulltext')
- {
- if ( $struct[6] == 'unique' ) {
- $ret .= <<<EOT`'.$struct[0].'` '.$type.' '.$struct[3].' '.$struct[4].' '.$default.',
-';
- $comma[$j] = 'KEY `'.$struct[0].'` (`'.$struct[0].'`)';
- } else if ( $struct[6] == 'index' ) {
- $ret .= <<<EOT`'.$struct[0].'` '.$type.' '.$struct[3].' '.$struct[4].' '.$default.',
-';
- $comma[$j] = 'INDEX (`'.$struct[0].'`)';
- } else if ( $struct[6] == 'fulltext' ) {
- $ret .= <<<EOT`'.$struct[0].'` '.$type.' '.$struct[3].' '.$struct[4].' '.$default.',
-';
- $comma[$j] = 'FULLTEXT KEY `'.$struct[0].'` (`'.$struct[0].'`)';
- }
- $j++;
- } else {
- $ret .= <<<EOT`'.$struct[0].'` '.$type.' '.$struct[3].' '.$struct[4].' '.$default.',
-';
- }
- }
- }
-// echo $i."--- i -------</br>";
-// echo $j."--- j -------</br>";
-// var_dump($comma);
-// echo $comma[$i]."comma[i] </br>";
-// echo $text."</br>";
- }
- //Problem comma
- $key = '';
- for ($i=0; $i < $j; $i++)
- {
- if ( $i != $j - 1 ) {
- $key .= $comma[$i].',
-';
- } else {
- $key .= $comma[$i].'
-';
- }
- }
- // echo $key."================= KEY ========================= </br>";
- $ret .= <<<EOT$key;
- $ret .= <<<EOT) ENGINE=MyISAM;';
- }
- return $text;
-EOT;
- return $ret;
- }
-}
\ No newline at end of file
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/architecture.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/architecture.php 2014-03-25 08:52:13 UTC (rev 12409)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/architecture.php 2014-03-27 00:26:31 UTC (rev 12410)
@@ -27,15 +27,15 @@
/*
* @var mixed
*/
- public $structure = null;
+ private $structure = null;
/*
* @var mixed
*/
- public $path = null;
+ private $path = null;
/*
* @var mixed
*/
- public $upload_path = null;
+ private $upload_path = null;
/*
* @public function constructor class
* @param null
@@ -76,15 +76,17 @@
public function getArchitectureFiles( $module )
{
$indexFile = $this->path.'/index.html';
+ $docs_folder = $this->path.'/docs';
//Creation of the Directory of modules
- $targetDirectory = $this->upload_path.'/'. str_replace(' ', '', strtolower($module->getVar('mod_name')));
- $upload_folder_docs = $targetDirectory.'/docs';
- $upload_folder_images = $targetDirectory.'/images';
+ $targetDirectory = $this->upload_path.'/modules/'. str_replace(' ', '', strtolower($module->getVar('mod_name')));
+ $upload_images_folder = $this->upload_path.'/images/modules';
// Creation of "module" folder
$this->structure->getPath($targetDirectory);
// Creation of "module" folder
$this->structure->makeDir($targetDirectory);
+ // Copied of index.html file in "root module" folder
+ $this->structure->copyFile('', $indexFile, 'index.html');
// Creation of "admin" folder and index.html file
$this->structure->makeDirAndCopyFile('admin', $indexFile, 'index.html');
// Creation of "blocks" folder and index.html file
@@ -97,7 +99,7 @@
$this->structure->makeDirAndCopyFile('images', $indexFile, 'index.html');
//Copy the logo of the module
$mod_image = str_replace(' ', '', strtolower($module->getVar('mod_image')));
- $this->structure->copyFile('images', $upload_folder_images.'/modules/'.$mod_image, $mod_image);
+ $this->structure->copyFile('images', $upload_images_folder.'/'.$mod_image, $mod_image);
// Creation of 'images/icons' folder and index.html file - Added in Version 1.15
$this->structure->makeDirAndCopyFile('images/icons', $indexFile, 'index.html');
@@ -112,20 +114,20 @@
// Creation of 'arrow.gif' file
//$this->structure->copyFile('images/icons/16', $upload_folder_images.'/icons/16/arrow.gif', 'arrow.gif');
// Creation of 'txmodxoops_logo.png' file
- $this->structure->copyFile('images', $upload_folder_images.'/txmodxoops_logo.png', 'txmodxoops_logo.png');
+ $this->structure->copyFile('images', $upload_images_folder.'/txmodxoops_logo.png', 'txmodxoops_logo.png');
// Creation of 'docs' folder and index.html file
$this->structure->makeDirAndCopyFile('docs', $indexFile, 'index.html');
// Creation of 'credits.txt' file
- $this->structure->copyFile('docs', $fdocs.'/credits.txt', 'credits.txt');
+ $this->structure->copyFile('docs', $docs_folder.'/credits.txt', 'credits.txt');
// Creation of 'install.txt' file
- $this->structure->copyFile('docs', $fdocs.'/install.txt', 'install.txt');
+ $this->structure->copyFile('docs', $docs_folder.'/install.txt', 'install.txt');
// Creation of 'lang_diff.txt' file
- $this->structure->copyFile('docs', $fdocs.'/lang_diff.txt', 'lang_diff.txt');
+ $this->structure->copyFile('docs', $docs_folder.'/lang_diff.txt', 'lang_diff.txt');
// Creation of 'license.txt' file
- $this->structure->copyFile('docs', $fdocs.'/license.txt', 'license.txt');
+ $this->structure->copyFile('docs', $docs_folder.'/license.txt', 'license.txt');
// Creation of 'readme.txt' file
- $this->structure->copyFile('docs', $fdocs.'/readme.txt', 'readme.txt');
+ $this->structure->copyFile('docs', $docs_folder.'/readme.txt', 'readme.txt');
// Creation of "include" folder and index.html file
$this->structure->makeDirAndCopyFile('include', $indexFile, 'index.html');
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/htmltable.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/htmltable.php 2014-03-25 08:52:13 UTC (rev 12409)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/htmltable.php 2014-03-27 00:26:31 UTC (rev 12410)
@@ -18,7 +18,7 @@
* @author Txmod Xoops http://www.txmodxoops.org
* @version $Id: htmltable.php 12258 2014-01-02 09:33:29Z timgno $
*/
-if (!defined('XOOPS_ROOT_PATH')) { die("XOOPS root path not defined"); }
+defined('XOOPS_ROOT_PATH') or die('Restricted access');
/**
* Base class for html tables
@@ -27,8 +27,7 @@
* @package tdmcreate
* @access public
*/
-//xoops_load('XoopsFormElement');
-class TDMCreateHtmlTable /*extends XoopsFormElement*/
+class TDMCreateHtmlTable
{
/**
* array of {@TDMCreateHtmlTable} objects
@@ -49,15 +48,15 @@
*
* @var string
*/
- private $table_string = '';
-
+ private $data = '';
+
/**
* string of {@link TDMCreateHtmlTable} objects
*
* @var string
*/
- private $data = '';
-
+ private $_id = '';
+
/**
* string of {@link TDMCreateHtmlTable} objects
*
@@ -84,7 +83,7 @@
*
* @param null
*/
- public function __construct()
+ public function __construct()
{
}
@@ -106,17 +105,17 @@
*
* @param string $id attribute of the table
* @param string $_class "css class" attribute for the <table> tag
- * @param int $border "border" attribute for the <table> tag
- * @param int $cellspacing "cellspacing" attribute for the <table> tag
- * @param int $cellpadding "cellpadding" attribute for the <table> tag
- * @param array $attributes attributes for the <table> tag
+ * @param mixed $attributes attributes for the <table> tag
*/
- public function initTable($id = '', $_class = '', $border = 0, $cellspacing = 2, $cellpadding = 0, $attributes = array() )
- {
- $this->table_string = '<table' . ( !empty($id) ? ' id="' . $id . '"' : '' );
- $this->table_string .= ( !empty($_class) ? ' class="' . $_class . '"' : '' );
- $this->table_string .= $this->addAttributes( $attributes );
- $this->table_string .= ' border="' . $border . '" cellspacing="' . $cellspacing . '" cellpadding="' . $cellpadding . '">';
+ public function initTable($_class = null, $id = null, $attributes = false )
+ {
+ $ret = '<table' . ( !empty($id) ? ' id="' . $id . '"' : '' );
+ $ret .= ( !empty($_class) ? ' class="' . $_class . '"' : '' );
+ if($attributes && is_array($attributes)) {
+ $ret .= $this->addAttributes( $attributes );
+ }
+ $ret .= '>';
+ return $ret;
}
/**
@@ -125,10 +124,10 @@
* @param array $attributes
* @return string
*/
- public function addAttributes( $attributes )
+ public function addAttributes( $attributes = array() )
{
$str = '';
- if (is_array( $attributes )) {
+ if(is_array( $attributes )) {
foreach( $attributes as $k => $v ) {
$str .= " {$k}=\"{$v}\"";
}
@@ -140,13 +139,15 @@
* Add an element row to the table
*
* @param string $_class
- * @param array $attributes
+ * @param mixed $attributes
*/
- public function addRow($class = '', $attributes = array() )
- {
- $row = self::getInstance();
+ public function addRow( $class = '', $attributes = null )
+ {
+ $row = self::getInstance();
$row->addTableRow( $class, $attributes );
- array_push( $this->rows, $row );
+ if(is_array( $attributes )) {
+ array_push( $this->rows, $row );
+ }
}
/**
@@ -155,28 +156,30 @@
* @param object $data reference to a {@link XoopsFormElement}
* @param string $class css element
* @param string $type reference to a header or data
- * @param array $attributes attributes for a cell
+ * @param mixed $attributes attributes for a cell
*/
- public function addCell($data, $class = '', $type = 'data', $attributes = array() )
+ public function addCell( $data, $class = '', $type = 'data', $attributes = null )
{
$cell = self::getInstance();
$cell->addTableCell( $data, $class, $type, $attributes );
// add new cell to current row's list of cells
$curRow =& $this->rows[ count( $this->rows ) - 1 ]; // copy by reference
- if(isset($curRow->cells) && isset($cell)) {
- array_push( $curRow->cells, $cell );
+ if(is_array( $attributes )) {
+ if(isset($curRow->cells) && isset($cell)) {
+ array_push( $curRow->cells, $cell );
+ }
}
}
/**
* Add an array of cells
*
- * @param object $data reference to a {@link XoopsFormElement}
+ * @param object $data content text
* @param string $_class css element
* @param string $type reference to a header or data
* @param array $attributes attributes for a cell
*/
- public function addCells($data, $class = '', $type = 'data', $attributes = array() )
+ public function addCells( $data, $class = '', $type = 'data', $attributes = array() )
{
if (is_array($data)) {
foreach( $data as $data_cell ) {
@@ -184,6 +187,27 @@
}
}
}
+
+ /**
+ * Add Cell for tables
+ *
+ * return end of html table
+ */
+ public function getRows($rows)
+ {
+ $ret = '';
+ $this->rows = $rows;
+ if (is_array( $this->rows )) {
+ foreach( $this->rows as $row )
+ {
+ $ret .= !empty($row->_class) ? '<tr class="' . $row->_class . '"' : '<tr';
+ $ret .= $this->addAttributes( $row->attributes ) . '>';
+ $ret .= $this->getRowCells( $row->cells );
+ $ret .= '</tr>';
+ }
+ }
+ return $ret;
+ }
/**
* get an array of row & cells
@@ -195,24 +219,26 @@
{
$str = '';
$this->cells = $cells;
- foreach( $this->cells as $cell )
- {
- $tag = ($cell->type == 'data')? 'td': 'th';
- $str .= !empty($cell->_class) ? '<' . $tag . ' class="' . $cell->_class . '"' : '<' . $tag;
- $str .= $this->addAttributes( $cell->attributes ) . '>';
- $str .= $cell->data;
- $str .= '</' . $tag . '>';
- }
+ if (is_array( $this->cells )) {
+ foreach( $this->cells as $cell )
+ {
+ $tag = ($cell->type == 'data')? 'td': 'th';
+ $str .= !empty($cell->_class) ? '<' . $tag . ' class="' . $cell->_class . '"' : '<' . $tag;
+ $str .= $this->addAttributes( $cell->attributes ) . '>';
+ $str .= $cell->data;
+ $str .= '</' . $tag . '>';
+ }
+ }
return $str;
}
/**
* Add Row for tables
*
- * @author TXMod Xoops <in...@tx...>
- * @package tdmcreate
+ * @param string $class css element
+ * @param mixed $attributes attributes for a cell
*/
- public function addTableRow($class = '', $attributes = null)
+ public function addTableRow( $class = '', $attributes = null )
{
$this->_class = $class;
if(!is_array($attributes)){
@@ -225,30 +251,48 @@
/**
* Add Cell for tables
*
- * @author TXMod Xoops <in...@tx...>
- * @package tdmcreate
+ * @param string $data content text
+ * @param string $class css style
+ * @param string $type reference to a header or data
+ * @param array $attributes attributes for a cell
*/
- public function addTableCell( $data, $class = '', $type = '', $attributes = array())
+ public function addTableCell( $data, $class = '', $type = '', $attributes = null )
{
$this->data = $data;
$this->_class = $class;
$this->type = $type;
- $this->attributes = $attributes;
+ if(!is_array($attributes)){
+ $this->attributes[] = $attributes;
+ } else {
+ $this->attributes = $attributes;
+ }
}
+
+ /**
+ * Add Cell for tables
+ *
+ * return end of html table
+ */
+ public function endTable()
+ {
+ $ret = '';
+ $class = $this->_class;
+ $attributes = $this->attributes;
+ $rows = $this->addRow( $class, $attributes );
+ $ret .= $this->getRows($rows);
+ $ret .= '</table>';
+ return $ret;
+ }
/**
- * render html table
+ * Render Function
+ *
+ * return html table
*/
public function render()
{
- foreach( $this->rows as $row )
- {
- $this->table_string .= !empty($row->_class) ? '<tr class="' . $row->_class . '"' : '<tr';
- $this->table_string .= $this->addAttributes( $row->attributes ) . '>';
- $this->table_string .= $this->getRowCells( $row->cells );
- $this->table_string .= '</tr>';
- }
- $this->table_string .= '</table>';
- return $this->table_string;
+ $ret = $this->initTable($id = '', $_class = '', $border = 0, $cellspacing = 2, $cellpadding = 0, $attributes = array() );
+ $ret .= $this->endTable();
+ return $ret;
}
}
\ No newline at end of file
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/logoGenerator.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/logoGenerator.php 2014-03-25 08:52:13 UTC (rev 12409)
+++ XoopsModules/TDMCreate/bra...
[truncated message content] |