|
From: <txm...@us...> - 2014-06-05 15:12:45
|
Revision: 12565
http://sourceforge.net/p/xoops/svn/12565
Author: txmodxoops
Date: 2014-06-05 15:12:37 +0000 (Thu, 05 Jun 2014)
Log Message:
-----------
Modified Paths:
--------------
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin_pages.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/architecture.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/blocks_files.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/blocks_templates.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/class_files.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/formelements.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include_comments.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include_install.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include_notifications.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include_search.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language_help.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language_main.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language_modinfo.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/sql_files.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_pages.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_templates.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_xoopsversion.php
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin_pages.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin_pages.php 2014-06-05 08:27:03 UTC (rev 12564)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin_pages.php 2014-06-05 15:12:37 UTC (rev 12565)
@@ -33,18 +33,15 @@
/*
* @var string
*/
- private $table_name = null;
+ private $table = null;
/*
- * @var string
- */
- private $fields = null;
- /*
* @public function constructor
* @param null
*/
public function __construct() {
$this->adminobjects = AdminObjects::getInstance();
- $this->tdmcfile = TDMCreateFile::getInstance();
+ $this->tdmcfile = TDMCreateFile::getInstance();
+ $this->tdmcreate = TDMCreate::getInstance();
}
/*
* @static function &getInstance
@@ -61,16 +58,11 @@
/*
* @public function write
* @param string $module
- * @param string $table_name
- * @param array $fields
- * @param string $filename
+ * @param string $table
*/
- public function write($module, $table_name, $fields) {
+ public function write($module, $table) {
$this->setModule($module);
- //$this->setTable($table);
- //$this->setFileName($filename);
- $this->table_name = $table_name;
- $this->fields = $fields;
+ $this->table = $table;
}
/*
* @public function getAdminPagesHeader
@@ -96,7 +88,7 @@
* @param string $table_name
* @param string $language
*/
- public function getAdminPagesList($table_name, $language, $fpif, $fpmf) {
+ public function getAdminPagesList($table_name, $language, $fields, $fpif, $fpmf) {
$stu_table_name = strtoupper($table_name);
$ret = <<<EOT
case 'list':
@@ -108,7 +100,7 @@
\$criteria = new CriteriaCompo();
\$criteria->setSort('{$fpif} ASC, {$fpmf}');
\$criteria->setOrder('ASC');
- \${$table_name}_rows = \${$table_name}Handler->getCount();
+ \${$table_name}_rows = \${$table_name}Handler->getCount(\$criteria);
\${$table_name}_arr = \${$table_name}Handler->getAll(\$criteria);
unset(\$criteria);
@@ -118,9 +110,9 @@
foreach (array_keys(\${$table_name}_arr) as \$i)
{\n
EOT;
- foreach(array_keys($this->fields) as $f)
+ foreach(array_keys($fields) as $f)
{
- $field_name = $this->fields[$f]->getVar('field_name');
+ $field_name = $fields[$f]->getVar('field_name');
$rp_field_name = $field_name;
if(strpos($field_name, '_')) {
$str = strpos($field_name, '_');
@@ -175,7 +167,7 @@
* @param string $table_name
* @param string $language
*/
- public function getAdminPagesSave($module_name, $table_name, $language, $fpif, $fpmf)
+ public function getAdminPagesSave($module_name, $table_name, $language, $fields, $fpif, $fpmf)
{
$ret = <<<EOT
case 'save':
@@ -188,10 +180,11 @@
\${$table_name}Obj =& \${$table_name}Handler->create();
}
EOT;
- foreach (array_keys($this->fields) as $f)
+
+ foreach (array_keys($fields) as $f)
{
- $field_name = $this->fields[$f]->getVar('field_name');
- $field_element = $this->fields[$f]->getVar('field_element');
+ $field_name = $fields[$f]->getVar('field_name');
+ $field_element = $fields[$f]->getVar('field_element');
/*if(($field_element == 1) || ($field_element == 2) || ($field_element == 3) || ($field_element > 11)) {
$this->adminobjects->getSimpleSetVar($table_name, $field_name);
} else*/if(($field_element == 4) || ($field_element == 5)) {
@@ -287,27 +280,33 @@
public function renderFile($filename)
{
$fpif = ''; $fpmf = '';
- foreach(array_keys($this->fields) as $f)
+ $table_id = $this->table->getVar('table_id');
+ $criteria_fields = new CriteriaCompo();
+ $criteria_fields->add(new Criteria('field_tid', $table_id));
+ $fields_all = $this->tdmcreate->getHandler('fields')->getObjects($criteria_fields);
+ unset($criteria_fields);
+ foreach(array_keys($fields_all) as $f)
{
- $field_name = $this->fields[$f]->getVar('field_name');
+ $field_name = $fields_all[$f]->getVar('field_name');
if($f == 1) {
$fpif = $field_name;
}
- if($this->fields[$f]->getVar('field_main') == 1) {
+ if($fields_all[$f]->getVar('field_main') == 1) {
$fpmf = $field_name;
}
}
$module = $this->getModule();
- $module_name = $module->getVar('mod_name');
+ $module_name = $module->getVar('mod_name');
+ $table_name = $this->table->getVar('table_name');
//$filename = $this->getFileName();
$language = $this->getLanguage($module_name, 'AM');
$content = $this->getHeaderFilesComments($module, $filename);
- $content .= $this->getAdminPagesHeader($module_name, $this->table_name);
- $content .= $this->getAdminPagesList($this->table_name, $language, $fpif, $fpmf);
- $content .= $this->getAdminPagesNew($this->table_name, $language);
- $content .= $this->getAdminPagesSave($module_name, $this->table_name, $language, $fpif, $fpmf);
- $content .= $this->getAdminPagesEdit($this->table_name, $language, $fpif);
- $content .= $this->getAdminPagesDelete($this->table_name, $language, $fpif, $fpmf);
+ $content .= $this->getAdminPagesHeader($module_name, $table_name);
+ $content .= $this->getAdminPagesList($table_name, $language, $fields_all, $fpif, $fpmf);
+ $content .= $this->getAdminPagesNew($table_name, $language);
+ $content .= $this->getAdminPagesSave($module_name, $table_name, $language, $fields_all, $fpif, $fpmf);
+ $content .= $this->getAdminPagesEdit($table_name, $language, $fpif);
+ $content .= $this->getAdminPagesDelete($table_name, $language, $fpif, $fpmf);
$content .= $this->getAdminPagesFooter();
//
$this->tdmcfile->create($module_name, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/architecture.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/architecture.php 2014-06-05 08:27:03 UTC (rev 12564)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/architecture.php 2014-06-05 15:12:37 UTC (rev 12565)
@@ -205,19 +205,14 @@
$table_comments = $tables[$t]->getVar('table_comments');
$table_notifications = $tables[$t]->getVar('table_notifications');
$table_permissions = $tables[$t]->getVar('table_permissions');
- $criteria_fields = new CriteriaCompo();
- $criteria_fields->add(new Criteria('field_mid', $table_mid));
- $criteria_fields->add(new Criteria('field_tid', $table_id));
- $fields = $this->tdmcreate->getHandler('fields')->getAll($criteria_fields);
- unset($criteria_fields);
-
+
$table = $this->tdmcreate->getHandler('tables')->get($table_id);
// Creation of admin files
if ( $table_admin == 1) {
// Admin Pages File
$adminPages = AdminPages::getInstance();
- $adminPages->write($module, $table_name, $fields);
+ $adminPages->write($module, $table);
$ret[] = $adminPages->renderFile($table_name.'.php');
// Admin Templates File
$adminTemplates = AdminTemplates::getInstance();
@@ -228,29 +223,29 @@
if ( $table_blocks == 1) {
// Blocks Files
$blocksFiles = BlocksFiles::getInstance();
- $blocksFiles->write($module, $table, $fields);
+ $blocksFiles->write($module, $table);
$ret[] = $blocksFiles->renderFile($table_name.'.php');
}
// Blocks Templates File
$blocksTemplates = BlocksTemplates::getInstance();
- $blocksTemplates->write($module, $table, $fields);
+ $blocksTemplates->write($module, $table);
$ret[] = $blocksTemplates->renderFile($table_name.'.tpl');
// Creation of classes
if ( $table_admin == 1 || $table_user == 1) {
// Class Files
$classFiles = ClassFiles::getInstance();
- $classFiles->write($module, $table, $tables, $fields);
+ $classFiles->write($module, $table, $tables);
$ret[] = $classFiles->renderFile($table_name.'.php');
}
// Creation of user files
if ( $table_user == 1) {
// User Pages File
$userPages = UserPages::getInstance();
- $userPages->write($module, $table, $fields);
+ $userPages->write($module, $table);
$ret[] = $userPages->renderFile($table_name.'.php');
// User Templates File
$userTemplates = UserTemplates::getInstance();
- $userTemplates->write($module, $tables, $fields);
+ $userTemplates->write($module, $table, $tables);
$ret[] = $userTemplates->renderFile($table_name.'.tpl');
}
var_dump($table_name);
@@ -266,19 +261,19 @@
if ( $table_blocks == 1) {
// Language Blocks File
$languageBlocks = LanguageBlocks::getInstance();
- $languageBlocks->write($module, $table, $tables, $fields, 'blocks.php');
+ $languageBlocks->write($module, $table, $tables, 'blocks.php');
$ret[] = $languageBlocks->render();
}
// Creation of user language file
if ( $table_user == 1) {
// Language Main File
$languageMain = LanguageMain::getInstance();
- $languageMain->write($module, $table, $tables, $fields, 'main.php');
+ $languageMain->write($module, $table, $tables, 'main.php');
$ret[] = $languageMain->render();
}
// Language Modinfo File
$languageModinfo = LanguageModinfo::getInstance();
- $languageModinfo->write($module, $table, $tables, $fields, 'modinfo.php');
+ $languageModinfo->write($module, $table, $tables, 'modinfo.php');
$ret[] = $languageModinfo->render();
// Creation of user files
if ( $table_user == 1) {
@@ -314,55 +309,55 @@
if (( $table_permissions == 1) && ( $table_admin == 1 )) {
// Admin Permissions File
$adminPermissions = AdminPermissions::getInstance();
- $adminPermissions->write($module, $tables, $fields, 'permissions.php');
+ $adminPermissions->write($module, $tables, 'permissions.php');
$ret[] = $adminPermissions->render();
}
// Creation of notifications files
if ( $table_notifications == 1 ) {
// Include Notifications File
$includeNotifications = IncludeNotifications::getInstance();
- $includeNotifications->write($module, $table, $fields, 'notifications.php');
+ $includeNotifications->write($module, $table, 'notifications.php');
$ret[] = $includeNotifications->render();
}
// Include Install File
$includeInstall = IncludeInstall::getInstance();
- $includeInstall->write($module, $tables, $fields, 'install.php');
+ $includeInstall->write($module, $tables, 'install.php');
$ret[] = $includeInstall->render();
// Creation of sql file
if ( $table_name != null) {
// Sql File
$sqlFile = SqlFile::getInstance();
- $sqlFile->write($module, $tables, $fields, 'mysql.sql');
+ $sqlFile->write($module, $table, $tables, 'mysql.sql');
$ret[] = $sqlFile->render();
}
// Creation of search file
if ( $table_search == 1) {
// Include Search File
$includeSearch = IncludeSearch::getInstance();
- $includeSearch->write($module, $table, $fields, 'search.php');
+ $includeSearch->write($module, $table, 'search.php');
$ret[] = $includeSearch->render();
}
// Creation of comments files
if ( $table->getVar('table_comments') == 1) {
// Include Comments File
$includeComments = IncludeComments::getInstance();
- $includeComments->write($module, $table, $fields);
+ $includeComments->write($module, $table);
$ret[] = $includeComments->getCommentsIncludes($module, 'comment_edit');
// Include Comments File
$includeComments = IncludeComments::getInstance();
- $includeComments->write($module, $table, $fields);
+ $includeComments->write($module, $table);
$ret[] = $includeComments->getCommentsIncludes($module, 'comment_delete');
// Include Comments File
$includeComments = IncludeComments::getInstance();
- $includeComments->write($module, $table, $fields);
+ $includeComments->write($module, $table);
$ret[] = $includeComments->getCommentsIncludes($module, 'comment_post');
// Include Comments File
$includeComments = IncludeComments::getInstance();
- $includeComments->write($module, $table, $fields);
+ $includeComments->write($module, $table);
$ret[] = $includeComments->getCommentsIncludes($module, 'comment_reply');
// Include Comments File
$includeComments = IncludeComments::getInstance();
- $includeComments->write($module, $table, $fields);
+ $includeComments->write($module, $table);
$ret[] = $includeComments->getCommentsNew($module, 'comment_new');
}
if ( ($table_user == 1) && ($table_notifications == 1)){
@@ -423,7 +418,7 @@
$ret[] = $includeJquery->render();
// User Xoops Version File
$userXoopsVersion = UserXoopsVersion::getInstance();
- $userXoopsVersion->write($module, $table, $tables, $fields, 'xoops_version.php');
+ $userXoopsVersion->write($module, $table, $tables, 'xoops_version.php');
$ret[] = $userXoopsVersion->render();
// Return Array
return $ret;
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/blocks_files.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/blocks_files.php 2014-06-05 08:27:03 UTC (rev 12564)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/blocks_files.php 2014-06-05 15:12:37 UTC (rev 12565)
@@ -29,17 +29,14 @@
/*
* @var string
*/
- private $table = null;
+ private $table = null;
/*
- * @var string
- */
- private $fields = null;
- /*
* @public function constructor
* @param null
*/
public function __construct() {
$this->tdmcfile = TDMCreateFile::getInstance();
+ $this->tdmcreate = TDMCreate::getInstance();
}
/*
* @static function &getInstance
@@ -57,18 +54,16 @@
* @public function write
* @param string $module
* @param mixed $table
- * @param mixed $fields
*/
- public function write($module, $table, $fields) {
+ public function write($module, $table) {
$this->setModule($module);
$this->table = $table;
- $this->fields = $fields;
}
/*
* @public function getBlocksShow
* @param null
*/
- public function getBlocksShow($module, $fpif, $fpmf) {
+ public function getBlocksShow($module, $fields_all, $fpif, $fpmf) {
$mod_name = $module->getVar('mod_name');
$mod_name_lowercase = strtolower($mod_name);
$table_name = $this->table->getVar('table_name');
@@ -112,9 +107,9 @@
foreach (array_keys(\${$table_name}_arr) as \$i)
{
EOT;
- foreach(array_keys($this->fields) as $f)
+ foreach(array_keys($fields_all) as $f)
{
- if( $this->fields[$f]->getVar('field_block') == 1 ) {
+ if( $fields_all[$f]->getVar('field_block') == 1 ) {
$ret .= <<<EOT
\n\t\t\${$table_fieldname}['{$fpmf}'] = \${$table_name}_arr[\$i]->getVar('{$fpmf}');\n
EOT;
@@ -186,13 +181,18 @@
public function renderFile($filename)
{
$fpif = ''; $fpmf = '';
- foreach(array_keys($this->fields) as $f)
+ $table_id = $this->table->getVar('table_id');
+ $criteria_fields = new CriteriaCompo();
+ $criteria_fields->add(new Criteria('field_tid', $table_id));
+ $fields_all = $this->tdmcreate->getHandler('fields')->getObjects($criteria_fields);
+ unset($criteria_fields);
+ foreach(array_keys($fields_all) as $f)
{
if($f == 1) {
- $fpif = $this->fields[$f]->getVar('field_name');
+ $fpif = $fields_all[$f]->getVar('field_name');
}
- if($this->fields[$f]->getVar('field_main') == 1) {
- $fpmf = $this->fields[$f]->getVar('field_name');
+ if($fields_all[$f]->getVar('field_main') == 1) {
+ $fpmf = $fields_all[$f]->getVar('field_name');
}
}
$module = $this->getModule();
@@ -201,7 +201,7 @@
//$filename = $this->getFileName();
$language = $this->getLanguage($module_name, 'MB');
$content = $this->getHeaderFilesComments($module, $filename);
- $content .= $this->getBlocksShow($module, $fpif, $fpmf);
+ $content .= $this->getBlocksShow($module, $fields_all, $fpif, $fpmf);
$content .= $this->getBlocksEdit($module, $fpif, $fpmf, $language);
//
$this->tdmcfile->create($module_name, 'blocks', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/blocks_templates.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/blocks_templates.php 2014-06-05 08:27:03 UTC (rev 12564)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/blocks_templates.php 2014-06-05 15:12:37 UTC (rev 12565)
@@ -29,17 +29,14 @@
/*
* @var string
*/
- private $table = null;
+ private $table = null;
/*
- * @var string
- */
- private $fields = null;
- /*
* @public function constructor
* @param null
*/
public function __construct() {
- $this->tdmcfile = TDMCreateFile::getInstance();
+ $this->tdmcfile = TDMCreateFile::getInstance();
+ $this->tdmcreate = TDMCreate::getInstance();
}
/*
* @static function &getInstance
@@ -57,12 +54,10 @@
* @public function write
* @param string $module
* @param mixed $table
- * @param mixed $fields
*/
- public function write($module, $table, $fields) {
+ public function write($module, $table) {
$this->setModule($module);
$this->table = $table;
- $this->fields = $fields;
}
/*
* @public function render
@@ -78,31 +73,35 @@
$content = $this->getHeaderFilesComments($module, $filename);
$content .= <<<EOT
<table class="outer">
- <tr class="head">
+ <tr class="head">\n
EOT;
- foreach(array_keys($this->fields) as $f)
+ $table_id = $this->table->getVar('table_id');
+ $criteria_fields = new CriteriaCompo();
+ $criteria_fields->add(new Criteria('field_tid', $table_id));
+ $fields_all = $this->tdmcreate->getHandler('fields')->getObjects($criteria_fields);
+ unset($criteria_fields);
+ foreach(array_keys($fields_all) as $f)
{
- $lng_field_name = $language.strtoupper($this->fields[$f]->getVar('field_name'));
+ $lng_field_name = $language.strtoupper($fields_all[$f]->getVar('field_name'));
$content .= <<<EOT
-\n\t\t<th><{\$smarty.const.{$lng_field_name}}></th>
+ <th><{\$smarty.const.{$lng_field_name}}></th>\n
EOT;
}
$content .= <<<EOT
-\n\t</tr>
+ </tr>
<{foreachq item={$table_fieldname} from=\${$table_fieldname}}>
- <tr class = "<{cycle values = 'even,odd'}>">
- <td>
+ <tr class = "<{cycle values = 'even,odd'}>">\n
+
EOT;
- foreach(array_keys($this->fields) as $f)
+ foreach(array_keys($fields_all) as $f)
{
- $table_field_name = $table_fieldname.'.'.strip_tags($this->fields[$f]->getVar('field_name'));
+ $table_field_name = $table_fieldname.'.'.strip_tags($fields_all[$f]->getVar('field_name'));
$content .= <<<EOT
-\n\t\t\t<{\${$table_field_name}}>
+ <td><{\${$table_field_name}}></td>\n
EOT;
}
$content .= <<<EOT
-\n\t\t\t</td>
- </tr>
+ </tr>
<{/foreach}>
</table>
EOT;
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/class_files.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/class_files.php 2014-06-05 08:27:03 UTC (rev 12564)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/class_files.php 2014-06-05 15:12:37 UTC (rev 12565)
@@ -37,18 +37,15 @@
/*
* @var string
*/
- private $tables = null;
+ private $tables = null;
/*
- * @var string
- */
- private $fields = null;
- /*
* @public function constructor
* @param null
*/
public function __construct() {
$this->tdmcfile = TDMCreateFile::getInstance();
- $this->formelements = TDMCreateFormElements::getInstance();
+ $this->formelements = TDMCreateFormElements::getInstance();
+ $this->tdmcreate = TDMCreate::getInstance();
}
/*
* @static function &getInstance
@@ -65,15 +62,13 @@
/*
* @public function write
* @param string $module
- * @param mixed $table
+ * @param string $table
* @param mixed $tables
- * @param mixed $fields
*/
- public function write($module, $table, $tables, $fields) {
+ public function write($module, $table, $tables) {
$this->setModule($module);
$this->table = $table;
$this->tables = $tables;
- $this->fields = $fields;
}
/*
* @public function getInitVar
@@ -82,59 +77,59 @@
*/
public function getInitVar($field_name, $type = 'INT') {
$ret = <<<EOT
- \$this->initVar('{$field_name}', XOBJ_DTYPE_{$type});
+ \$this->initVar('{$field_name}', XOBJ_DTYPE_{$type});\n
EOT;
return $ret;
}
/*
* @public function getInitVars
- * @param array $table_nbfields
- * @param array $fields
+ * @param array $fields_all
*/
- public function getInitVars($table_nbfields) {
+ public function getInitVars($fields_all) {
$ret = '';
// Creation of the initVar functions list
- foreach (array_keys($this->fields) as $f)
+ foreach (array_keys($fields_all) as $f)
{
- $field_name = $this->fields[$f]->getVar('field_name');
- switch($this->fields[$f]->getVar('field_type')) {
- case 'int':
- case 'tinyint':
- case 'mediumint':
- case 'smallint':
+ $field_name = $fields_all[$f]->getVar('field_name');
+ $field_type = $fields_all[$f]->getVar('field_type');
+ switch($field_type) {
+ case 'INT':
+ case 'TINYINT':
+ case 'MEDIUMINT':
+ case 'SMALLINT':
$ret .= $this->getInitVar($field_name, 'INT');
break;
- case 'char':
- case 'varchar':
+ case 'CHAR':
+ case 'VARCHAR':
$ret .= $this->getInitVar($field_name, 'TXTBOX');
break;
- case 'text':
- case 'tinytext':
- case 'mediumtext':
- case 'longtext':
+ case 'TEXT':
+ case 'TINYTEXT':
+ case 'MEDIUMTEXT':
+ case 'LONGTEXT':
$ret .= $this->getInitVar($field_name, 'TXTAREA');
break;
- case 'float':
+ case 'FLOAT':
$ret .= $this->getInitVar($field_name, 'FLOAT');
break;
- case 'decimal':
- case 'double':
+ case 'DECIMAL':
+ case 'DOUBLE':
$ret .= $this->getInitVar($field_name, 'DECIMAL');
break;
- case 'enum':
+ case 'ENUM':
$ret .= $this->getInitVar($field_name, 'ENUM');
break;
- case 'email':
+ case 'EMAIL':
$ret .= $this->getInitVar($field_name, 'EMAIL');
break;
- case 'url':
+ case 'URL':
$ret .= $this->getInitVar($field_name, 'URL');
break;
- case 'date':
- case 'datetime':
- case 'timestamp':
- case 'time':
- case 'year':
+ case 'DATE':
+ case 'DATETIME':
+ case 'TIMESTAMP':
+ case 'TIME':
+ case 'YEAR':
$ret .= $this->getInitVar($field_name, 'LTIME');
break;
}
@@ -145,7 +140,7 @@
* @public function getHeadClass
* @param mixed $constructor
*/
- public function getHeadClass($module_name, $table_name, $initvar_functions) {
+ public function getHeadClass($module_name, $table_name, $fields_all) {
$ucf_module_name = ucfirst($module_name);
$ucf_table_name = ucfirst($table_name);
$ret = <<<EOT
@@ -163,7 +158,7 @@
public function __construct()
{
\$this->XoopsObject();
-{$initvar_functions}
+ {$this->getInitVars($fields_all)}
}\n
EOT;
return $ret;
@@ -293,25 +288,30 @@
$table_name = $this->table->getVar('table_name');
//$fields = $this->getFields();
//$filename = $this->getFileName();
- $module_name = strtolower($module->getVar('mod_name'));
- $initvar = $this->getInitVars($table_nbfields);
+ $module_name = strtolower($module->getVar('mod_name'));
$fpif = ''; $fpmf = '';
$initvar_functions = array();
- foreach(array_keys($this->fields) as $f)
+ $table_id = $this->table->getVar('table_id');
+ $criteria_fields = new CriteriaCompo();
+ $criteria_fields->add(new Criteria('field_tid', $table_id));
+ $fields_all = $this->tdmcreate->getHandler('fields')->getObjects($criteria_fields);
+ unset($criteria_fields);
+ foreach(array_keys($fields_all) as $f)
{
- $field_name = $this->fields[$f]->getVar('field_name');
- if($f == 1) {
+ $field_name = $fields_all[$f]->getVar('field_name');
+ if(($f == 1) && ($this->table->getVar('table_autoincrement') == 1)) {
$fpif = $field_name;
}
- if($this->fields[$f]->getVar('field_main') == 1) {
+ if($fields_all[$f]->getVar('field_main') == 1) {
$fpmf = $field_name;
}
}
- $this->formelements->initForm($module, $this->table, $this->fields);
+ //$initvar = $this->getInitVars($fields_all);
+ $this->formelements->initForm($module, $this->table);
$elements_form = $this->formelements->renderElement();
$content = $this->getHeaderFilesComments($module, $filename);
- $content .= $this->getHeadClass($module_name, $table_name, $initvar);
+ $content .= $this->getHeadClass($module_name, $table_name, $fields_all);
$content .= $this->getHeadFunctionForm($module_name, $elements_form);
if ($this->table->getVar('table_permissions') == 1) {
$content .= $this->getPermissionsInFunctionForm($module_name, $fpif);
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/formelements.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/formelements.php 2014-06-05 08:27:03 UTC (rev 12564)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/formelements.php 2014-06-05 15:12:37 UTC (rev 12565)
@@ -29,17 +29,14 @@
/*
* @var string
*/
- private $table = null;
+ private $table = null;
/*
- * @var string
- */
- private $fields = null;
- /*
* @public function constructor
* @param null
*/
public function __construct() {
parent::__construct();
+ $this->tdmcreate = TDMCreate::getInstance();
}
/**
* @param string $method
@@ -66,12 +63,10 @@
* @public function initForm
* @param string $module
* @param array $table
- * @param string $fields
*/
- public function initForm($module, $table, $fields) {
+ public function initForm($module, $table) {
$this->module = $module;
$this->table = $table;
- $this->fields = $fields;
}
/*
* @public function getXoopsFormText
@@ -223,13 +218,13 @@
* @param string $table_name
* @param string $required
*/
- public function getXoopsFormTable($language, $module_name, $table_name, $required = 'false')
+ public function getXoopsFormTable($language, $module_name, $table_name, $fields, $required = 'false')
{
$field_name = '';
- foreach(array_keys($this->fields) as $f)
+ foreach(array_keys($fields) as $f)
{
- if(($this->fields[$f]->getVar('field_parent') == 1)) {
- $field_name = $this->fields[$f]->getVar('field_name');
+ if(($fields[$f]->getVar('field_parent') == 1)) {
+ $field_name = $fields[$f]->getVar('field_name');
}
}
$ret = <<<XFT
@@ -247,18 +242,18 @@
* @param string $table_name
* @param string $required
*/
- public function getXoopsFormTopic($language, $module_name, $table_name, $required = 'false')
+ public function getXoopsFormTopic($language, $module_name, $table_name, $fields, $required = 'false')
{
- foreach(array_keys($this->fields) as $f)
+ foreach(array_keys($fields) as $f)
{
- $field_name = $this->fields[$f]->getVar('field_name');
- if($this->fields[$f]->getVar('field_id') == 1) {
+ $field_name = $fields[$f]->getVar('field_name');
+ if($fields[$f]->getVar('field_id') == 1) {
$field_id = $field_name;
}
- if($this->fields[$f]->getVar('field_parent') == 1) {
+ if($fields[$f]->getVar('field_parent') == 1) {
$field_pid = $field_name;
}
- if($this->fields[$f]->getVar('field_main') == 1) {
+ if($fields[$f]->getVar('field_main') == 1) {
$field_main = $field_name;
}
}
@@ -284,13 +279,19 @@
$table_name = $this->table->getVar('table_name');
$language = $this->getLanguage($module_name, 'AM');
$ret = '';
- foreach(array_keys($this->fields) as $f)
+ $table_id = $this->table->getVar('table_id');
+ $criteria_fields = new CriteriaCompo();
+ $criteria_fields->add(new Criteria('field_tid', $table_id));
+ $fields_all = $this->tdmcreate->getHandler('fields')->getObjects($criteria_fields);
+ unset($criteria_fields);
+ foreach(array_keys($fields_all) as $f)
{
- $field_name = $this->fields[$f]->getVar('field_name');
+ $field_name = $fields_all[$f]->getVar('field_name');
+ $field_element = $fields_all[$f]->getVar('field_element');
$language = $language . strtoupper($table_name) . '_' . strtoupper($field_name);
- $required = ( $this->fields[$f]->getVar('field_required') == 1 ) ? 'true' : 'false';
+ $required = ( $fields_all[$f]->getVar('field_required') == 1 ) ? 'true' : 'false';
//
- switch($this->fields[$f]->getVar('field_element'))
+ switch($field_element)
{
case 1:
$ret .= $this->getXoopsFormText($language, $field_name, $required);
@@ -325,14 +326,16 @@
case 11:
$ret .= $this->getXoopsFormTextDateSelect($language, $field_name, $required);
break;
- default:
- if($this->table->getVar('table_category') == 0) {
- $ret .= $this->getXoopsFormTable($language, $module_name, $table_name, $required);
- } else {
- $ret .= $this->getXoopsFormTopic($language, $module_name, $table_name, $required);
- }
+ default:
break;
}
+ if ($field_element > 11) {
+ if($this->table->getVar('table_category') == 1) {
+ $ret .= $this->getXoopsFormTopic($language, $module_name, $table_name, $fields_all, $required);
+ } else {
+ $ret .= $this->getXoopsFormTable($language, $module_name, $table_name, $fields_all, $required);
+ }
+ }
}
return $ret;
}
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include_comments.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include_comments.php 2014-06-05 08:27:03 UTC (rev 12564)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include_comments.php 2014-06-05 15:12:37 UTC (rev 12565)
@@ -31,15 +31,12 @@
*/
private $table = null;
/*
- * @var string
- */
- private $fields = null;
- /*
* @public function constructor
* @param null
*/
public function __construct() {
- $this->tdmcfile = TDMCreateFile::getInstance();
+ $this->tdmcfile = TDMCreateFile::getInstance();
+ $this->tdmcreate = TDMCreate::getInstance();
}
/*
* @static function &getInstance
@@ -57,12 +54,10 @@
* @public function write
* @param string $module
* @param mixed $table
- * @param string $fields
*/
- public function write($module, $table, $fields) {
+ public function write($module, $table) {
$this->setModule($module);
$this->table = $table;
- $this->fields = $fields;
}
/*
* @public function getCommentsIncludes
@@ -90,9 +85,15 @@
$table_name = $this->table->getVar('table_name');
$table_fieldname = $this->table->getVar('table_fieldname');
$fpmf = null;
- foreach(array_keys($this->fields) as $i) {
- $field_name = $this->fields[$i]->getVar('field_name');
- if($this->fields[$i]->getVar('field_main') == 1) {
+ $table_id = $this->table->getVar('table_id');
+ $criteria_fields = new CriteriaCompo();
+ $criteria_fields->add(new Criteria('field_tid', $table_id));
+ $fields_all = $this->tdmcreate->getHandler('fields')->getObjects($criteria_fields);
+ unset($criteria_fields);
+ foreach(array_keys($fields_all) as $f)
+ {
+ $field_name = $fields_all[$f]->getVar('field_name');
+ if($fields_all[$f]->getVar('field_main') == 1) {
$fpmf = $field_name;
}
}
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include_install.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include_install.php 2014-06-05 08:27:03 UTC (rev 12564)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include_install.php 2014-06-05 15:12:37 UTC (rev 12565)
@@ -29,17 +29,14 @@
/*
* @var string
*/
- private $tables = null;
+ private $tables = null;
/*
- * @var string
- */
- private $fields = null;
- /*
* @public function constructor
* @param null
*/
public function __construct() {
$this->tdmcfile = TDMCreateFile::getInstance();
+ $this->tdmcreate = TDMCreate::getInstance();
}
/*
* @static function &getInstance
@@ -57,20 +54,19 @@
* @public function write
* @param string $module
* @param mixed $tables
- * @param string $fields
* @param string $filename
*/
- public function write($module, $tables, $fields, $filename) {
+ public function write($module, $tables, $filename) {
$this->setModule($module);
$this->setFileName($filename);
$this->tables = $tables;
- $this->fields = $fields;
}
/*
* @public function render
* @param null
*/
- public function render() {
+ public function render()
+ {
$module = $this->getModule();
$module_name = strtolower($module->getVar('mod_name'));
//$table = $this->getTable();
@@ -88,14 +84,20 @@
chmod(\${$module_name}, 0777);
copy(\$indexFile, \${$module_name}.'/index.html');
EOT;
+ $field_element = '';
foreach (array_keys($this->tables) as $t)
{
$table_name = $this->tables[$t]->getVar('table_name');
- foreach (array_keys($this->fields) as $f)
+ $table_id = $this->tables[$t]->getVar('table_id');
+ $criteria_fields = new CriteriaCompo();
+ $criteria_fields->add(new Criteria('field_tid', $table_id));
+ $fields_all = $this->tdmcreate->getHandler('fields')->getObjects($criteria_fields);
+ unset($criteria_fields);
+ foreach(array_keys($fields_all) as $f) {
{
- $field_name = $this->fields[$f]->getVar('field_name');
+ $field_name = $fields_all[$f]->getVar('field_name');
if ( ($f > 1) && ($this->tables[$t]->getVar('table_autoincrement') == 1) ) {
- $field_element = $this->fields[$f]->getVar('field_element');
+ $field_element = $fields_all[$f]->getVar('field_element');
}
if ( $f == 1 ) {
$content .= <<<EOT
@@ -107,9 +109,8 @@
copy(\$indexFile, \${$table_name}.'/index.html');
EOT;
} else {
- if ( $field_element == 9 )
- {
-$content .= <<<EOT
+ if ( $field_element == 9 ) {
+ $content .= <<<EOT
\n// Making of "{$field_name}" images folder
\${$table_name} = \${$module_name}.'/images';
if(!is_dir(\${$table_name}))
@@ -127,7 +128,7 @@
copy(\$blankFile, \${$table_name}.'/blank.gif');
EOT;
} elseif ( $field_element == 10 ) {
-$content .= <<<EOT
+ $content .= <<<EOT
// Making of "{$field_name}" files folder
\${$table_name} = \${$module_name}.'/files';
if(!is_dir(\${$table_name}))
@@ -142,10 +143,11 @@
chmod(\${$table_name}, 0777);
copy(\$indexFile, \${$table_name}.'/index.html');
EOT;
- }
+ }
}
}
- }
+ }
+ }
$this->tdmcfile->create($module_name, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
return $this->tdmcfile->renderFile();
}
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include_notifications.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include_notifications.php 2014-06-05 08:27:03 UTC (rev 12564)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include_notifications.php 2014-06-05 15:12:37 UTC (rev 12565)
@@ -29,17 +29,14 @@
/*
* @var string
*/
- private $table = null;
+ private $table = null;
/*
- * @var string
- */
- private $fields = null;
- /*
* @public function constructor
* @param null
*/
public function __construct() {
$this->tdmcfile = TDMCreateFile::getInstance();
+ $this->tdmcreate = TDMCreate::getInstance();
}
/*
@@ -61,11 +58,10 @@
* @param string $fields
* @param string $filename
*/
- public function write($module, $table, $fields, $filename) {
+ public function write($module, $table, $filename) {
$this->setModule($module);
$this->setFileName($filename);
$this->table = $table;
- $this->fields = $fields;
}
/*
* @static function getNotificationsFunction
@@ -76,12 +72,17 @@
$table_name = $this->table->getVar('table_name');
$table_fieldname = $this->table->getVar('table_fieldname');
$fpif = null; $fpmf = null;
- foreach(array_keys($this->fields) as $i) {
- $field_name = $this->fields[$i]->getVar('field_name');
+ $table_id = $this->table->getVar('table_id');
+ $criteria_fields = new CriteriaCompo();
+ $criteria_fields->add(new Criteria('field_tid', $table_id));
+ $fields_all = $this->tdmcreate->getHandler('fields')->getObjects($criteria_fields);
+ unset($criteria_fields);
+ foreach(array_keys($fields_all) as $i) {
+ $field_name = $fields_all[$i]->getVar('field_name');
if(($i == 1) && ($this->table->getVar('table_autoincrement') == 1)) {
$fpif = $field_name;
}
- if($this->fields[$i]->getVar('field_main') == 1) {
+ if($fields_all[$i]->getVar('field_main') == 1) {
$fpmf = $field_name;
}
}
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include_search.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include_search.php 2014-06-05 08:27:03 UTC (rev 12564)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include_search.php 2014-06-05 15:12:37 UTC (rev 12565)
@@ -29,17 +29,14 @@
/*
* @var string
*/
- private $table = null;
+ private $table = null;
/*
- * @var string
- */
- private $fields = null;
- /*
* @public function constructor
* @param null
*/
public function __construct() {
- $this->tdmcfile = TDMCreateFile::getInstance();
+ $this->tdmcfile = TDMCreateFile::getInstance();
+ $this->tdmcreate = TDMCreate::getInstance();
}
/*
@@ -61,11 +58,10 @@
* @param string $fields
* @param string $filename
*/
- public function write($module, $table, $fields, $filename) {
+ public function write($module, $table, $filename) {
$this->setModule($module);
$this->setFileName($filename);
$this->table = $table;
- $this->fields = $fields;
}
/*
* @static function getSearchField
@@ -100,15 +96,21 @@
$table_name = $this->table->getVar('table_name');
$table_fieldname = $this->table->getVar('table_fieldname');
$fpif = ''; $fpsf = null;
- foreach(array_keys($this->fields) as $i) {
- $field_name = $this->fields[$i]->getVar('field_name');
- if(($i > 1) && ($this->table->getVar('table_autoincrement') == 1)) {
+ $table_id = $this->table->getVar('table_id');
+ $criteria_fields = new CriteriaCompo();
+ $criteria_fields->add(new Criteria('field_tid', $table_id));
+ $fields_all = $this->tdmcreate->getHandler('fields')->getObjects($criteria_fields);
+ unset($criteria_fields);
+ foreach(array_keys($fields_all) as $f)
+ {
+ $field_name = $fields_all[$f]->getVar('field_name');
+ if(($f > 1) && ($this->table->getVar('table_autoincrement') == 1)) {
$fpif = $field_name;
}
- if($this->fields[$i]->getVar('field_main') == 1) {
+ if($fields_all[$f]->getVar('field_main') == 1) {
$fpmf = $field_name;
}
- if($this->fields[$i]->getVar('field_search') == 1) {
+ if($fields_all[$f]->getVar('field_search') == 1) {
$fpsf = $field_name;
}
}
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language_help.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language_help.php 2014-06-05 08:27:03 UTC (rev 12564)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language_help.php 2014-06-05 15:12:37 UTC (rev 12565)
@@ -69,7 +69,7 @@
$content = <<<EOT
<div id="help-template" class="outer">
<h1 class="head">Help:
- <a class="ui-corner-all tooltip" href="<\{\$xoops_url\}>/modules/$stl_module_name/admin/index.php"
+ <a class="ui-corner-all tooltip" href="<{\$xoops_url}>/modules/$stl_module_name/admin/index.php"
title="Back to the administration of $module_name"> $module_name <img src="<{xoAdminIcons home.png}>"
alt="Back to the Administration of $module_name"/>
</a></h1>
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language_main.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language_main.php 2014-06-05 08:27:03 UTC (rev 12564)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language_main.php 2014-06-05 15:12:37 UTC (rev 12565)
@@ -33,17 +33,14 @@
/*
* @var string
*/
- private $tables = null;
+ private $tables = null;
/*
- * @var string
- */
- private $fields = null;
- /*
* @public function constructor
* @param null
*/
public function __construct() {
- $this->tdmcfile = TDMCreateFile::getInstance();
+ $this->tdmcfile = TDMCreateFile::getInstance();
+ $this->tdmcreate = TDMCreate::getInstance();
}
/*
* @static function &getInstance
@@ -62,15 +59,13 @@
* @param string $module
* @param mixed $table
* @param mixed $tables
- * @param string $fields
* @param string $filename
*/
- public function write($module, $table, $tables, $fields, $filename) {
+ public function write($module, $table, $tables, $filename) {
$this->setModule($module);
$this->setFileName($filename);
$this->table = $table;
$this->tables = $tables;
- $this->fields = $fields;
}
/*
* @public function render
@@ -79,7 +74,7 @@
public function render() {
$module = $this->getModule();
//$table = $this->getTable();
- $fields = $this->getFields();
+ //$fields = $this->getFields();
$filename = $this->getFileName();
$module_name = $module->getVar('mod_name');
$module_description = $module->getVar('mod_description');
@@ -109,9 +104,14 @@
define('{$lng_stu_table_name}_DESC', "{$ucf_table_name} description");
EOT;
$fpif = '';
- foreach (array_keys($this->fields) as $f)
+ $table_id = $this->tables[$i]->getVar('table_id');
+ $criteria_fields = new CriteriaCompo();
+ $criteria_fields->add(new Criteria('field_tid', $table_id));
+ $fields_all = $this->tdmcreate->getHandler('fields')->getObjects($criteria_fields);
+ unset($criteria_fields);
+ foreach (array_keys($fields_all) as $f)
{
- $field_name = $this->fields[$f]->getVar('field_name');
+ $field_name = $fields_all[$f]->getVar('field_name');
if($f == 1) {
$fpif = $field_name;
}
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language_modinfo.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language_modinfo.php 2014-06-05 08:27:03 UTC (rev 12564)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language_modinfo.php 2014-06-05 15:12:37 UTC (rev 12565)
@@ -33,17 +33,14 @@
/*
* @var string
*/
- private $tables = null;
+ private $tables = null;
/*
- * @var string
- */
- private $fields = null;
- /*
* @public function constructor
* @param null
*/
public function __construct() {
- $this->tdmcfile = TDMCreateFile::getInstance();
+ $this->tdmcfile = TDMCreateFile::getInstance();
+ $this->tdmcreate = TDMCreate::getInstance();
}
/*
* @static function &getInstance
@@ -62,15 +59,13 @@
* @param string $module
* @param mixed $table
* @param mixed $tables
- * @param string $fields
* @param string $filename
*/
- public function write($module, $table, $tables, $fields, $filename) {
+ public function write($module, $table, $tables, $filename) {
$this->setModule($module);
$this->setFileName($filename);
$this->table = $table;
$this->tables = $tables;
- $this->fields = $fields;
}
/*
* @public function render
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/sql_files.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/sql_files.php 2014-06-05 08:27:03 UTC (rev 12564)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/sql_files.php 2014-06-05 15:12:37 UTC (rev 12565)
@@ -33,11 +33,11 @@
/*
* @var string
*/
- private $tables = null;
+ private $table = null;
/*
* @var string
*/
- private $fields = null;
+ private $tables = null;
/*
* @public function constructor
* @param null
@@ -63,15 +63,16 @@
/*
* @public function write
* @param string $module
+ * @param string $table
* @param string $tables
* @param array $fields
* @param string $filename
*/
- public function write($module, $tables, $fields, $filename) {
+ public function write($module, $table, $tables, $filename) {
$this->setModule($module);
$this->setFileName($filename);
+ $this->table = $table;
$this->tables = $tables;
- $this->fields = $fields;
}
/*
@@ -124,19 +125,14 @@
*/
public function getDatabaseTables($module_name)
{
- $ret = null;
+ $ret = null;
foreach(array_keys($this->tables) as $t)
{
- $table_mid = $this->tables[$t]->getVar('table_mid');
$table_id = $this->tables[$t]->getVar('table_id');
$table_name = $this->tables[$t]->getVar('table_name');
$table_autoincrement = $this->tables[$t]->getVar('table_autoincrement');
- $nb_fields = $this->tables[$t]->getVar('table_nbfields');
- $criteria_fields = new CriteriaCompo();
- $criteria_fields->add(new Criteria('field_tid', $table_id));
- $fields_all = $this->tdmcreate->getHandler('fields')->getObjects($criteria_fields);
- unset($criteria_fields);
- $ret .= $this->getDatabaseFields($module_name, $table_mid, $table_id, $table_name, $table_autoincrement, $fields_all, $nb_fields);
+ $nb_fields = $this->tables[$t]->getVar('table_nbfields');
+ $ret .= $this->getDatabaseFields($module_name, $table_id, $table_name, $table_autoincrement, $nb_fields);
}
return $ret;
}
@@ -148,9 +144,13 @@
* @param boolean $table_autoincrement
* @param integer $nb_fields
*/
- public function getDatabaseFields($module_name, $table_mid, $table_id, $table_name, $table_autoincrement, $fields_all, $nb_fields)
+ public function getDatabaseFields($module_name, $table_id, $table_name, $table_autoincrement, $nb_fields)
{
- $ret = null; $j = 1; $comma = array();
+ $ret = null; $j = 1; $comma = array();
+ $criteria_fields = new CriteriaCompo();
+ $criteria_fields->add(new Criteria('field_tid', $table_id));
+ $fields_all = $this->tdmcreate->getHandler('fields')->getObjects($criteria_fields);
+ unset($criteria_fields);
foreach(array_keys($fields_all) as $f)
{
// Creation of database table
@@ -169,40 +169,12 @@
case 'TINYTEXT':
case 'MEDIUMTEXT':
case 'LONGTEXT':
- $type = $field_type;
- $default = null;
- break;
- case 'INT':
- case 'TINYINT':
- case 'MEDIUMINT':
- case 'SMALLINT':
- $type = $field_type.'('.$field_value.')';
- $default = "DEFAULT '{$field_default}'";
- break;
- case 'DECIMAL':
- case 'DOUBLE':
- case 'FLOAT':
- $type = $field_type.'('.$field_value.')';
- $default = "DEFAULT '{$field_default}'";
- break;
case 'DATE':
case 'DATETIME':
- case 'TIMESTAMP':
+ case 'TIMESTAMP':
$type = $field_type;
- $default = "DEFAULT '{$field_default}'";
- break;
- case 'TIME':
- $type = $field_type.'('.$field_value.')';
- $default = "DEFAULT '{$field_default}'";
- break;
- case 'YEAR':
- $type = $field_type.'('.$field_value.')';
- $default = "DEFAULT '{$field_default}'";
- break;
- case 'OTHER':
- $type = $field_type.'('.$field_value.')';
- $default = "DEFAULT '{$field_default}'";
- break;
+ $default = null;
+ break;
default:
$type = $field_type.'('.$field_value.')';
$default = "DEFAULT '{$field_default}'";
@@ -263,16 +235,16 @@
*/
public function getFieldRow($field_name, $field_type_value, $field_attribute = null, $field_null = null, $field_default = null, $autoincrement = null) {
$ret_autoincrement = <<<SQL
- `{$field_name}` {$field_type_value} {$field_attribute} {$field_null} {$autoincrement},\n
+ `{$field_name}` {$field_type_value} {$field_attribute} {$field_null} {$autoincrement}
SQL;
$ret_field_attribute = <<<SQL
- `{$field_name}` {$field_type_value} {$field_attribute} {$field_null} {$field_default},\n
+ `{$field_name}` {$field_type_value} {$field_attribute} {$field_null} {$field_default}
SQL;
$ret_no_field_attribute = <<<SQL
- `{$field_name}` {$field_type_value} {$field_null} {$field_default},\n
+ `{$field_name}` {$field_type_value} {$field_null} {$field_default}
SQL;
$ret_short = <<<SQL
- `{$field_name}` {$field_type_value},\n
+ `{$field_name}` {$field_type_value}
SQL;
if(!empty($autoincrement)) {
$ret = $ret_autoincrement;
@@ -337,9 +309,9 @@
for ($i = 1; $i <= $index; $i++)
{
if ( $i != $index - 1 ) {
- $ret .= $this->getComma(isset($comma[$i]), ',');
+ $ret .= $this->getComma(isset($comma[$i]), ','). "\n";
} else {
- $ret .= $this->getComma(isset($comma[$i]));
+ $ret .= $this->getComma(isset($comma[$i])). "\n";
}
}
return $ret;
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_pages.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_pages.php 2014-06-05 08:27:03 UTC (rev 12564)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_pages.php 2014-06-05 15:12:37 UTC (rev 12565)
@@ -29,17 +29,14 @@
/*
* @var string
*/
- private $table = null;
+ private $table = null;
/*
- * @var string
- */
- private $fields = null;
- /*
* @public function constructor
* @param null
*/
public function __construct() {
$this->tdmcfile = TDMCreateFile::getInstance();
+ $this->tdmcreate = TDMCreate::getInstance();
}
/*
* @static function &getInstance
@@ -59,19 +56,16 @@
* @param string $table
* @param array $fields
*/
- public function write($module, $table, $fields) {
+ public function write($module, $table) {
$this->setModule($module);
- //$this->setTable($table);
- //$this->setFileName($filename);
$this->table = $table;
- $this->fields = $fields;
}
/*
* @public function getAdminPagesList
* @param string $table_name
* @param string $language
*/
- public function getUserPagesList($table_name, $language, $fpif, $fpmf) {
+ public function getUserPagesList($table_name, $language, $fields_all, $fpif, $fpmf) {
$stu_table_name = strtoupper($table_name);
$ret = <<<EOT
case 'list':
@@ -93,9 +87,10 @@
foreach (array_keys(\${$table_name}_arr) as \$i)
{\n
EOT;
- foreach(array_keys($this->fields) as $f)
+
+ foreach(array_keys($fields_all) as $f)
{
- $field_name = $this->fields[$f]->getVar('field_name');
+ $field_name = $fields_all[$f]->getVar('field_name');
$rp_field_name = $field_name;
if(strpos($field_name, '_')) {
$str = strpos($field_name, '_');
@@ -135,6 +130,7 @@
//$fields = $this->getFields();
//$filename = $this->getFileName();
$module_name = $module->getVar('mod_name');
+ $table_id = $this->table->getVar('table_id');
$table_name = $this->table->getVar('table_name');
$table_fieldname = $this->table->getVar('table_fieldname');
$stu_mod_name = strtoupper($module_name);
@@ -162,10 +158,14 @@
{\n
EOT;
// Fields
- $fpmf = ''; $fpe = '';
- foreach(array_keys($this->fields) as $f)
+ $fpmf = ''; $fpe = '';
+ $criteria_fields = new CriteriaCompo();
+ $criteria_fields->add(new Criteria('field_tid', $table_id));
+ $fields_all = $this->tdmcreate->getHandler('fields')->getObjects($criteria_fields);
+ unset($criteria_fields);
+ foreach(array_keys($fields_all) as $f)
{
- $field_name = $this->fields[$f]->getVar('field_name');
+ $field_name = $fields_all[$f]->getVar('field_name');
$rp_field_name = $field_name;
if(strpos($field_name, '_')) {
$str = strpos($field_name, '_');
@@ -175,9 +175,9 @@
}
$lp_field_name = substr($field_name, 0, strpos($field_name, '_'));
if(( $f > 1 ) && ($this->table->getVar('table_autoincrement') == 1)){
- $fpe = $this->fields[$f]->getVar('field_element');
+ $fpe = $fields_all[$f]->getVar('field_element');
} else {
- if ( $this->fields[$f]->getVar('field_main') == 1 ) {
+ if ( $fields_all[$f]->getVar('field_main') == 1 ) {
$fpmf = $field_name; // fpmf = fields parameters main field
}
}
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_templates.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_templates.php 2014-06-05 08:27:03 UTC (rev 12564)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_templates.php 2014-06-05 15:12:37 UTC (rev 12565)
@@ -29,17 +29,14 @@
/*
* @var string
*/
- private $tables = null;
+ private $tables = null;
/*
- * @var string
- */
- private $fields = null;
- /*
* @public function constructor
* @param null
*/
public function __construct() {
- $this->tdmcfile = TDMCreateFile::getInstance();
+ $this->tdmcfile = TDMCreateFile::getInstance();
+ $this->tdmcreate = TDMCreate::getInstance();
}
/*
* @static function &getInstance
@@ -56,13 +53,13 @@
/*
* @public function write
* @param string $module
+ * @param string $table
* @param mixed $tables
- * @param mixed $fields
*/
- public function write($module, $tables, $fields) {
+ public function write($module, $table, $tables) {
$this->setModule($module);
+ $this->table = $table;
$this->tables = $tables;
- $this->fields = $fields;
}
/*
* @public function render
@@ -77,7 +74,13 @@
foreach(array_keys($this->tables) as $t) {
$table_name = $this->tables[$t]->getVar('table_name');
$table_fieldname = $this->tables[$t]->getVar('table_fieldname');
- }
+ }
+ $table_id = $this->table->getVar('table_id');
+ $criteria_fields = new CriteriaCompo();
+ $criteria_fields->add(new Criteria('field_tid', $table_id));
+ $fields_all = $this->tdmcreate->getHandler('fields')->getObjects($criteria_fields);
+ unset($criteria_fields);
+ //
$stu_module_name = strtoupper($module_name);
$language = $this->getLanguage($module_name, 'MA');
//$content = $this->getHeaderFilesComments($module, $filename);
@@ -88,9 +91,9 @@
<thead>
<tr class="head">\n
EOT;
- foreach(array_keys($this->fields) as $f)
+ foreach(array_keys($fields_all) as $f)
{
- $field_name = $this->fields[$f]->getVar('field_name');
+ $field_name = $fields_all[$f]->getVar('field_name');
$lang_fn = $language.strtoupper($field_name);
$content .= <<<EOT
<th class="center"><{\$smarty.const.{$lang_fn}}></th>\n
@@ -103,10 +106,10 @@
<{foreach item={$table_fieldname} from=\${$table_name}}>
<tr class="<{cycle values='odd, even'}>">\n
EOT;
- foreach(array_keys($this->fields) as $f)
+ foreach(array_keys($fields_all) as $f)
{
- $field_name = $this->fields[$f]->getVar('field_name');
- $field_element = $this->fields[$f]->getVar('field_element');
+ $field_name = $fields_all[$f]->getVar('field_name');
+ $field_element = $fields_all[$f]->getVar('field_element');
if( $field_element == 9 ) {
$content .= <<<EOT
<td class="center"><img src="<{\$xoops_url}>/uploads/{$module_name}/images/{$table_name}/<{\${$table_fieldname}.{$field_name}}>" alt="{$table_name}"></td>\n
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_xoopsversion.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_xoopsversion.php 2014-06-05 08:27:03 UTC (rev 12564)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_xoopsversion.php 2014-06-05 15:12:37 UTC (rev 12565)
@@ -37,17 +37,14 @@
/*
* @var string
*/
- private $tables = null;
+ private $tables = null;
/*
- * @var string
- */
- private $fields = null;
- /*
* @public function constructor
* @param null
*/
public function __construct() {
- $this->tdmcfile = TDMCreateFile::getInstance();
+ $this->tdmcfile = TDMCreateFile::getInstance();
+ $this->tdmcreate = TDMCreate::getInstance();
}
/*
* @static function &getInstance
@@ -67,12 +64,11 @@
* @param mixed $table
* @param string $filename
*/
- public function write($module, $table, $tables, $fields, $filename) {
+ public function write($module, $table, $tables, $filename) {
$this->setModule($module);
$this->setFileName($filename);
$this->table = $table;
$this->tables = $tables;
- $this->fields = $fields;
}
/*
* @public function setKeywords
@@ -459,13 +455,27 @@
* @param string $module_name
* @param string $language
*/
- private function getXoopsVersionNotifications($module, $language)
+ private function getXoopsVersionNotifications($module, $language, $filename)
{
$module_name = $module->getVar('mod_name');
$stl_mod_name = strtolower($module_name);
$ret = '';
if ( $module->getVar('mod_notifications') == 1 )
{
+ $notify_file = '';
+ foreach (array_keys($this->tables) as $i)
+ {
+ $table_name = $this->tables[$i]->getVar('table_name');
+ $table_notifications = $this->tables[$i]->getVar('table_notifications');
+ $count = count($table_name);
+ if($table_notifications == 1) {
+ if($i <= $count) {
+ $notify_file .= "'".$table_name.".php', ";
+ } else {
+ $notify_file .= "'".$table_name.".php'";
+ }
+ }
+ }
$ret .= <<<EOT
\n// Notifications {$stl_mod_name}
\$modversion['hasNotification'] = 1;
@@ -476,7 +486,7 @@
'name' => "global",
'title' => {$language}GLOBAL_NOTIFY,
'description' => {$language}GLOBAL_NOTIFY_DESC,
- 'subscribe_from' => array('index.php', 'viewcat.php', 'singlefile.php'));
+ 'subscribe...
[truncated message content] |