From: <txm...@us...> - 2014-07-08 19:32:17
|
Revision: 12687 http://sourceforge.net/p/xoops/svn/12687 Author: txmodxoops Date: 2014-07-08 19:32:05 +0000 (Tue, 08 Jul 2014) Log Message: ----------- - Fixed bugs - Updated - Still work to do Modified Paths: -------------- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/fields.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/pages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/blocks/blocks.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/formelements.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/htmlsmartycodes.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/pages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/pages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/pages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/language/english/admin.php Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/fields.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/fields.php 2014-07-07 15:24:03 UTC (rev 12686) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/fields.php 2014-07-08 19:32:05 UTC (rev 12687) @@ -158,7 +158,7 @@ if ( !$GLOBALS['xoopsSecurity']->check() ) { redirect_header('fields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } - $field_id = XoopsRequest::getInt('field_id'); + $fieldId = XoopsRequest::getInt('field_id'); // Fields Handler $fields = $tdmcreate->getHandler('fields'); // Set Variables @@ -213,9 +213,9 @@ if (!$tdmcreate->getHandler('fieldelements')->insert($fieldelementObj) ) { $GLOBALS['xoopsTpl']->assign('error', $fieldelementObj->getHtmlErrors() . ' Field element'); } - redirect_header('fields.php', 2, sprintf(_AM_TDMCREATE_FIELD_FORM_SAVED_OK, $table_name)); + redirect_header('fields.php', 2, sprintf(_AM_TDMCREATE_FIELDS_FORM_SAVED_OK, $table_name)); } else { - redirect_header('fields.php', 2, sprintf(_AM_TDMCREATE_FIELD_FORM_UPDATED_OK, $table_name)); + redirect_header('fields.php', 2, sprintf(_AM_TDMCREATE_FIELDS_FORM_UPDATED_OK, $table_name)); } // $GLOBALS['xoopsTpl']->assign('error', $fieldsObj->getHtmlErrors()); @@ -232,8 +232,8 @@ $adminMenu->addItemButton(_AM_TDMCREATE_FIELDS_LIST, 'fields.php', 'list'); $GLOBALS['xoopsTpl']->assign('buttons', $adminMenu->renderButton()); // Form Edit - $field_id = XoopsRequest::getInt('field_id'); - $fieldsObj = $tdmcreate->getHandler('fields')->get( $field_id ); + $fieldId = XoopsRequest::getInt('field_id'); + $fieldsObj = $tdmcreate->getHandler('fields')->get( $fieldId ); $form = $fieldsObj->getFormEdit($field_mid, $fieldTid); $GLOBALS['xoopsTpl']->assign('form', $form->render()); // Test -> Will be removed @@ -242,9 +242,9 @@ case 'drag': $side = TDMCreate_CleanVars( $_POST, 'field_id', 0, 'int' ); - $field_id = XoopsRequest::getInt('field_id'); - if ( $field_id > 0 ) { - $fieldsObj = $tdmcreate->getHandler('fields')->get( $field_id ); + $fieldId = XoopsRequest::getInt('field_id'); + if ( $fieldId > 0 ) { + $fieldsObj = $tdmcreate->getHandler('fields')->get( $fieldId ); $fieldsObj->setVar('field_id', $side); if (!$tdmcreate->getHandler('fields')->insert( $fieldsObj )) { redirect_header('fields.php', 5, _AM_TDMCREATE_FIELD_SIDE_ERROR); @@ -271,11 +271,12 @@ break; case 'display': + $fieldId = XoopsRequest::getInt('field_id'); // Get the list of fields $criteria = new CriteriaCompo(); $criteria->add(new Criteria('field_tid', $fieldTid)); $fields = $tdmcreate->getHandler('fields')->getObjects($criteria); - $fieldsObj =& $tdmcreate->getHandler('fields')->get($field_id); + $fieldsObj =& $tdmcreate->getHandler('fields')->get($fieldId); if (isset($_GET['field_tid'])) { if (isset($_GET['field_parent'])) { foreach ($fields as $field) { 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-07-07 15:24:03 UTC (rev 12686) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/pages.php 2014-07-08 19:32:05 UTC (rev 12687) @@ -61,12 +61,14 @@ * @param string $moduleDirname * @param string $tableName */ - public function getAdminPagesHeader($moduleDirname, $tableName) { + public function getAdminPagesHeader($moduleDirname, $tableName, $fpif) { $ret = <<<EOT include_once 'header.php'; //It recovered the value of argument op in URL$ -\$op = {$moduleDirname}_CleanVars(\$_REQUEST, 'op', 'list', 'string'); +\$op = XoopsRequest::getString('op', 'list'); +// Request {$fpif} +\${$fpif} = XoopsRequest::getInt('{$fpif}'); // Switch options switch (\$op) {\n @@ -84,18 +86,18 @@ * @param string $fpif * @param string $fpmf */ - public function getAdminPagesList($moduleDirname, $tableName, $tableFieldname, $language, $fields, $fpif, $fpmf) { - $stu_module_dirname = strtoupper($moduleDirname); - $stu_table_name = strtoupper($tableName); - $stu_table_fieldname = strtoupper($tableFieldname); + public function getAdminPagesList($moduleDirname, $tableName, $tableFieldname, $tableAutoincrement, $language, $fields, $fpif, $fpmf) { + $stuModuleDirname = strtoupper($moduleDirname); + $stuTableName = strtoupper($tableName); + $stuTableFieldname = strtoupper($tableFieldname); $ret = <<<EOT case 'list': default: - \$limit = \${$moduleDirname}->getConfig('adminpager'); - \$start = {$moduleDirname}_CleanVars(\$_REQUEST, 'start', 0); + \$start = XoopsRequest::getInt('start', 0); + \$limit = XoopsRequest::getInt('limit', \${$moduleDirname}->getConfig('adminpager')); \$template_main = '{$moduleDirname}_admin_{$tableName}.tpl'; \$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('{$tableName}.php')); - \$adminMenu->addItemButton({$language}ADD_{$stu_table_fieldname}, '{$tableName}.php?op=new', 'add'); + \$adminMenu->addItemButton({$language}ADD_{$stuTableFieldname}, '{$tableName}.php?op=new', 'add'); \$GLOBALS['xoopsTpl']->assign('buttons', \$adminMenu->renderButton()); \$criteria = new CriteriaCompo(); \$criteria->setSort('{$fpif} ASC, {$fpmf}'); @@ -103,8 +105,8 @@ \${$tableName}_rows = \${$tableName}Handler->getCount(\$criteria); \${$tableName}_arr = \${$tableName}Handler->getAll(\$criteria); unset(\$criteria); - \$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_url', {$stu_module_dirname}_URL); - \$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_upload_url', {$stu_module_dirname}_UPLOAD_URL); + \$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_url', {$stuModuleDirname}_URL); + \$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_upload_url', {$stuModuleDirname}_UPLOAD_URL); // Table view if (\${$tableName}_rows > 0) { @@ -115,23 +117,25 @@ { $fieldName = $fields[$f]->getVar('field_name'); $rp_field_name = $fieldName; - // Verify if table_fieldname is not empty - if(!empty($tableFieldname)) { - if(strpos($fieldName, '_')) { - $str = strpos($fieldName, '_'); - if($str !== false){ - $rp_field_name = substr($fieldName, $str + 1, strlen($fieldName)); - } - } - $lp_field_name = substr($fieldName, 0, strpos($fieldName, '_')); - $ret .= <<<EOT + if( ($fields[$f]->getVar('field_admin') == 1) || ($tableAutoincrement == 1) ) { + // Verify if table_fieldname is not empty + if(!empty($tableFieldname)) { + if(strpos($fieldName, '_')) { + $str = strpos($fieldName, '_'); + if($str !== false){ + $rp_field_name = substr($fieldName, $str + 1, strlen($fieldName)); + } + } + $lp_field_name = substr($fieldName, 0, strpos($fieldName, '_')); + $ret .= <<<EOT \${$lp_field_name}['{$rp_field_name}'] = \${$tableName}_arr[\$i]->getVar('{$fieldName}');\n EOT; - } else { - $lp_field_name = $tableName; - $ret .= <<<EOT + } else { + $lp_field_name = $tableName; + $ret .= <<<EOT \${$lp_field_name}['{$rp_field_name}'] = \${$tableName}_arr[\$i]->getVar('{$fieldName}');\n EOT; + } } } $ret .= <<<EOT @@ -146,7 +150,7 @@ \$GLOBALS['xoopsTpl']->assign('pagenav', \$pagenav->renderNav(4)); } } else { - \$GLOBALS['xoopsTpl']->assign('error', {$language}THEREARENT_{$stu_table_name}); + \$GLOBALS['xoopsTpl']->assign('error', {$language}THEREARENT_{$stuTableName}); } break;\n EOT; @@ -160,11 +164,11 @@ * @param string $language */ public function getAdminPagesNew($moduleDirname, $tableName, $language) { - $stu_table_name = strtoupper($tableName); + $stuTableName = strtoupper($tableName); $ret = <<<EOT case 'new': \$template_main = '{$moduleDirname}_admin_{$tableName}.tpl'; - \$adminMenu->addItemButton({$language}{$stu_table_name}_LIST, '{$tableName}.php', 'list'); + \$adminMenu->addItemButton({$language}{$stuTableName}_LIST, '{$tableName}.php', 'list'); \$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('{$tableName}.php')); \$GLOBALS['xoopsTpl']->assign('buttons', \$adminMenu->renderButton()); // Get Form @@ -192,8 +196,8 @@ if ( !\$GLOBALS['xoopsSecurity']->check() ) { redirect_header('{$tableName}.php', 3, implode(',', \$GLOBALS['xoopsSecurity']->getErrors())); } - if (isset(\$_REQUEST['{$fpif}'])) { - \${$tableName}Obj =& \${$tableName}Handler->get(\$_REQUEST['{$fpif}']); + if (isset(\${$fpif})) { + \${$tableName}Obj =& \${$tableName}Handler->get(\${$fpif}); } else { \${$tableName}Obj =& \${$tableName}Handler->create(); } @@ -251,17 +255,17 @@ * @param string $fpif */ public function getAdminPagesEdit($moduleDirname, $tableName, $tableFieldname, $language, $fpif) { - $stu_table_name = strtoupper($tableName); - $stu_table_fieldname = strtoupper($tableFieldname); + $stuTableName = strtoupper($tableName); + $stuTableFieldname = strtoupper($tableFieldname); $ret = <<<EOT case 'edit': \$template_main = '{$moduleDirname}_admin_{$tableName}.tpl'; - \$adminMenu->addItemButton({$language}ADD_{$stu_table_fieldname}, '{$tableName}.php?op=new', 'add'); - \$adminMenu->addItemButton({$language}{$stu_table_name}_LIST, '{$tableName}.php', 'list'); + \$adminMenu->addItemButton({$language}ADD_{$stuTableFieldname}, '{$tableName}.php?op=new', 'add'); + \$adminMenu->addItemButton({$language}{$stuTableName}_LIST, '{$tableName}.php', 'list'); \$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('{$tableName}.php')); \$GLOBALS['xoopsTpl']->assign('buttons', \$adminMenu->renderButton()); // Get Form - \${$tableName}Obj = \${$tableName}Handler->get(\$_REQUEST['{$fpif}']); + \${$tableName}Obj = \${$tableName}Handler->get(\${$fpif}); \$form = \${$tableName}Obj->getForm(); \$GLOBALS['xoopsTpl']->assign('form', \$form->render()); break;\n @@ -278,7 +282,7 @@ $ret = <<<EOT case 'delete': - \${$tableName}Obj =& \${$tableName}Handler->get(\$_REQUEST['{$fpif}']); + \${$tableName}Obj =& \${$tableName}Handler->get(\${$fpif}); if (isset(\$_REQUEST['ok']) && \$_REQUEST['ok'] == 1) { if ( !\$GLOBALS['xoopsSecurity']->check() ) { redirect_header('{$tableName}.php', 3, implode(', ', \$GLOBALS['xoopsSecurity']->getErrors())); @@ -289,7 +293,7 @@ echo \${$tableName}Obj->getHtmlErrors(); } } else { - xoops_confirm(array('ok' => 1, '{$fpif}' => \$_REQUEST['{$fpif}'], 'op' => 'delete'), \$_SERVER['REQUEST_URI'], sprintf({$language}FORMSUREDEL, \${$tableName}Obj->getVar('{$fpmf}'))); + xoops_confirm(array('ok' => 1, '{$fpif}' => \${$fpif}, 'op' => 'delete'), \$_SERVER['REQUEST_URI'], sprintf({$language}FORMSUREDEL, \${$tableName}Obj->getVar('{$fpmf}'))); } break;\n EOT; @@ -318,7 +322,8 @@ $table = $this->getTable(); $moduleDirname = $module->getVar('mod_dirname'); $tableName = $table->getVar('table_name'); - $tableFieldname = $table->getVar('table_fieldname'); + $tableFieldname = $table->getVar('table_fieldname'); + $tableAutoincrement = $table->getVar('table_autoincrement'); $language = $this->getLanguage($moduleDirname, 'AM'); $fields = $this->getTableFields($table->getVar('table_id')); foreach(array_keys($fields) as $f) @@ -332,8 +337,8 @@ } } $content = $this->getHeaderFilesComments($module, $filename); - $content .= $this->getAdminPagesHeader($moduleDirname, $tableName); - $content .= $this->getAdminPagesList($moduleDirname, $tableName, $tableFieldname, $language, $fields, $fpif, $fpmf); + $content .= $this->getAdminPagesHeader($moduleDirname, $tableName, $fpif); + $content .= $this->getAdminPagesList($moduleDirname, $tableName, $tableFieldname, $tableAutoincrement, $language, $fields, $fpif, $fpmf); $content .= $this->getAdminPagesNew($moduleDirname, $tableName, $language); $content .= $this->getAdminPagesSave($moduleDirname, $tableName, $language, $fields, $fpif, $fpmf); $content .= $this->getAdminPagesEdit($moduleDirname, $tableName, $tableFieldname, $language, $fpif); Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/blocks/blocks.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/blocks/blocks.php 2014-07-07 15:24:03 UTC (rev 12686) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/blocks/blocks.php 2014-07-08 19:32:05 UTC (rev 12687) @@ -101,23 +101,25 @@ { $fieldName = $fields[$f]->getVar('field_name'); $rp_field_name = $fieldName; - // Verify if table_fieldname is not empty - if(!empty($tableFieldname)) { - if(strpos($fieldName, '_')) { - $str = strpos($fieldName, '_'); - if($str !== false){ - $rp_field_name = substr($fieldName, $str + 1, strlen($fieldName)); - } - } - $tname = $tableFieldname; - $ret .= <<<EOT + if( $fields[$f]->getVar('field_block') == 1 ) { + // Verify if table_fieldname is not empty + if(!empty($tableFieldname)) { + if(strpos($fieldName, '_')) { + $str = strpos($fieldName, '_'); + if($str !== false){ + $rp_field_name = substr($fieldName, $str + 1, strlen($fieldName)); + } + } + $tname = $tableFieldname; + $ret .= <<<EOT \${$tname}['{$rp_field_name}'] = \${$tableName}_arr[\$i]->getVar('{$fieldName}');\n EOT; - } else { - $tname = $tableName; - $ret .= <<<EOT + } else { + $tname = $tableName; + $ret .= <<<EOT \${$tname}['{$rp_field_name}'] = \${$tableName}_arr[\$i]->getVar('{$fieldName}');\n EOT; + } } } $ret .= <<<EOT Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/formelements.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/formelements.php 2014-07-07 15:24:03 UTC (rev 12686) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/formelements.php 2014-07-08 19:32:05 UTC (rev 12687) @@ -223,7 +223,7 @@ // Form Select \${$fieldName}_select = new XoopsFormSelect({$language}, '{$fieldName}', \$this->getVar('{$fieldName}')); \${$fieldName}_select->addOption('Empty'); - \${$fieldName}_select->addOptionArray({$tableName}Handler->getList()); + \${$fieldName}_select->addOptionArray(\${$tableName}Handler->getList()); \$form->addElement( \${$fieldName}_select{$required} );\n EOT; return $ret; @@ -279,6 +279,7 @@ private function getXoopsFormTable($language, $moduleDirname, $tableName, $fields, $required = 'false') { $fieldName = ''; + $ucf_table_name = ucfirst($tableName); foreach(array_keys($fields) as $f) { if(($fields[$f]->getVar('field_parent') == 1)) { @@ -286,10 +287,10 @@ } } $ret = <<<EOT - // Form Table + // Form Topic {$ucf_table_name} \${$tableName}Handler =& \$this->{$moduleDirname}->getHandler('{$tableName}'); \${$fieldName}_select = new XoopsFormSelect({$language}, '{$fieldName}', \$this->getVar('{$fieldName}')); - \${$fieldName}_select->addOptionArray(\${$fieldName}Handler->getList()); + \${$fieldName}_select->addOptionArray(\${$tableName}Handler->getList()); \$form->addElement( \${$fieldName}_select{$required} );\n EOT; return $ret; Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/htmlsmartycodes.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/htmlsmartycodes.php 2014-07-07 15:24:03 UTC (rev 12686) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/htmlsmartycodes.php 2014-07-08 19:32:05 UTC (rev 12687) @@ -121,7 +121,7 @@ return $ret; } /* - * @public function getHtmlTable + * @public function getHtmlTableThead * @param string $class * @param string $content */ @@ -134,7 +134,7 @@ return $ret; } /* - * @public function getHtmlTable + * @public function getHtmlTableTbody * @param string $class * @param string $content */ @@ -197,22 +197,33 @@ /* * @public function getSmartyConst * @param string $language - * @param mixed $field_name + * @param mixed $fieldName */ - public function getSmartyConst($language, $field_name) { + public function getSmartyConst($language, $fieldName) { $ret = <<<EOT - <{\$smarty.const.{$language}{$field_name}}> + <{\$smarty.const.{$language}{$fieldName}}> EOT; return $ret; } /* + * @public function getSmartyTableFieldNameEmptyData + * @param string $tableName + * @param string $fieldName + */ + public function getSmartyTableFieldNameEmptyData($tableName = '', $fieldName = '') { + $ret = <<<EOT + <{\${$tableName}.{$fieldName}}> +EOT; + return $ret; + } + /* * @public function getSmartyTableField - * @param string $table_fieldname - * @param string $field_name + * @param string $tableFieldname + * @param string $fieldName */ - public function getSmartyTableFieldData($table_fieldname = '', $fieldname = '') { + public function getSmartyTableFieldData($tableFieldname = '', $fieldName = '') { $ret = <<<EOT - <{\${$table_fieldname}.{$fieldname}}> + <{\${$tableFieldname}.{$fieldName}}> EOT; return $ret; } @@ -220,9 +231,9 @@ * @public function getSmartyIncludeFile * @param string $name */ - public function getSmartyIncludeFile($module_name, $fieldname = 'header') { + public function getSmartyIncludeFile($moduleDirname, $tableName = 'header') { $ret = <<<EOT - <{include file='db:{$module_name}_{$fieldname}.html'}> + <{include file='db:{$moduleDirname}_{$tableName}.html'}> EOT; return $ret; } Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/pages.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/pages.php 2014-07-07 15:24:03 UTC (rev 12686) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/pages.php 2014-07-08 19:32:05 UTC (rev 12687) @@ -54,11 +54,11 @@ /* * @private function getTemplatesAdminPagesHeader * @param string $moduleDirname - * @param string $table + * @param string $tableName + * @param string $fields * @param string $language */ - private function getTemplatesAdminPagesHeader($moduleDirname, $table, $language) { - $tableName = $table->getVar('table_name'); + private function getTemplatesAdminPagesHeader($moduleDirname, $tableName, $fields, $language) { $ret = <<<EOT <{include file="db:{$moduleDirname}_admin_header.tpl"}> <{if {$tableName}_list}> @@ -66,12 +66,11 @@ <thead> <tr class="head">\n EOT; - $fields = $this->getTableFields($table->getVar('table_id')); foreach(array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $lang_fn = $language.strtoupper($fieldName); - if( ($fields[$f]->getVar('field_inlist') == 1) || ($table->getVar('table_autoincrement') == 1) ) { + if( $fields[$f]->getVar('field_inlist') == 1 ) { $ret .= <<<EOT <th class="center"><{\$smarty.const.{$lang_fn}}></th>\n EOT; @@ -87,19 +86,17 @@ /* * @private function getTemplatesAdminPagesBody * @param string $moduleDirname - * @param string $table + * @param string $tableName + * @param string $fields * @param string $language */ - private function getTemplatesAdminPagesBody($moduleDirname, $table, $language) + private function getTemplatesAdminPagesBody($moduleDirname, $tableName, $fields, $language) { - $moduleDirname = strtolower($moduleDirname); - $tableName = $table->getVar('table_name'); $ret = <<<EOT <tbody> <{foreach item=list from=\${$tableName}_list}> <tr class="<{cycle values='odd, even'}>">\n EOT; - $fields = $this->getTableFields($table->getVar('table_id')); foreach(array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); @@ -121,7 +118,7 @@ } } $lp_field_name = substr($fieldName, 0, strpos($fieldName, '_')); - if( ($fields[$f]->getVar('field_inlist') == 1) || ($table->getVar('table_autoincrement') == 1) ) { + if( $fields[$f]->getVar('field_inlist') == 1 ) { switch( $fieldElement ) { case 8: $ret .= <<<EOT @@ -165,18 +162,17 @@ /* * @private function getTemplatesAdminPagesBodyFieldnameEmpty * @param string $moduleDirname - * @param string $table + * @param string $tableName + * @param string $fields * @param string $language */ - private function getTemplatesAdminPagesBodyFieldnameEmpty($moduleDirname, $table, $language) + private function getTemplatesAdminPagesBodyFieldnameEmpty($moduleDirname, $tableName, $fields, $language) { - $tableName = $table->getVar('table_name'); $ret = <<<EOT <tbody> <{foreach item=list from=\${$tableName}_list}> <tr class="<{cycle values='odd, even'}>">\n EOT; - $fields = $this->getTableFields($table->getVar('table_id')); foreach(array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); @@ -184,7 +180,7 @@ if($f == 0) { $field_id = $fieldName; } - if( ($fields[$f]->getVar('field_inlist') == 1) || ($table->getVar('table_autoincrement') == 1) ) { + if( $fields[$f]->getVar('field_inlist') == 1 ) { switch( $fieldElement ) { case 8: $ret .= <<<EOT @@ -262,13 +258,14 @@ $moduleDirname = $module->getVar('mod_dirname'); $tableName = $table->getVar('table_name'); $tableFieldname = $table->getVar('table_fieldname'); - $language = $this->getLanguage($moduleDirname, 'AM'); - $content = $this->getTemplatesAdminPagesHeader($moduleDirname, $table, $language); + $language = $this->getLanguage($moduleDirname, 'AM'); + $fields = $this->getTableFields($table->getVar('table_id')); + $content = $this->getTemplatesAdminPagesHeader($moduleDirname, $tableName, $fields, $language); // Verify if table_fieldname is not empty if(!empty($tableFieldname)) { - $content .= $this->getTemplatesAdminPagesBody($moduleDirname, $table, $language); + $content .= $this->getTemplatesAdminPagesBody($moduleDirname, $tableName, $fields, $language); } else { - $content .= $this->getTemplatesAdminPagesBodyFieldnameEmpty($moduleDirname, $table, $language); + $content .= $this->getTemplatesAdminPagesBodyFieldnameEmpty($moduleDirname, $tableName, $fields, $language); } $content .= $this->getTemplatesAdminPagesFooter($moduleDirname); // Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/pages.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/pages.php 2014-07-07 15:24:03 UTC (rev 12686) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/pages.php 2014-07-08 19:32:05 UTC (rev 12687) @@ -71,9 +71,11 @@ { $fieldName = $fields[$f]->getVar('field_name'); $lang_stu_field_name = $language.strtoupper($fieldName); - $ret .= <<<EOT + if( $fields[$f]->getVar('field_user') == 1 ) { + $ret .= <<<EOT <th class="center"><{\$smarty.const.{$lang_stu_field_name}}></th>\n EOT; + } } $ret .= <<<EOT </tr> @@ -107,27 +109,29 @@ $rp_field_name = substr($fieldName, $str + 1, strlen($fieldName)); } } - switch( $field_element ) { - case 8: - $ret .= <<<EOT + if( $fields[$f]->getVar('field_user') == 1 ) { + switch( $field_element ) { + case 8: + $ret .= <<<EOT <td class="center"><span style="background-color: <{\$list.{$rp_field_name}}>;">\t\t</span></td>\n EOT; - break; - case 9: - $ret .= <<<EOT + break; + case 9: + $ret .= <<<EOT <td class="center"><img src="<{xoModuleIcons32}><{\$list.{$rp_field_name}}>" alt="{$tableName}"></td>\n EOT; - break; - case 10: - $ret .= <<<EOT + break; + case 10: + $ret .= <<<EOT <td class="center"><img src="<{\${$moduleDirname}_upload_url}>/images/{$tableName}/<{\$list.{$rp_field_name}}>" alt="{$tableName}"></td>\n EOT; - break; - default: - $ret .= <<<EOT + break; + default: + $ret .= <<<EOT <td class="center"><{\$list.{$rp_field_name}}></td>\n EOT; - break; + break; + } } } $ret .= <<<EOT @@ -157,23 +161,25 @@ { $fieldName = $fields[$f]->getVar('field_name'); $field_element = $fields[$f]->getVar('field_element'); - switch( $field_element ) { - case 8: - $ret .= <<<EOT + if( $fields[$f]->getVar('field_user') == 1 ) { + switch( $field_element ) { + case 8: + $ret .= <<<EOT <td class="center"><span style="background-color: <{\$list.{$fieldName}}>;"></span></td>\n EOT; - break; - case 9: - $ret .= <<<EOT + break; + case 9: + $ret .= <<<EOT <td class="center"><img src="<{\${$moduleDirname}_upload_url}>/images/{$tableName}/<{\$list.{$fieldName}}>" alt="{$tableName}"></td>\n EOT; - break; - default: - $ret .= <<<EOT + break; + default: + $ret .= <<<EOT <td class="center"><{\$list.{$fieldName}}></td>\n EOT; - break; - } + break; + } + } } $ret .= <<<EOT </tr> 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-07-07 15:24:03 UTC (rev 12686) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/pages.php 2014-07-08 19:32:05 UTC (rev 12687) @@ -92,46 +92,48 @@ { $fieldName = $fields[$f]->getVar('field_name'); $rp_field_name = $fieldName; - // Verify if table_fieldname is not empty - if(!empty($tableFieldname)) { - if(strpos($fieldName, '_')) { - $str = strpos($fieldName, '_'); - if($str !== false){ - $rp_field_name = substr($fieldName, $str + 1, strlen($fieldName)); - } - } - $lp_field_name = substr($fieldName, 0, strpos($fieldName, '_')); - $tname = $lp_field_name; - $fieldElement = $fields[$f]->getVar('field_element'); - if ( $fields[$f]->getVar('field_main') == 1 ) { - $fpmf = $fieldName; // fpmf = fields parameters main field - } - // Verify if this is a textarea or dhtmltextarea - if ( $fieldElement == 2 || $fieldElement == 3 ) { - $ret .= <<<EOT + if( $fields[$f]->getVar('field_user') == 1 ) { + // Verify if table_fieldname is not empty + if(!empty($tableFieldname)) { + if(strpos($fieldName, '_')) { + $str = strpos($fieldName, '_'); + if($str !== false){ + $rp_field_name = substr($fieldName, $str + 1, strlen($fieldName)); + } + } + $lp_field_name = substr($fieldName, 0, strpos($fieldName, '_')); + $tname = $lp_field_name; + $fieldElement = $fields[$f]->getVar('field_element'); + if ( $fields[$f]->getVar('field_main') == 1 ) { + $fpmf = $fieldName; // fpmf = fields parameters main field + } + // Verify if this is a textarea or dhtmltextarea + if ( $fieldElement == 2 || $fieldElement == 3 ) { + $ret .= <<<EOT \${$tname}['{$rp_field_name}'] = strip_tags(\${$stl_table_name}_arr[\$i]->getVar('{$fieldName}'));\n EOT; - } else { - $ret .= <<<EOT + } else { + $ret .= <<<EOT \${$tname}['{$rp_field_name}'] = \${$stl_table_name}_arr[\$i]->getVar('{$fieldName}');\n EOT; - } - } else { - $tname = $tableName; - $fieldElement = $fields[$f]->getVar('field_element'); - if ( $fields[$f]->getVar('field_main') == 1 ) { - $fpmf = $fieldName; // fpmf = fields parameters main field - } - // Verify if this is a textarea or dhtmltextarea - if ( $fieldElement == 2 || $fieldElement == 3 ) { - $ret .= <<<EOT + } + } else { + $tname = $tableName; + $fieldElement = $fields[$f]->getVar('field_element'); + if ( $fields[$f]->getVar('field_main') == 1 ) { + $fpmf = $fieldName; // fpmf = fields parameters main field + } + // Verify if this is a textarea or dhtmltextarea + if ( $fieldElement == 2 || $fieldElement == 3 ) { + $ret .= <<<EOT \${$tname}['{$rp_field_name}'] = strip_tags(\${$stl_table_name}_arr[\$i]->getVar('{$fieldName}'));\n EOT; - } else { - $ret .= <<<EOT + } else { + $ret .= <<<EOT \${$tname}['{$rp_field_name}'] = \${$stl_table_name}_arr[\$i]->getVar('{$fieldName}');\n EOT; - } + } + } } } $ret .= <<<EOT @@ -147,7 +149,7 @@ } } // keywords -{$moduleDirname}_meta_keywords(xoops_getModuleOption('keywords', \$dirname) .', '. implode(', ', \$keywords)); +{$moduleDirname}_meta_keywords(\${$moduleDirname}->getConfig('keywords').', '. implode(', ', \$keywords)); unset(\$keywords); // description {$moduleDirname}_meta_description({$language}{$stu_table_name}_DESC); Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/language/english/admin.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/language/english/admin.php 2014-07-07 15:24:03 UTC (rev 12686) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/language/english/admin.php 2014-07-08 19:32:05 UTC (rev 12687) @@ -30,16 +30,6 @@ define('_AM_TDMCREATE_THEREARE_NUMMODULES', "There are <span class='red bold'>%s</span> modules stored in the Database"); define('_AM_TDMCREATE_THEREARE_NUMTABLES', "There are <span class='red bold'>%s</span> tables stored in the Database"); define('_AM_TDMCREATE_THEREARE_NUMFIELDS', "There are <span class='red bold'>%s</span> fields stored in the Database"); - -define('_AM_TDMCREATE_TABLES_FIELDS_MORE_ELEMENTS', "Forms: Elements"); -define('_AM_TDMCREATE_TABLES_FIELDS_MORE_PARENT_ID', "Parent: Category id"); -define('_AM_TDMCREATE_TABLES_FIELDS_MORE_DISPLAY_ADMIN', "Page: Show admin"); -define('_AM_TDMCREATE_TABLES_FIELDS_MORE_DISPLAY_USER', "Page: View User"); -define('_AM_TDMCREATE_TABLES_FIELDS_MORE_BLOC', "Block: View"); -define('_AM_TDMCREATE_TABLES_FIELDS_MORE_MAIN_FIELD', "Table: Main Field"); -define('_AM_TDMCREATE_TABLES_FIELDS_MORE_SEARCH', "Search: Index"); -define('_AM_TDMCREATE_TABLES_FIELDS_MORE_REQUIRED', "Forms: Required field"); - // General define('_AM_TDMCREATE_FORMOK', "Successfully saved"); define('_AM_TDMCREATE_FORMDELOK', "Successfully deleted"); @@ -54,7 +44,7 @@ define('_AM_TDMCREATE_FORM_INFO_TABLE_OPTIONAL_FIELD', "Optional fields"); define('_AM_TDMCREATE_FORM_INFO_TABLE_STRUCTURES_FIELD', "Structures fields"); define('_AM_TDMCREATE_FORM_INFO_TABLE_ICON_FIELD', "Icon fields"); - +// define('_AM_TDMCREATE_ID', "ID"); define('_AM_TDMCREATE_NAME', "Name"); define('_AM_TDMCREATE_BLOCKS', "Blocks"); @@ -70,8 +60,7 @@ //Form define('_AM_TDMCREATE_MODULE_NEW', "New module"); define('_AM_TDMCREATE_MODULE_EDIT', "Edit module"); -//define('_AM_TDMCREATE_MODULE_IMPORTANT', "Required Information"); - +// define('_AM_TDMCREATE_MODULE_IMPORTANT', "<span style='color: #FF0000'>Required - Information</span>"); define('_AM_TDMCREATE_MODULE_NOTIMPORTANT', "<span style='color: #00FF00'>Optional - Information</span>"); define('_AM_TDMCREATE_MODULE_ID', "Id"); @@ -175,7 +164,6 @@ define('_AM_TDMCREATE_TABLE_IMAGE_DESC', "<span class='red bold'>WARNING</span>: If you want to choose a new image, is best to name it with the module name before and follow with the name of the image so as not to overwrite any images with the same name, in the <span class='bold'>Frameworks/moduleclasses/moduleadmin/icons/32/</span>. Otherwise an other solution, would be to insert the images in the module, a new folder is created, with the creation of the same module - <span class='bold'>images/32</span>."); define('_AM_TDMCREATE_TABLE_FORM_CREATED_OK', "The table <b class='green'>%s</b> is successfully created"); define('_AM_TDMCREATE_TABLE_FORM_UPDATED_OK', "The table <b class='green'>%s</b> is successfully updated"); - // ------------------ Form Fields ------------------ // Caption define('_AM_TDMCREATE_FIELDS_NEW', "New fields"); @@ -298,8 +286,8 @@ define('_AM_TDMCREATE_BUILD_MODSELOPT', "Select and build a Module"); define('_AM_TDMCREATE_NOTMODULES', "There aren't modules, pleace create one first"); define('_AM_TDMCREATE_NOTTABLES', "There aren't tables, pleace create one first"); -define('_AM_TDMCREATE_FIELD_FORM_SAVED_OK', "Fields of table %s successfully saved"); -define('_AM_TDMCREATE_FIELD_FORM_UPDATED_OK', "Fields of table %s successfully updated"); +define('_AM_TDMCREATE_FIELDS_FORM_SAVED_OK', "Fields of table <b class='green'>%s</b> successfully saved"); +define('_AM_TDMCREATE_FIELDS_FORM_UPDATED_OK', "Fields of table <b class='green'>%s</b> successfully updated"); // define('_AM_TDMCREATE_THEREARENT_MODULES', "There aren't modules"); define('_AM_TDMCREATE_THEREARENT_TABLES', "There aren't tables"); |
From: <txm...@us...> - 2014-07-09 18:25:22
|
Revision: 12692 http://sourceforge.net/p/xoops/svn/12692 Author: txmodxoops Date: 2014-07-09 18:25:13 +0000 (Wed, 09 Jul 2014) Log Message: ----------- - Updated - Still work to do Modified Paths: -------------- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/pages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/objects.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/pages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/docs/changelog.txt XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/xoops_version.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-07-09 13:47:01 UTC (rev 12691) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/pages.php 2014-07-09 18:25:13 UTC (rev 12692) @@ -16,7 +16,7 @@ * @package tdmcreate * @since 2.5.0 * @author Txmod Xoops http://www.txmodxoops.org - * @version $Id: admin_pages.php 12258 2014-01-02 09:33:29Z timgno $ + * @version $Id: pages.php 12258 2014-01-02 09:33:29Z timgno $ */ defined('XOOPS_ROOT_PATH') or die('Restricted access'); require_once 'objects.php'; Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/objects.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/objects.php 2014-07-09 13:47:01 UTC (rev 12691) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/objects.php 2014-07-09 18:25:13 UTC (rev 12692) @@ -35,11 +35,11 @@ return $instance; } /* - * @public function getPhpUserHeader + * @public function getUserHeader * @param string $moduleDirname * @param string $tableName */ - public function getPhpUserHeader($moduleDirname, $tableName) { + public function getUserHeader($moduleDirname, $tableName) { $ret = <<<EOT include_once 'header.php'; \$GLOBALS['xoopsOption']['template_main'] = '{$moduleDirname}_{$tableName}.tpl'; @@ -48,10 +48,10 @@ return $ret; } /* - * @public function getPhpUserIndex + * @public function getUserIndex * @param string $moduleDirname */ - public function getPhpUserIndex($moduleDirname) { + public function getUserIndex($moduleDirname) { $ret = <<<EOT include_once 'header.php'; \$GLOBALS['xoopsOption']['template_main'] = '{$moduleDirname}_index.tpl'; @@ -60,13 +60,69 @@ return $ret; } /* - * @public function getPhpUserFooter + * @public function getUserFooter * @param null */ - public function getPhpUserFooter() { + public function getUserFooter() { $ret = <<<EOT include_once 'footer.php'; EOT; return $ret; - } + } + /* + * @public function getSimpleGetVar + * @param string $lpFieldName + * @param string $rpFieldName + * @param string $tableName + * @param string $fieldName + */ + public function getSimpleGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { + $ret = <<<EOT +\t\t\t// Get Var {$fieldName} +\t\t\t\${$lpFieldName}['{$rpFieldName}'] = \${$tableName}_arr[\$i]->getVar('{$fieldName}');\n +EOT; + return $ret; + } + /* + * @public function getTextAreaGetVar + * @param string $lpFieldName + * @param string $rpFieldName + * @param string $tableName + * @param string $fieldName + */ + public function getTextAreaGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { + $ret = <<<EOT +\t\t\t// Get Var {$fieldName} +\t\t\t\${$lpFieldName}['{$rpFieldName}'] = strip_tags(\${$tableName}_arr[\$i]->getVar('{$fieldName}'));\n +EOT; + return $ret; + } + /* + * @public function getSelectUserGetVar + * @param string $lpFieldName + * @param string $rpFieldName + * @param string $tableName + * @param string $fieldName + */ + public function getSelectUserGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { + $ret = <<<EOT +\t\t\t// Get Var {$fieldName} +\t\t\t\${$lpFieldName}['{$rpFieldName}'] = XoopsUser::getUnameFromId(\${$tableName}_arr[\$i]->getVar('{$fieldName}'), 's');\n +EOT; + return $ret; + } + /* + * @public function getTextDateSelectGetVar + * @param string $lpFieldName + * @param string $rpFieldName + * @param string $tableName + * @param string $fieldName + */ + public function getTextDateSelectGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { + $ret = <<<EOT +\t\t\t// Get Var {$fieldName} +\t\t\t\${$lpFieldName}['{$rpFieldName}'] = formatTimeStamp(\${$tableName}_arr[\$i]->getVar('{$fieldName}'), 's');\n +EOT; + return $ret; + } } \ No newline at end of file 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-07-09 13:47:01 UTC (rev 12691) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/pages.php 2014-07-09 18:25:13 UTC (rev 12692) @@ -16,19 +16,24 @@ * @package tdmcreate * @since 2.5.0 * @author Txmod Xoops http://www.txmodxoops.org - * @version $Id: user_pages.php 12258 2014-01-02 09:33:29Z timgno $ + * @version $Id: pages.php 12258 2014-01-02 09:33:29Z timgno $ */ defined('XOOPS_ROOT_PATH') or die('Restricted access'); - +require_once 'objects.php'; class UserPages extends TDMCreateFile { /* + * @var string + */ + private $userobjects = null; + /* * @public function constructor * @param null */ public function __construct() { parent::__construct(); - $this->tdmcfile = TDMCreateFile::getInstance(); + $this->tdmcfile = TDMCreateFile::getInstance(); + $this->userobjects = UserObjects::getInstance(); } /* * @static function &getInstance @@ -62,9 +67,10 @@ $table = $this->getTable(); $tableName = $table->getVar('table_name'); $tableFieldname = $table->getVar('table_fieldname'); - $stu_mod_name = strtoupper($moduleDirname); - $stu_table_name = strtoupper($tableName); - $stl_table_name = strtolower($tableName); + $tableAutoincrement = $table->getVar('table_autoincrement'); + $stuModuleDirname = strtoupper($moduleDirname); + $stuTableName = strtoupper($tableName); + $stlTableName = strtolower($tableName); $ret = <<<EOT \ninclude_once 'header.php'; \$GLOBALS['xoopsOption']['template_main'] = '{$moduleDirname}_{$tableName}.tpl'; @@ -74,16 +80,16 @@ // Define Stylesheet \$xoTheme->addStylesheet( \$style ); // Get Handler -\${$stl_table_name}Handler =& \${$moduleDirname}->getHandler('{$stl_table_name}'); +\${$stlTableName}Handler =& \${$moduleDirname}->getHandler('{$stlTableName}'); // -\$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_upload_url', {$stu_mod_name}_UPLOAD_URL); +\$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_upload_url', {$stuModuleDirname}_UPLOAD_URL); // \$criteria = new CriteriaCompo(); -\${$stl_table_name}_count = \${$stl_table_name}Handler->getCount(\$criteria); -\${$stl_table_name}_arr = \${$stl_table_name}Handler->getAll(\$criteria); +\${$stlTableName}_count = \${$stlTableName}Handler->getCount(\$criteria); +\${$stlTableName}_arr = \${$stlTableName}Handler->getAll(\$criteria); \$keywords = array(); -if (\${$stl_table_name}_count > 0) { - foreach (array_keys(\${$stl_table_name}_arr) as \$i) +if (\${$stlTableName}_count > 0) { + foreach (array_keys(\${$stlTableName}_arr) as \$i) {\n EOT; // Fields @@ -92,59 +98,45 @@ { $fieldName = $fields[$f]->getVar('field_name'); $rp_field_name = $fieldName; - if( $fields[$f]->getVar('field_user') == 1 ) { - // Verify if table_fieldname is not empty - if(!empty($tableFieldname)) { - if(strpos($fieldName, '_')) { - $str = strpos($fieldName, '_'); - if($str !== false){ - $rp_field_name = substr($fieldName, $str + 1, strlen($fieldName)); - } - } - $lp_field_name = substr($fieldName, 0, strpos($fieldName, '_')); - $tname = $lp_field_name; - $fieldElement = $fields[$f]->getVar('field_element'); - if ( $fields[$f]->getVar('field_main') == 1 ) { - $fpmf = $fieldName; // fpmf = fields parameters main field - } - // Verify if this is a textarea or dhtmltextarea - if ( $fieldElement == 2 || $fieldElement == 3 ) { - $ret .= <<<EOT - \${$tname}['{$rp_field_name}'] = strip_tags(\${$stl_table_name}_arr[\$i]->getVar('{$fieldName}'));\n -EOT; - } else { - $ret .= <<<EOT - \${$tname}['{$rp_field_name}'] = \${$stl_table_name}_arr[\$i]->getVar('{$fieldName}');\n -EOT; - } - } else { - $tname = $tableName; - $fieldElement = $fields[$f]->getVar('field_element'); - if ( $fields[$f]->getVar('field_main') == 1 ) { - $fpmf = $fieldName; // fpmf = fields parameters main field - } - // Verify if this is a textarea or dhtmltextarea - if ( $fieldElement == 2 || $fieldElement == 3 ) { - $ret .= <<<EOT - \${$tname}['{$rp_field_name}'] = strip_tags(\${$stl_table_name}_arr[\$i]->getVar('{$fieldName}'));\n -EOT; - } else { - $ret .= <<<EOT - \${$tname}['{$rp_field_name}'] = \${$stl_table_name}_arr[\$i]->getVar('{$fieldName}');\n -EOT; - } - } + // Verify if table_fieldname is not empty + $lpFieldName = !empty($tableFieldname) ? substr($fieldName, 0, strpos($fieldName, '_')) : $tableName; + if(strpos($fieldName, '_')) { + $str = strpos($fieldName, '_'); + if($str !== false){ + $rpFieldName = substr($fieldName, $str + 1, strlen($fieldName)); + } + } + if ( $fields[$f]->getVar('field_main') == 1 ) { + $fpmf = $fieldName; // fpmf = fields parameters main field } + $fieldElement = $fields[$f]->getVar('field_element'); + if( ($fields[$f]->getVar('field_user') == 1) || ($tableAutoincrement == 1) ) { + switch($fieldElement) { + case 2: + case 3: + $ret .= $this->userobjects->getTextAreaGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); + break; + case 7: + $ret .= $this->userobjects->getSelectUserGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); + break; + case 12: + $ret .= $this->userobjects->getTextDateSelectGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); + break; + default: + $ret .= $this->userobjects->getSimpleGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); + break; + } + } } $ret .= <<<EOT - \$GLOBALS['xoopsTpl']->append('{$stl_table_name}', \${$tname}); - \$keywords[] = \${$stl_table_name}_arr[\$i]->getVar('{$fpmf}'); - unset(\${$tname}); + \$GLOBALS['xoopsTpl']->append('{$stlTableName}', \${$lpFieldName}); + \$keywords[] = \${$stlTableName}_arr[\$i]->getVar('{$fpmf}'); + unset(\${$lpFieldName}); } // Display Navigation - if (\${$stl_table_name}_count > \$limit) { + if (\${$stlTableName}_count > \$limit) { include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - \$nav = new XoopsPageNav(\${$stl_table_name}_count, \$limit, \$start, 'start'); + \$nav = new XoopsPageNav(\${$stlTableName}_count, \$limit, \$start, 'start'); \$GLOBALS['xoopsTpl']->assign('pagenav', \$nav->renderNav(4)); } } @@ -152,9 +144,9 @@ {$moduleDirname}_meta_keywords(\${$moduleDirname}->getConfig('keywords').', '. implode(', ', \$keywords)); unset(\$keywords); // description -{$moduleDirname}_meta_description({$language}{$stu_table_name}_DESC); +{$moduleDirname}_meta_description({$language}{$stuTableName}_DESC); // -\$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', {$stu_mod_name}_URL.'/{$stl_table_name}.php'); +\$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', {$stuModuleDirname}_URL.'/{$stlTableName}.php'); // include_once 'footer.php'; EOT; Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/docs/changelog.txt =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/docs/changelog.txt 2014-07-09 13:47:01 UTC (rev 12691) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/docs/changelog.txt 2014-07-09 18:25:13 UTC (rev 12692) @@ -2,7 +2,11 @@ 2014/01/02: Version 1.91 alpha 1 ================================= -- Under Construction +- Refactoring +- Rewritten from scratch +- Added templates admin +- Added fields table +- Added more parameters in fields form ================================= 2013/05/12: Version 1.39 RC 1 Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/xoops_version.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/xoops_version.php 2014-07-09 13:47:01 UTC (rev 12691) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/xoops_version.php 2014-07-09 18:25:13 UTC (rev 12692) @@ -24,12 +24,12 @@ $modversion['name'] = "{$dirname}"; $modversion['version'] = 1.91; $modversion['description'] = _MI_TDMCREATE_DESC; -$modversion['author'] = 'Xoops TDM'; +$modversion['author'] = "Xoops TDM"; $modversion['author_website_url'] = "http://www.xoops.org/"; $modversion['author_website_name'] = "Xoops Team Developers Module"; $modversion['credits'] = "Mamba(Xoops), Timgno(Txmod Xoops)"; -$modversion['help'] = 'page=help'; -$modversion['license'] = 'GNU GPL 2.0 or later'; +$modversion['help'] = "page=help"; +$modversion['license'] = "GNU GPL 2.0 or later"; $modversion['license_url'] = "www.gnu.org/licenses/gpl-2.0.html/"; $modversion['release_info'] = "README"; $modversion['release_file'] = XOOPS_URL."/modules/{$dirname}/docs/readme.txt"; @@ -38,16 +38,16 @@ $modversion['image'] = "assets/images/logo.png"; $modversion['dirname'] = "{$dirname}"; -$modversion['dirmoduleadmin'] = '/Frameworks/moduleclasses/moduleadmin'; -$modversion['sysicons16'] = '../../Frameworks/moduleclasses/icons/16'; -$modversion['sysicons32'] = '../../Frameworks/moduleclasses/icons/32'; +$modversion['dirmoduleadmin'] = "/Frameworks/moduleclasses/moduleadmin"; +$modversion['sysicons16'] = "../../Frameworks/moduleclasses/icons/16"; +$modversion['sysicons32'] = "../../Frameworks/moduleclasses/icons/32"; // Local icons -$modversion['modicons16'] = XOOPS_URL . '/modules/'.$dirname.'/assets/images/icons/16'; -$modversion['modicons32'] = XOOPS_URL . '/modules/'.$dirname.'/assets/images/icons/32'; +$modversion['modicons16'] = XOOPS_URL . "/modules/{$dirname}/assets/images/icons/16"; +$modversion['modicons32'] = XOOPS_URL . "/modules/{$dirname}/assets/images/icons/32"; $modversion['targetdir'] = XOOPS_ROOT_PATH . "/modules/{$dirname}/modules/"; -$modversion['release_date'] = '2014/02/07'; +$modversion['release_date'] = "2014/02/07"; $modversion['module_website_url'] = "http://www.xoops.org/"; $modversion['module_website_name'] = "XOOPS"; $modversion['module_status'] = "Alpha 1"; @@ -59,8 +59,8 @@ //about $modversion['demo_site_url'] = "http://www.xoops.org/"; $modversion['demo_site_name'] = "Xoops TDM"; -$modversion['forum_site_url'] = "http://xoops.org/modules/newbb/viewtopic.php?post_id=352671"; -$modversion['forum_site_name'] = "TDMCreate - testers needed"; +$modversion['forum_site_url'] = "http://xoops.org/modules/newbb/viewtopic.php?post_id=358118"; +$modversion['forum_site_name'] = "TDMCreate 1.91 alpha 1 for Testing"; $modversion['module_website_name'] = "Xoops TDM"; // Admin things $modversion['system_menu'] = 1; |
From: <txm...@us...> - 2014-07-10 18:14:22
|
Revision: 12693 http://sourceforge.net/p/xoops/svn/12693 Author: txmodxoops Date: 2014-07-10 18:14:17 +0000 (Thu, 10 Jul 2014) Log Message: ----------- - Fixed bugs - Updated - Still work to do Modified Paths: -------------- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/menu.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/architecture.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/xoops_version.php Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/menu.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/menu.php 2014-07-09 18:25:13 UTC (rev 12692) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/menu.php 2014-07-10 18:14:17 UTC (rev 12693) @@ -130,7 +130,7 @@ $content .= <<<EOT \$adminmenu[\$i]['title'] = {$language}{$menu}; \$adminmenu[\$i]['link'] = 'admin/{$tables[$t]->getVar('table_name')}.php'; -\$adminmenu[\$i]['icon'] = \$sysPathIcon32.'/{$tables[$t]->getVar('table_image')}';\n +\$adminmenu[\$i]['icon'] = 'assets/images/icons/32/{$tables[$t]->getVar('table_image')}';\n EOT; //$content .= $this->getAdminMenuImagesPath($tables, $t); $content .= <<<EOT Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/architecture.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/architecture.php 2014-07-09 18:25:13 UTC (rev 12692) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/architecture.php 2014-07-10 18:14:17 UTC (rev 12693) @@ -106,7 +106,7 @@ $stlModuleAuthor = str_replace(' ', '', strtolower($module->getVar('mod_author'))); // Creation of the Directory in repository $targetDirectory = $this->uploadPath.'/repository/'. $stlModuleDirname; - $uploadImagesFolder = $this->uploadPath.'/images/repository'; + $uploadImagesRepository = $this->uploadPath.'/images/repository'; // Creation of "module" folder $this->structure->getPath($targetDirectory); // Creation of "module" folder @@ -133,7 +133,7 @@ $this->structure->makeDirAndCopyFile('assets/images', $indexFile, 'index.html'); //Copy the logo of the module $modImage = str_replace(' ', '', strtolower($module->getVar('mod_image'))); - $this->structure->copyFile('assets/images', $uploadImagesFolder.'/'.$modImage, $modImage); + $this->structure->copyFile('assets/images', $uploadImagesRepository.'/'.$modImage, $modImage); // Creation of 'images/icons' folder and index.html file - Added in Version 1.15 $this->structure->makeDirAndCopyFile('assets/images/icons', $indexFile, 'index.html'); // Creation of "images/icons/16" folder and index.html file @@ -141,7 +141,7 @@ // Creation of "images/icons/32" folder and index.html file $this->structure->makeDirAndCopyFile('assets/images/icons/32', $indexFile, 'index.html'); // Copy of 'module_author_logo.gif' file in uploads dir - $logoGifFrom = $uploadImagesFolder.'/'.$stlModuleAuthor.'_logo.gif'; + $logoGifFrom = $uploadImagesRepository.'/'.$stlModuleAuthor.'_logo.gif'; if (!file_exists($logoGifFrom)) { copy($logosFolder.'/'.$stlModuleAuthor.'_logo.gif', $logoGifFrom); } @@ -203,6 +203,7 @@ $modId = $module->getVar('mod_id'); $moduleDirname = $module->getVar('mod_dirname'); $uploadTablesIcons32 = $this->uploadPath.'/images/tables'; + $framePathIcon32 = XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32'; // Id of tables $criteriaTables = new CriteriaCompo(); $criteriaTables->add(new Criteria('table_mid', $modId)); @@ -227,9 +228,11 @@ // Get Table Object $table = $this->tdmcreate->getHandler('tables')->get($tableId); // Copy of tables images file - if( file_exists($uploadTableImage = $uploadTablesIcons32.'/'.$tableImage)) { + if( file_exists($uploadTableImage = $uploadTablesIcons32.'/'.$tableImage )) { $this->structure->copyFile('assets/images/icons/32', $uploadTableImage, $tableImage); - } + } elseif( file_exists($uploadTableImage = $framePathIcon32.'/'.$tableImage )) { + $this->structure->copyFile('assets/images/icons/32', $uploadTableImage, $tableImage); + } // Creation of admin files if ( $tableAdmin == 1) { // Admin Pages File Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/xoops_version.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/xoops_version.php 2014-07-09 18:25:13 UTC (rev 12692) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/xoops_version.php 2014-07-10 18:14:17 UTC (rev 12693) @@ -21,7 +21,7 @@ if (!defined('XOOPS_ROOT_PATH')){ exit(); } $dirname = basename( dirname( __FILE__ ) ) ; -$modversion['name'] = "{$dirname}"; +$modversion['name'] = _MI_TDMCREATE_NAME; $modversion['version'] = 1.91; $modversion['description'] = _MI_TDMCREATE_DESC; $modversion['author'] = "Xoops TDM"; |
From: <txm...@us...> - 2014-07-10 19:07:36
|
Revision: 12697 http://sourceforge.net/p/xoops/svn/12697 Author: txmodxoops Date: 2014-07-10 19:07:25 +0000 (Thu, 10 Jul 2014) Log Message: ----------- After renamed main folder, updated revision Modified Paths: -------------- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/fields.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/menu.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/objects.php 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/blocks.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/classes.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/formelements.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/htmlsmartycodes.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/pages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/pages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/objects.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/pages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/xoopsversion.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/docs/changelog.txt XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/language/english/admin.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/xoops_version.php Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/fields.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/fields.php 2014-07-10 18:47:00 UTC (rev 12696) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/fields.php 2014-07-10 19:07:25 UTC (rev 12697) @@ -158,7 +158,7 @@ if ( !$GLOBALS['xoopsSecurity']->check() ) { redirect_header('fields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } - $field_id = XoopsRequest::getInt('field_id'); + $fieldId = XoopsRequest::getInt('field_id'); // Fields Handler $fields = $tdmcreate->getHandler('fields'); // Set Variables @@ -213,9 +213,9 @@ if (!$tdmcreate->getHandler('fieldelements')->insert($fieldelementObj) ) { $GLOBALS['xoopsTpl']->assign('error', $fieldelementObj->getHtmlErrors() . ' Field element'); } - redirect_header('fields.php', 2, sprintf(_AM_TDMCREATE_FIELD_FORM_SAVED_OK, $table_name)); + redirect_header('fields.php', 2, sprintf(_AM_TDMCREATE_FIELDS_FORM_SAVED_OK, $table_name)); } else { - redirect_header('fields.php', 2, sprintf(_AM_TDMCREATE_FIELD_FORM_UPDATED_OK, $table_name)); + redirect_header('fields.php', 2, sprintf(_AM_TDMCREATE_FIELDS_FORM_UPDATED_OK, $table_name)); } // $GLOBALS['xoopsTpl']->assign('error', $fieldsObj->getHtmlErrors()); @@ -232,8 +232,8 @@ $adminMenu->addItemButton(_AM_TDMCREATE_FIELDS_LIST, 'fields.php', 'list'); $GLOBALS['xoopsTpl']->assign('buttons', $adminMenu->renderButton()); // Form Edit - $field_id = XoopsRequest::getInt('field_id'); - $fieldsObj = $tdmcreate->getHandler('fields')->get( $field_id ); + $fieldId = XoopsRequest::getInt('field_id'); + $fieldsObj = $tdmcreate->getHandler('fields')->get( $fieldId ); $form = $fieldsObj->getFormEdit($field_mid, $fieldTid); $GLOBALS['xoopsTpl']->assign('form', $form->render()); // Test -> Will be removed @@ -242,9 +242,9 @@ case 'drag': $side = TDMCreate_CleanVars( $_POST, 'field_id', 0, 'int' ); - $field_id = XoopsRequest::getInt('field_id'); - if ( $field_id > 0 ) { - $fieldsObj = $tdmcreate->getHandler('fields')->get( $field_id ); + $fieldId = XoopsRequest::getInt('field_id'); + if ( $fieldId > 0 ) { + $fieldsObj = $tdmcreate->getHandler('fields')->get( $fieldId ); $fieldsObj->setVar('field_id', $side); if (!$tdmcreate->getHandler('fields')->insert( $fieldsObj )) { redirect_header('fields.php', 5, _AM_TDMCREATE_FIELD_SIDE_ERROR); @@ -271,11 +271,12 @@ break; case 'display': + $fieldId = XoopsRequest::getInt('field_id'); // Get the list of fields $criteria = new CriteriaCompo(); $criteria->add(new Criteria('field_tid', $fieldTid)); $fields = $tdmcreate->getHandler('fields')->getObjects($criteria); - $fieldsObj =& $tdmcreate->getHandler('fields')->get($field_id); + $fieldsObj =& $tdmcreate->getHandler('fields')->get($fieldId); if (isset($_GET['field_tid'])) { if (isset($_GET['field_parent'])) { foreach ($fields as $field) { Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/menu.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/menu.php 2014-07-10 18:47:00 UTC (rev 12696) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/menu.php 2014-07-10 19:07:25 UTC (rev 12697) @@ -130,7 +130,7 @@ $content .= <<<EOT \$adminmenu[\$i]['title'] = {$language}{$menu}; \$adminmenu[\$i]['link'] = 'admin/{$tables[$t]->getVar('table_name')}.php'; -\$adminmenu[\$i]['icon'] = \$sysPathIcon32.'/{$tables[$t]->getVar('table_image')}';\n +\$adminmenu[\$i]['icon'] = 'assets/images/icons/32/{$tables[$t]->getVar('table_image')}';\n EOT; //$content .= $this->getAdminMenuImagesPath($tables, $t); $content .= <<<EOT Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/objects.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/objects.php 2014-07-10 18:47:00 UTC (rev 12696) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/objects.php 2014-07-10 19:07:25 UTC (rev 12697) @@ -47,11 +47,11 @@ return $ret; } /* - * @public function getTextDateSelect + * @public function getTextDateSelectSetVar * @param string $tableName * @param string $fieldName */ - public function getTextDateSelect($tableName, $fieldName) { + public function getTextDateSelectSetVar($tableName, $fieldName) { $ret = <<<EOT // Set Var {$fieldName} \${$tableName}Obj->setVar('{$fieldName}', strtotime(\$_POST['{$fieldName}']));\n @@ -59,11 +59,11 @@ return $ret; } /* - * @public function getCheckBoxOrRadioYN + * @public function getCheckBoxOrRadioYNSetVar * @param string $tableName * @param string $fieldName */ - public function getCheckBoxOrRadioYN($tableName, $fieldName) { + public function getCheckBoxOrRadioYNSetVar($tableName, $fieldName) { $ret = <<<EOT // Set Var {$fieldName} \${$tableName}Obj->setVar('{$fieldName}', ((\$_REQUEST['{$fieldName}'] == 1) ? '1' : '0'));\n @@ -71,12 +71,12 @@ return $ret; } /* - * @public function getImageList + * @public function getImageListSetVar * @param string $moduleDirname * @param string $tableName * @param string $fieldName */ - public function getImageList($moduleDirname, $tableName, $fieldName) { + public function getImageListSetVar($moduleDirname, $tableName, $fieldName) { $ret = <<<EOT // Set Var {$fieldName} include_once XOOPS_ROOT_PATH.'/class/uploader.php'; @@ -99,12 +99,12 @@ return $ret; } /* - * @public function getUploadImage + * @public function getUploadImageSetVar * @param string $moduleDirname * @param string $tableName * @param string $fieldName */ - public function getUploadImage($moduleDirname, $tableName, $fieldName) { + public function getUploadImageSetVar($moduleDirname, $tableName, $fieldName) { $stuModuleDirname = strtoupper($moduleDirname); $ret = <<<EOT // Set Var {$fieldName} @@ -128,12 +128,12 @@ return $ret; } /* - * @public function getUploadFile + * @public function getUploadFileSetVar * @param string $moduleDirname * @param string $tableName * @param string $fieldName */ - public function getUploadFile($moduleDirname, $tableName, $fieldName) { + public function getUploadFileSetVar($moduleDirname, $tableName, $fieldName) { $stuModuleDirname = strtoupper($moduleDirname); $ret = <<<EOT // Set Var {$fieldName} @@ -153,5 +153,61 @@ }\n EOT; return $ret; - } + } + /* + * @public function getSimpleGetVar + * @param string $lpFieldName + * @param string $rpFieldName + * @param string $tableName + * @param string $fieldName + */ + public function getSimpleGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { + $ret = <<<EOT +\t\t\t\t// Get Var {$fieldName} +\t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = \${$tableName}_arr[\$i]->getVar('{$fieldName}');\n +EOT; + return $ret; + } + /* + * @public function getTextAreaGetVar + * @param string $lpFieldName + * @param string $rpFieldName + * @param string $tableName + * @param string $fieldName + */ + public function getTextAreaGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { + $ret = <<<EOT +\t\t\t\t// Get Var {$fieldName} +\t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = strip_tags(\${$tableName}_arr[\$i]->getVar('{$fieldName}'));\n +EOT; + return $ret; + } + /* + * @public function getSelectUserGetVar + * @param string $lpFieldName + * @param string $rpFieldName + * @param string $tableName + * @param string $fieldName + */ + public function getSelectUserGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { + $ret = <<<EOT +\t\t\t\t// Get Var {$fieldName} +\t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = XoopsUser::getUnameFromId(\${$tableName}_arr[\$i]->getVar('{$fieldName}'), 's');\n +EOT; + return $ret; + } + /* + * @public function getTextDateSelectGetVar + * @param string $lpFieldName + * @param string $rpFieldName + * @param string $tableName + * @param string $fieldName + */ + public function getTextDateSelectGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { + $ret = <<<EOT +\t\t\t\t// Get Var {$fieldName} +\t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = formatTimeStamp(\${$tableName}_arr[\$i]->getVar('{$fieldName}'), 's');\n +EOT; + return $ret; + } } \ No newline at end of file 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-07-10 18:47:00 UTC (rev 12696) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/pages.php 2014-07-10 19:07:25 UTC (rev 12697) @@ -16,7 +16,7 @@ * @package tdmcreate * @since 2.5.0 * @author Txmod Xoops http://www.txmodxoops.org - * @version $Id: admin_pages.php 12258 2014-01-02 09:33:29Z timgno $ + * @version $Id: pages.php 12258 2014-01-02 09:33:29Z timgno $ */ defined('XOOPS_ROOT_PATH') or die('Restricted access'); require_once 'objects.php'; @@ -61,12 +61,14 @@ * @param string $moduleDirname * @param string $tableName */ - public function getAdminPagesHeader($moduleDirname, $tableName) { + public function getAdminPagesHeader($moduleDirname, $tableName, $fpif) { $ret = <<<EOT include_once 'header.php'; //It recovered the value of argument op in URL$ -\$op = {$moduleDirname}_CleanVars(\$_REQUEST, 'op', 'list', 'string'); +\$op = XoopsRequest::getString('op', 'list'); +// Request {$fpif} +\${$fpif} = XoopsRequest::getInt('{$fpif}'); // Switch options switch (\$op) {\n @@ -84,18 +86,18 @@ * @param string $fpif * @param string $fpmf */ - public function getAdminPagesList($moduleDirname, $tableName, $tableFieldname, $language, $fields, $fpif, $fpmf) { - $stu_module_dirname = strtoupper($moduleDirname); - $stu_table_name = strtoupper($tableName); - $stu_table_fieldname = strtoupper($tableFieldname); + public function getAdminPagesList($moduleDirname, $tableName, $tableFieldname, $tableAutoincrement, $language, $fields, $fpif, $fpmf) { + $stuModuleDirname = strtoupper($moduleDirname); + $stuTableName = strtoupper($tableName); + $stuTableFieldname = strtoupper($tableFieldname); $ret = <<<EOT case 'list': default: - \$limit = \${$moduleDirname}->getConfig('adminpager'); - \$start = {$moduleDirname}_CleanVars(\$_REQUEST, 'start', 0); + \$start = XoopsRequest::getInt('start', 0); + \$limit = XoopsRequest::getInt('limit', \${$moduleDirname}->getConfig('adminpager')); \$template_main = '{$moduleDirname}_admin_{$tableName}.tpl'; \$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('{$tableName}.php')); - \$adminMenu->addItemButton({$language}ADD_{$stu_table_fieldname}, '{$tableName}.php?op=new', 'add'); + \$adminMenu->addItemButton({$language}ADD_{$stuTableFieldname}, '{$tableName}.php?op=new', 'add'); \$GLOBALS['xoopsTpl']->assign('buttons', \$adminMenu->renderButton()); \$criteria = new CriteriaCompo(); \$criteria->setSort('{$fpif} ASC, {$fpmf}'); @@ -103,8 +105,8 @@ \${$tableName}_rows = \${$tableName}Handler->getCount(\$criteria); \${$tableName}_arr = \${$tableName}Handler->getAll(\$criteria); unset(\$criteria); - \$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_url', {$stu_module_dirname}_URL); - \$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_upload_url', {$stu_module_dirname}_UPLOAD_URL); + \$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_url', {$stuModuleDirname}_URL); + \$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_upload_url', {$stuModuleDirname}_UPLOAD_URL); // Table view if (\${$tableName}_rows > 0) { @@ -114,29 +116,37 @@ foreach(array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); - $rp_field_name = $fieldName; + $rpFieldName = $fieldName; // Verify if table_fieldname is not empty - if(!empty($tableFieldname)) { - if(strpos($fieldName, '_')) { - $str = strpos($fieldName, '_'); - if($str !== false){ - $rp_field_name = substr($fieldName, $str + 1, strlen($fieldName)); - } - } - $lp_field_name = substr($fieldName, 0, strpos($fieldName, '_')); - $ret .= <<<EOT - \${$lp_field_name}['{$rp_field_name}'] = \${$tableName}_arr[\$i]->getVar('{$fieldName}');\n -EOT; - } else { - $lp_field_name = $tableName; - $ret .= <<<EOT - \${$lp_field_name}['{$rp_field_name}'] = \${$tableName}_arr[\$i]->getVar('{$fieldName}');\n -EOT; + $lpFieldName = !empty($tableFieldname) ? substr($fieldName, 0, strpos($fieldName, '_')) : $tableName; + if(strpos($fieldName, '_')) { + $str = strpos($fieldName, '_'); + if($str !== false){ + $rpFieldName = substr($fieldName, $str + 1, strlen($fieldName)); + } + } + $fieldElement = $fields[$f]->getVar('field_element'); + if( ($fields[$f]->getVar('field_admin') == 1) || ($tableAutoincrement == 1) ) { + switch($fieldElement) { + case 2: + case 3: + $ret .= $this->adminobjects->getTextAreaGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); + break; + case 7: + $ret .= $this->adminobjects->getSelectUserGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); + break; + case 12: + $ret .= $this->adminobjects->getTextDateSelectGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); + break; + default: + $ret .= $this->adminobjects->getSimpleGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); + break; + } } } $ret .= <<<EOT - \$GLOBALS['xoopsTpl']->append('{$tableName}_list', \${$lp_field_name}); - unset(\${$lp_field_name}); + \$GLOBALS['xoopsTpl']->append('{$tableName}_list', \${$lpFieldName}); + unset(\${$lpFieldName}); }\n EOT; $ret .= <<<EOT @@ -146,7 +156,7 @@ \$GLOBALS['xoopsTpl']->assign('pagenav', \$pagenav->renderNav(4)); } } else { - \$GLOBALS['xoopsTpl']->assign('error', {$language}THEREARENT_{$stu_table_name}); + \$GLOBALS['xoopsTpl']->assign('error', {$language}THEREARENT_{$stuTableName}); } break;\n EOT; @@ -160,11 +170,11 @@ * @param string $language */ public function getAdminPagesNew($moduleDirname, $tableName, $language) { - $stu_table_name = strtoupper($tableName); + $stuTableName = strtoupper($tableName); $ret = <<<EOT case 'new': \$template_main = '{$moduleDirname}_admin_{$tableName}.tpl'; - \$adminMenu->addItemButton({$language}{$stu_table_name}_LIST, '{$tableName}.php', 'list'); + \$adminMenu->addItemButton({$language}{$stuTableName}_LIST, '{$tableName}.php', 'list'); \$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('{$tableName}.php')); \$GLOBALS['xoopsTpl']->assign('buttons', \$adminMenu->renderButton()); // Get Form @@ -192,8 +202,8 @@ if ( !\$GLOBALS['xoopsSecurity']->check() ) { redirect_header('{$tableName}.php', 3, implode(',', \$GLOBALS['xoopsSecurity']->getErrors())); } - if (isset(\$_REQUEST['{$fpif}'])) { - \${$tableName}Obj =& \${$tableName}Handler->get(\$_REQUEST['{$fpif}']); + if (isset(\${$fpif})) { + \${$tableName}Obj =& \${$tableName}Handler->get(\${$fpif}); } else { \${$tableName}Obj =& \${$tableName}Handler->create(); } @@ -207,19 +217,19 @@ switch($fieldElement) { case 4: case 5: - $ret .= $this->adminobjects->getCheckBoxOrRadioYN($tableName, $fieldName); + $ret .= $this->adminobjects->getCheckBoxOrRadioYNSetVar($tableName, $fieldName); break; case 9: - $ret .= $this->adminobjects->getImageList($moduleDirname, $tableName, $fieldName); + $ret .= $this->adminobjects->getImageListSetVar($moduleDirname, $tableName, $fieldName); break; case 10: - $ret .= $this->adminobjects->getUploadImage($moduleDirname, $tableName, $fieldName); + $ret .= $this->adminobjects->getUploadImageSetVar($moduleDirname, $tableName, $fieldName); break; case 11: - $ret .= $this->adminobjects->getUploadFile($moduleDirname, $tableName, $fieldName); + $ret .= $this->adminobjects->getUploadFileSetVar($moduleDirname, $tableName, $fieldName); break; case 12: - $ret .= $this->adminobjects->getTextDateSelect($tableName, $fieldName); + $ret .= $this->adminobjects->getTextDateSelectSetVar($tableName, $fieldName); break; default: $ret .= $this->adminobjects->getSimpleSetVar($tableName, $fieldName); @@ -251,17 +261,17 @@ * @param string $fpif */ public function getAdminPagesEdit($moduleDirname, $tableName, $tableFieldname, $language, $fpif) { - $stu_table_name = strtoupper($tableName); - $stu_table_fieldname = strtoupper($tableFieldname); + $stuTableName = strtoupper($tableName); + $stuTableFieldname = strtoupper($tableFieldname); $ret = <<<EOT case 'edit': \$template_main = '{$moduleDirname}_admin_{$tableName}.tpl'; - \$adminMenu->addItemButton({$language}ADD_{$stu_table_fieldname}, '{$tableName}.php?op=new', 'add'); - \$adminMenu->addItemButton({$language}{$stu_table_name}_LIST, '{$tableName}.php', 'list'); + \$adminMenu->addItemButton({$language}ADD_{$stuTableFieldname}, '{$tableName}.php?op=new', 'add'); + \$adminMenu->addItemButton({$language}{$stuTableName}_LIST, '{$tableName}.php', 'list'); \$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('{$tableName}.php')); \$GLOBALS['xoopsTpl']->assign('buttons', \$adminMenu->renderButton()); // Get Form - \${$tableName}Obj = \${$tableName}Handler->get(\$_REQUEST['{$fpif}']); + \${$tableName}Obj = \${$tableName}Handler->get(\${$fpif}); \$form = \${$tableName}Obj->getForm(); \$GLOBALS['xoopsTpl']->assign('form', \$form->render()); break;\n @@ -278,7 +288,7 @@ $ret = <<<EOT case 'delete': - \${$tableName}Obj =& \${$tableName}Handler->get(\$_REQUEST['{$fpif}']); + \${$tableName}Obj =& \${$tableName}Handler->get(\${$fpif}); if (isset(\$_REQUEST['ok']) && \$_REQUEST['ok'] == 1) { if ( !\$GLOBALS['xoopsSecurity']->check() ) { redirect_header('{$tableName}.php', 3, implode(', ', \$GLOBALS['xoopsSecurity']->getErrors())); @@ -289,7 +299,7 @@ echo \${$tableName}Obj->getHtmlErrors(); } } else { - xoops_confirm(array('ok' => 1, '{$fpif}' => \$_REQUEST['{$fpif}'], 'op' => 'delete'), \$_SERVER['REQUEST_URI'], sprintf({$language}FORMSUREDEL, \${$tableName}Obj->getVar('{$fpmf}'))); + xoops_confirm(array('ok' => 1, '{$fpif}' => \${$fpif}, 'op' => 'delete'), \$_SERVER['REQUEST_URI'], sprintf({$language}FORMSUREDEL, \${$tableName}Obj->getVar('{$fpmf}'))); } break;\n EOT; @@ -318,7 +328,8 @@ $table = $this->getTable(); $moduleDirname = $module->getVar('mod_dirname'); $tableName = $table->getVar('table_name'); - $tableFieldname = $table->getVar('table_fieldname'); + $tableFieldname = $table->getVar('table_fieldname'); + $tableAutoincrement = $table->getVar('table_autoincrement'); $language = $this->getLanguage($moduleDirname, 'AM'); $fields = $this->getTableFields($table->getVar('table_id')); foreach(array_keys($fields) as $f) @@ -332,8 +343,8 @@ } } $content = $this->getHeaderFilesComments($module, $filename); - $content .= $this->getAdminPagesHeader($moduleDirname, $tableName); - $content .= $this->getAdminPagesList($moduleDirname, $tableName, $tableFieldname, $language, $fields, $fpif, $fpmf); + $content .= $this->getAdminPagesHeader($moduleDirname, $tableName, $fpif); + $content .= $this->getAdminPagesList($moduleDirname, $tableName, $tableFieldname, $tableAutoincrement, $language, $fields, $fpif, $fpmf); $content .= $this->getAdminPagesNew($moduleDirname, $tableName, $language); $content .= $this->getAdminPagesSave($moduleDirname, $tableName, $language, $fields, $fpif, $fpmf); $content .= $this->getAdminPagesEdit($moduleDirname, $tableName, $tableFieldname, $language, $fpif); Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/architecture.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/architecture.php 2014-07-10 18:47:00 UTC (rev 12696) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/architecture.php 2014-07-10 19:07:25 UTC (rev 12697) @@ -106,7 +106,7 @@ $stlModuleAuthor = str_replace(' ', '', strtolower($module->getVar('mod_author'))); // Creation of the Directory in repository $targetDirectory = $this->uploadPath.'/repository/'. $stlModuleDirname; - $uploadImagesFolder = $this->uploadPath.'/images/repository'; + $uploadImagesRepository = $this->uploadPath.'/images/repository'; // Creation of "module" folder $this->structure->getPath($targetDirectory); // Creation of "module" folder @@ -133,7 +133,7 @@ $this->structure->makeDirAndCopyFile('assets/images', $indexFile, 'index.html'); //Copy the logo of the module $modImage = str_replace(' ', '', strtolower($module->getVar('mod_image'))); - $this->structure->copyFile('assets/images', $uploadImagesFolder.'/'.$modImage, $modImage); + $this->structure->copyFile('assets/images', $uploadImagesRepository.'/'.$modImage, $modImage); // Creation of 'images/icons' folder and index.html file - Added in Version 1.15 $this->structure->makeDirAndCopyFile('assets/images/icons', $indexFile, 'index.html'); // Creation of "images/icons/16" folder and index.html file @@ -141,7 +141,7 @@ // Creation of "images/icons/32" folder and index.html file $this->structure->makeDirAndCopyFile('assets/images/icons/32', $indexFile, 'index.html'); // Copy of 'module_author_logo.gif' file in uploads dir - $logoGifFrom = $uploadImagesFolder.'/'.$stlModuleAuthor.'_logo.gif'; + $logoGifFrom = $uploadImagesRepository.'/'.$stlModuleAuthor.'_logo.gif'; if (!file_exists($logoGifFrom)) { copy($logosFolder.'/'.$stlModuleAuthor.'_logo.gif', $logoGifFrom); } @@ -203,6 +203,7 @@ $modId = $module->getVar('mod_id'); $moduleDirname = $module->getVar('mod_dirname'); $uploadTablesIcons32 = $this->uploadPath.'/images/tables'; + $framePathIcon32 = XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32'; // Id of tables $criteriaTables = new CriteriaCompo(); $criteriaTables->add(new Criteria('table_mid', $modId)); @@ -227,9 +228,11 @@ // Get Table Object $table = $this->tdmcreate->getHandler('tables')->get($tableId); // Copy of tables images file - if( file_exists($uploadTableImage = $uploadTablesIcons32.'/'.$tableImage)) { + if( file_exists($uploadTableImage = $uploadTablesIcons32.'/'.$tableImage )) { $this->structure->copyFile('assets/images/icons/32', $uploadTableImage, $tableImage); - } + } elseif( file_exists($uploadTableImage = $framePathIcon32.'/'.$tableImage )) { + $this->structure->copyFile('assets/images/icons/32', $uploadTableImage, $tableImage); + } // Creation of admin files if ( $tableAdmin == 1) { // Admin Pages File Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/blocks/blocks.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/blocks/blocks.php 2014-07-10 18:47:00 UTC (rev 12696) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/blocks/blocks.php 2014-07-10 19:07:25 UTC (rev 12697) @@ -101,23 +101,25 @@ { $fieldName = $fields[$f]->getVar('field_name'); $rp_field_name = $fieldName; - // Verify if table_fieldname is not empty - if(!empty($tableFieldname)) { - if(strpos($fieldName, '_')) { - $str = strpos($fieldName, '_'); - if($str !== false){ - $rp_field_name = substr($fieldName, $str + 1, strlen($fieldName)); - } - } - $tname = $tableFieldname; - $ret .= <<<EOT + if( $fields[$f]->getVar('field_block') == 1 ) { + // Verify if table_fieldname is not empty + if(!empty($tableFieldname)) { + if(strpos($fieldName, '_')) { + $str = strpos($fieldName, '_'); + if($str !== false){ + $rp_field_name = substr($fieldName, $str + 1, strlen($fieldName)); + } + } + $tname = $tableFieldname; + $ret .= <<<EOT \${$tname}['{$rp_field_name}'] = \${$tableName}_arr[\$i]->getVar('{$fieldName}');\n EOT; - } else { - $tname = $tableName; - $ret .= <<<EOT + } else { + $tname = $tableName; + $ret .= <<<EOT \${$tname}['{$rp_field_name}'] = \${$tableName}_arr[\$i]->getVar('{$fieldName}');\n EOT; + } } } $ret .= <<<EOT Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/classes.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/classes.php 2014-07-10 18:47:00 UTC (rev 12696) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/classes.php 2014-07-10 19:07:25 UTC (rev 12697) @@ -178,8 +178,10 @@ private function getHeadFunctionForm($module, $table) { $moduleDirname = $module->getVar('mod_dirname'); + $tableName = $table->getVar('table_name'); + $ucfTableName = ucfirst($tableName); + $stuTableName = strtoupper($tableName); $language = $this->getLanguage($moduleDirname, 'AM'); - $stu_table_name = strtoupper($table->getVar('table_name')); $this->formelements->initForm($module, $table); $ret = <<<EOT /* @@ -193,11 +195,13 @@ \$action = \$_SERVER['REQUEST_URI']; } // Title - \$title = \$this->isNew() ? sprintf({$language}{$stu_table_name}_ADD) : sprintf({$language}{$stu_table_name}_EDIT); + \$title = \$this->isNew() ? sprintf({$language}{$stuTableName}_ADD) : sprintf({$language}{$stuTableName}_EDIT); // Get Theme Form xoops_load('XoopsFormLoader'); \$form = new XoopsThemeForm(\$title, 'form', \$action, 'post', true); - \$form->setExtra('enctype="multipart/form-data"'); + \$form->setExtra('enctype="multipart/form-data"'); + // {$ucfTableName} handler + \${$tableName}Handler =& \$this->{$moduleDirname}->getHandler('{$tableName}'); {$this->formelements->renderElements()} EOT; return $ret; Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/formelements.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/formelements.php 2014-07-10 18:47:00 UTC (rev 12696) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/formelements.php 2014-07-10 19:07:25 UTC (rev 12697) @@ -223,7 +223,7 @@ // Form Select \${$fieldName}_select = new XoopsFormSelect({$language}, '{$fieldName}', \$this->getVar('{$fieldName}')); \${$fieldName}_select->addOption('Empty'); - \${$fieldName}_select->addOptionArray({$tableName}Handler->getList()); + \${$fieldName}_select->addOptionArray(\${$tableName}Handler->getList()); \$form->addElement( \${$fieldName}_select{$required} );\n EOT; return $ret; @@ -272,24 +272,30 @@ * @private function getXoopsFormTable * @param string $language * @param string $moduleDirname - * @param string $tableName + * @param string $table * @param string $fields * @param string $required */ private function getXoopsFormTable($language, $moduleDirname, $tableName, $fields, $required = 'false') { - $fieldName = ''; + $ucfTableName = ucfirst($tableName); foreach(array_keys($fields) as $f) { - if(($fields[$f]->getVar('field_parent') == 1)) { + if($fields[$f]->getVar('field_parent') == 1) { $fieldName = $fields[$f]->getVar('field_name'); - } - } + $field_element = $fields[$f]->getVar('field_element'); + if($field_element > 12) { + $fieldelement = $this->tdmcreate->getHandler('fieldelements')->get($field_element); + $fieldelementName = $fieldelement->getVar('fieldelement_name'); + $rpFieldelementName = strtolower(str_replace('Table : ', '', $fieldelementName)); + } + } + } $ret = <<<EOT - // Form Table - \${$tableName}Handler =& \$this->{$moduleDirname}->getHandler('{$tableName}'); + // Form Topic {$ucfTableName} + \${$rpFieldelementName}Handler =& \$this->{$moduleDirname}->getHandler('{$rpFieldelementName}'); \${$fieldName}_select = new XoopsFormSelect({$language}, '{$fieldName}', \$this->getVar('{$fieldName}')); - \${$fieldName}_select->addOptionArray(\${$fieldName}Handler->getList()); + \${$fieldName}_select->addOptionArray(\${$rpFieldelementName}Handler->getList()); \$form->addElement( \${$fieldName}_select{$required} );\n EOT; return $ret; @@ -298,14 +304,14 @@ * @private function getXoopsFormTopic * @param string $language * @param string $moduleDirname - * @param string $tableName + * @param string $table * @param string $fields * @param string $required */ private function getXoopsFormTopic($language, $moduleDirname, $table, $fields, $required = 'false') { $tableName = $table->getVar('table_name'); - $ucf_table_name = ucfirst($tableName); + $ucfTableName = ucfirst($tableName); foreach(array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); @@ -320,12 +326,12 @@ } } $ret = <<<EOT - // Form Topic {$ucf_table_name} - include_once(XOOPS_ROOT_PATH . '/class/tree.php'); - \${$tableName}Handler = \$this->{$moduleDirname}->getHandler('{$tableName}'); + // Form Topic {$ucfTableName} + //\${$tableName}Handler = \$this->{$moduleDirname}->getHandler('{$tableName}'); \$criteria = new CriteriaCompo(); \${$tableName} = \${$tableName}Handler->getObjects( \$criteria ); if(\${$tableName}) { + include_once(XOOPS_ROOT_PATH . '/class/tree.php'); \${$tableName}_tree = new XoopsObjectTree( \${$tableName}, '{$field_id}', '{$field_pid}' ); \${$field_pid} = \${$tableName}_tree->makeSelBox( '{$field_pid}', '{$field_main}', '--', \$this->getVar('{$field_pid}', 'e' ), true ); \$form->addElement( new XoopsFormLabel ( {$language}, \${$field_pid} ){$required} ); Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/htmlsmartycodes.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/htmlsmartycodes.php 2014-07-10 18:47:00 UTC (rev 12696) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/htmlsmartycodes.php 2014-07-10 19:07:25 UTC (rev 12697) @@ -121,7 +121,7 @@ return $ret; } /* - * @public function getHtmlTable + * @public function getHtmlTableThead * @param string $class * @param string $content */ @@ -134,7 +134,7 @@ return $ret; } /* - * @public function getHtmlTable + * @public function getHtmlTableTbody * @param string $class * @param string $content */ @@ -197,22 +197,33 @@ /* * @public function getSmartyConst * @param string $language - * @param mixed $field_name + * @param mixed $fieldName */ - public function getSmartyConst($language, $field_name) { + public function getSmartyConst($language, $fieldName) { $ret = <<<EOT - <{\$smarty.const.{$language}{$field_name}}> + <{\$smarty.const.{$language}{$fieldName}}> EOT; return $ret; } /* + * @public function getSmartyTableFieldNameEmptyData + * @param string $tableName + * @param string $fieldName + */ + public function getSmartyTableFieldNameEmptyData($tableName = '', $fieldName = '') { + $ret = <<<EOT + <{\${$tableName}.{$fieldName}}> +EOT; + return $ret; + } + /* * @public function getSmartyTableField - * @param string $table_fieldname - * @param string $field_name + * @param string $tableFieldname + * @param string $fieldName */ - public function getSmartyTableFieldData($table_fieldname = '', $fieldname = '') { + public function getSmartyTableFieldData($tableFieldname = '', $fieldName = '') { $ret = <<<EOT - <{\${$table_fieldname}.{$fieldname}}> + <{\${$tableFieldname}.{$fieldName}}> EOT; return $ret; } @@ -220,9 +231,9 @@ * @public function getSmartyIncludeFile * @param string $name */ - public function getSmartyIncludeFile($module_name, $fieldname = 'header') { + public function getSmartyIncludeFile($moduleDirname, $tableName = 'header') { $ret = <<<EOT - <{include file='db:{$module_name}_{$fieldname}.html'}> + <{include file='db:{$moduleDirname}_{$tableName}.html'}> EOT; return $ret; } Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/pages.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/pages.php 2014-07-10 18:47:00 UTC (rev 12696) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/pages.php 2014-07-10 19:07:25 UTC (rev 12697) @@ -54,11 +54,11 @@ /* * @private function getTemplatesAdminPagesHeader * @param string $moduleDirname - * @param string $table + * @param string $tableName + * @param string $fields * @param string $language */ - private function getTemplatesAdminPagesHeader($moduleDirname, $table, $language) { - $tableName = $table->getVar('table_name'); + private function getTemplatesAdminPagesHeader($moduleDirname, $tableName, $fields, $language) { $ret = <<<EOT <{include file="db:{$moduleDirname}_admin_header.tpl"}> <{if {$tableName}_list}> @@ -66,12 +66,11 @@ <thead> <tr class="head">\n EOT; - $fields = $this->getTableFields($table->getVar('table_id')); foreach(array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $lang_fn = $language.strtoupper($fieldName); - if( ($fields[$f]->getVar('field_inlist') == 1) || ($table->getVar('table_autoincrement') == 1) ) { + if( $fields[$f]->getVar('field_inlist') == 1 ) { $ret .= <<<EOT <th class="center"><{\$smarty.const.{$lang_fn}}></th>\n EOT; @@ -87,19 +86,17 @@ /* * @private function getTemplatesAdminPagesBody * @param string $moduleDirname - * @param string $table + * @param string $tableName + * @param string $fields * @param string $language */ - private function getTemplatesAdminPagesBody($moduleDirname, $table, $language) + private function getTemplatesAdminPagesBody($moduleDirname, $tableName, $fields, $language) { - $moduleDirname = strtolower($moduleDirname); - $tableName = $table->getVar('table_name'); $ret = <<<EOT <tbody> <{foreach item=list from=\${$tableName}_list}> <tr class="<{cycle values='odd, even'}>">\n EOT; - $fields = $this->getTableFields($table->getVar('table_id')); foreach(array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); @@ -121,7 +118,7 @@ } } $lp_field_name = substr($fieldName, 0, strpos($fieldName, '_')); - if( ($fields[$f]->getVar('field_inlist') == 1) || ($table->getVar('table_autoincrement') == 1) ) { + if( $fields[$f]->getVar('field_inlist') == 1 ) { switch( $fieldElement ) { case 8: $ret .= <<<EOT @@ -165,18 +162,17 @@ /* * @private function getTemplatesAdminPagesBodyFieldnameEmpty * @param string $moduleDirname - * @param string $table + * @param string $tableName + * @param string $fields * @param string $language */ - private function getTemplatesAdminPagesBodyFieldnameEmpty($moduleDirname, $table, $language) + private function getTemplatesAdminPagesBodyFieldnameEmpty($moduleDirname, $tableName, $fields, $language) { - $tableName = $table->getVar('table_name'); $ret = <<<EOT <tbody> <{foreach item=list from=\${$tableName}_list}> <tr class="<{cycle values='odd, even'}>">\n EOT; - $fields = $this->getTableFields($table->getVar('table_id')); foreach(array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); @@ -184,7 +180,7 @@ if($f == 0) { $field_id = $fieldName; } - if( ($fields[$f]->getVar('field_inlist') == 1) || ($table->getVar('table_autoincrement') == 1) ) { + if( $fields[$f]->getVar('field_inlist') == 1 ) { switch( $fieldElement ) { case 8: $ret .= <<<EOT @@ -262,13 +258,14 @@ $moduleDirname = $module->getVar('mod_dirname'); $tableName = $table->getVar('table_name'); $tableFieldname = $table->getVar('table_fieldname'); - $language = $this->getLanguage($moduleDirname, 'AM'); - $content = $this->getTemplatesAdminPagesHeader($moduleDirname, $table, $language); + $language = $this->getLanguage($moduleDirname, 'AM'); + $fields = $this->getTableFields($table->getVar('table_id')); + $content = $this->getTemplatesAdminPagesHeader($moduleDirname, $tableName, $fields, $language); // Verify if table_fieldname is not empty if(!empty($tableFieldname)) { - $content .= $this->getTemplatesAdminPagesBody($moduleDirname, $table, $language); + $content .= $this->getTemplatesAdminPagesBody($moduleDirname, $tableName, $fields, $language); } else { - $content .= $this->getTemplatesAdminPagesBodyFieldnameEmpty($moduleDirname, $table, $language); + $content .= $this->getTemplatesAdminPagesBodyFieldnameEmpty($moduleDirname, $tableName, $fields, $language); } $content .= $this->getTemplatesAdminPagesFooter($moduleDirname); // Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/pages.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/pages.php 2014-07-10 18:47:00 UTC (rev 12696) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/pages.php 2014-07-10 19:07:25 UTC (rev 12697) @@ -71,9 +71,11 @@ { $fieldName = $fields[$f]->getVar('field_name'); $lang_stu_field_name = $language.strtoupper($fieldName); - $ret .= <<<EOT + if( $fields[$f]->getVar('field_user') == 1 ) { + $ret .= <<<EOT <th class="center"><{\$smarty.const.{$lang_stu_field_name}}></th>\n EOT; + } } $ret .= <<<EOT </tr> @@ -107,27 +109,29 @@ $rp_field_name = substr($fieldName, $str + 1, strlen($fieldName)); } } - switch( $field_element ) { - case 8: - $ret .= <<<EOT + if( $fields[$f]->getVar('field_user') == 1 ) { + switch( $field_element ) { + case 8: + $ret .= <<<EOT <td class="center"><span style="background-color: <{\$list.{$rp_field_name}}>;">\t\t</span></td>\n EOT; - break; - case 9: - $ret .= <<<EOT + break; + case 9: + $ret .= <<<EOT <td class="center"><img src="<{xoModuleIcons32}><{\$list.{$rp_field_name}}>" alt="{$tableName}"></td>\n EOT; - break; - case 10: - $ret .= <<<EOT + break; + case 10: + $ret .= <<<EOT <td class="center"><img src="<{\${$moduleDirname}_upload_url}>/images/{$tableName}/<{\$list.{$rp_field_name}}>" alt="{$tableName}"></td>\n EOT; - break; - default: - $ret .= <<<EOT + break; + default: + $ret .= <<<EOT <td class="center"><{\$list.{$rp_field_name}}></td>\n EOT; - break; + break; + } } } $ret .= <<<EOT @@ -157,23 +161,25 @@ { $fieldName = $fields[$f]->getVar('field_name'); $field_element = $fields[$f]->getVar('field_element'); - switch( $field_element ) { - case 8: - $ret .= <<<EOT + if( $fields[$f]->getVar('field_user') == 1 ) { + switch( $field_element ) { + case 8: + $ret .= <<<EOT <td class="center"><span style="background-color: <{\$list.{$fieldName}}>;"></span></td>\n EOT; - break; - case 9: - $ret .= <<<EOT + break; + case 9: + $ret .= <<<EOT <td class="center"><img src="<{\${$moduleDirname}_upload_url}>/images/{$tableName}/<{\$list.{$fieldName}}>" alt="{$tableName}"></td>\n EOT; - break; - default: - $ret .= <<<EOT + break; + default: + $ret .= <<<EOT <td class="center"><{\$list.{$fieldName}}></td>\n EOT; - break; - } + break; + } + } } $ret .= <<<EOT </tr> Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/objects.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/objects.php 2014-07-10 18:47:00 UTC (rev 12696) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/objects.php 2014-07-10 19:07:25 UTC (rev 12697) @@ -35,11 +35,11 @@ return $instance; } /* - * @public function getPhpUserHeader + * @public function getUserHeader * @param string $moduleDirname * @param string $tableName */ - public function getPhpUserHeader($moduleDirname, $tableName) { + public function getUserHeader($moduleDirname, $tableName) { $ret = <<<EOT include_once 'header.php'; \$GLOBALS['xoopsOption']['template_main'] = '{$moduleDirname}_{$tableName}.tpl'; @@ -48,10 +48,10 @@ return $ret; } /* - * @public function getPhpUserIndex + * @public function getUserIndex * @param string $moduleDirname */ - public function getPhpUserIndex($moduleDirname) { + public function getUserIndex($moduleDirname) { $ret = <<<EOT include_once 'header.php'; \$GLOBALS['xoopsOption']['template_main'] = '{$moduleDirname}_index.tpl'; @@ -60,13 +60,69 @@ return $ret; } /* - * @public function getPhpUserFooter + * @public function getUserFooter * @param null */ - public function getPhpUserFooter() { + public function getUserFooter() { $ret = <<<EOT include_once 'footer.php'; EOT; return $ret; - } + } + /* + * @public function getSimpleGetVar + * @param string $lpFieldName + * @param string $rpFieldName + * @param string $tableName + * @param string $fieldName + */ + public function getSimpleGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { + $ret = <<<EOT +\t\t\t// Get Var {$fieldName} +\t\t\t\${$lpFieldName}['{$rpFieldName}'] = \${$tableName}_arr[\$i]->getVar('{$fieldName}');\n +EOT; + return $ret; + } + /* + * @public function getTextAreaGetVar + * @param string $lpFieldName + * @param string $rpFieldName + * @param string $tableName + * @param string $fieldName + */ + public function getTextAreaGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { + $ret = <<<EOT +\t\t\t// Get Var {$fieldName} +\t\t\t\${$lpFieldName}['{$rpFieldName}'] = strip_tags(\${$tableName}_arr[\$i]->getVar('{$fieldName}'));\n +EOT; + return $ret; + } + /* + * @public function getSelectUserGetVar + * @param string $lpFieldName + * @param string $rpFieldName + * @param string $tableName + * @param string $fieldName + */ + public function getSelectUserGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { + $ret = <<<EOT +\t\t\t// Get Var {$fieldName} +\t\t\t\${$lpFieldName}['{$rpFieldName}'] = XoopsUser::getUnameFromId(\${$tableName}_arr[\$i]->getVar('{$fieldName}'), 's');\n +EOT; + return $ret; + } + /* + * @public function getTextDateSelectGetVar + * @param string $lpFieldName + * @param string $rpFieldName + * @param string $tableName + * @param string $fieldName + */ + public function getTextDateSelectGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { + $ret = <<<EOT +\t\t\t// Get Var {$fieldName} +\t\t\t\${$lpFieldName}['{$rpFieldName}'] = formatTimeStamp(\${$tableName}_arr[\$i]->getVar('{$fieldName}'), 's');\n +EOT; + return $ret; + } } \ No newline at end of file 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-07-10 18:47:00 UTC (rev 12696) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/pages.php 2014-07-10 19:07:25 UTC (rev 12697) @@ -16,19 +16,24 @@ * @package tdmcreate * @since 2.5.0 * @author Txmod Xoops http://www.txmodxoops.org - * @version $Id: user_pages.php 12258 2014-01-02 09:33:29Z timgno $ + * @version $Id: pages.php 12258 2014-01-02 09:33:29Z timgno $ */ defined('XOOPS_ROOT_PATH') or die('Restricted access'); - +require_once 'objects.php'; class UserPages extends TDMCreateFile { /* + * @var string + */ + private $userobjects = null; + /* * @public function constructor * @param null */ public function __construct() { parent::__construct(); - $this->tdmcfile = TDMCreateFile::getInstance(); + $this->tdmcfile = TDMCreateFile::getInstance(); + $this->userobjects = UserObjects::getInstance(); } /* * @static function &getInstance @@ -62,9 +67,10 @@ $table = $this->getTable(); $tableName = $table->getVar('table_name'); $tableFieldname = $table->getVar('table_fieldname'); - $stu_mod_name = strtoupper($moduleDirname); - $stu_table_name = strtoupper($tableName); - $stl_table_name = strtolower($tableName); + $tableAutoincrement = $table->getVar('table_autoincrement'); + $stuModuleDirname = strtoupper($moduleDirname); + $stuTableName = strtoupper($tableName); + $stlTableName = strtolower($tableName); $ret = <<<EOT \ninclude_once 'header.php'; \$GLOBALS['xoopsOption']['template_main'] = '{$moduleDirname}_{$tableName}.tpl'; @@ -74,16 +80,16 @@ // Define Stylesheet \$xoTheme->addStylesheet( \$style ); // Get Handler -\${$stl_table_name}Handler =& \${$moduleDirname}->getHandler('{$stl_table_name}'); +\${$stlTableName}Handler =& \${$moduleDirname}->getHandler('{$stlTableName}'); // -\$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_upload_url', {$stu_mod_name}_UPLOAD_URL); +\$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_upload_url', {$stuModuleDirname}_UPLOAD_URL); // \$criteria = new CriteriaCompo(); -\${$stl_table_name}_count = \${$stl_table_name}Handler->getCount(\$criteria); -\${$stl_table_name}_arr = \${$stl_table_name}Handler->getAll(\$criteria); +\${$stlTableName}_count = \${$stlTableName}Handler->getCount(\$criteria); +\${$stlTableName}_arr = \${$stlTableName}Handler->getAll(\$criteria); \$keywords = array(); -if (\${$stl_table_name}_count > 0) { - foreach (array_keys(\${$stl_table_name}_arr) as \$i) +if (\${$stlTableName}_count > 0) { + foreach (array_keys(\${$stlTableName}_arr) as \$i) {\n EOT; // Fields @@ -93,66 +99,54 @@ $fieldName = $fields[$f]->getVar('field_name'); $rp_field_name = $fieldName; // Verify if table_fieldname is not empty - if(!empty($tableFieldname)) { - if(strpos($fieldName, '_')) { - $str = strpos($fieldName, '_'); - if($str !== false){ - $rp_field_name = substr($fieldName, $str + 1, strlen($fieldName)); - } - } - $lp_field_name = substr($fieldName, 0, strpos($fieldName, '_')); - $tname = $lp_field_name; - $fieldElement = $fields[$f]->getVar('field_element'); - if ( $fields[$f]->getVar('field_main') == 1 ) { - $fpmf = $fieldName; // fpmf = fields parameters main field - } - // Verify if this is a textarea or dhtmltextarea - if ( $fieldElement == 2 || $fieldElement == 3 ) { - $ret .= <<<EOT - \${$tname}['{$rp_field_name}'] = strip_tags(\${$stl_table_name}_arr[\$i]->getVar('{$fieldName}'));\n -EOT; - } else { - $ret .= <<<EOT - \${$tname}['{$rp_field_name}'] = \${$stl_table_name}_arr[\$i]->getVar('{$fieldName}');\n -EOT; - } - } else { - $tname = $tableName; - $fieldElement = $fields[$f]->getVar('field_element'); - if ( $fields[$f]->getVar('field_main') == 1 ) { - $fpmf = $fieldName; // fpmf = fields parameters main field - } - // Verify if this is a textarea or dhtmltextarea - if ( $fieldElement == 2 || $fieldElement == 3 ) { - $ret .= <<<EOT - \${$tname}['{$rp_field_name}'] = strip_tags(\${$stl_table_name}_arr[\$i]->getVar('{$fieldName}'));\n -EOT; - } else { - $ret .= <<<EOT - \${$tname}['{$rp_field_name}'] = \${$stl_table_name}_arr[\$i]->getVar('{$fieldName}');\n -EOT; - } + $lpFieldName = !empty($tableFieldname) ? substr($fieldName, 0, strpos($fieldName, '_')) : $tableName; + if(strpos($fieldName, '_')) { + $str = strpos($fieldName, '_'); + if($str !== false){ + $rpFieldName = substr($fieldName, $str + 1, strlen($fieldName)); + } + } + if ( $fields[$f]->getVar('field_main') == 1 ) { + $fpmf = $fieldName; // fpmf = fields parameters main field } + $fieldElement = $fields[$f]->getVar('field_element'); + if( ($fields[$f]->getVar('field_user') == 1) || ($tableAutoincrement == 1) ) { + switch($fieldElement) { + case 2: + case 3: + $ret .= $this->userobjects->getTextAreaGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); + break; + case 7: + $ret .= $this->userobjects->getSelectUserGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); + break; + case 12: + $ret .= $this->userobjects->getTextDateSelectGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); + break; + default: + $ret .= $this->userobjects->getSimpleGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); + break; + } + } } $ret .= <<<EOT - \$GLOBALS['xoopsTpl']->append('{$stl_table_name}', \${$tname}); - \$keywords[] = \${$stl_table_name}_arr[\$i]->getVar('{$fpmf}'); - unset(\${$tname}); + \$GLOBALS['xoopsTpl']->append('{$stlTableName}', \${$lpFieldName}); + \$keywords[] = \${$stlTableName}_arr[\$i]->getVar('{$fpmf}'); + unset(\${$lpFieldName}); } // Display Navigation - if (\${$stl_table_name}_count > \$limit) { + if (\${$stlTableName}_count > \$limit) { include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - \$nav = new XoopsPageNav(\${$stl_table_name}_count, \$limit, \$start, 'start'); + \$nav = new XoopsPageNav(\${$stlTableName}_count, \$limit, \$start, 'start'); \$GLOBALS['xoopsTpl']->assign('pagenav', \$nav->renderNav(4)); } } // keywords -{$moduleDirname}_meta_keywords(xoops_getModuleOption('keywords', \$dirname) .', '. implode(', ', \$keywords)); +{$moduleDirname}_meta_keywords(\${$moduleDirname}->getConfig('keywords').', '. implode(', ', \$keywords)); unset(\$keywords); // description -{$moduleDirname}_meta_description({$language}{$stu_table_name}_DESC); +{$moduleDirname}_meta_description({$language}{$stuTableName}_DESC); // -\$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', {$stu_mod_name}_URL.'/{$stl_table_name}.php'); +\$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', {$stuModuleDirname}_URL.'/{$stlTableName}.php'); // include_once 'footer.php'; EOT; 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-07-10 18:47:00 UTC (rev 12696) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/xoopsversion.php 2014-07-10 19:07:25 UTC (rev 12697) @@ -363,23 +363,22 @@ EOT; $fields = $this->getTableFields($table->getVar('table_id')); foreach (array_keys($fields) as $f) - { - $fieldElement = $fields[$f]->getVar('field_element'); - } - if( $fieldElement == 3 ) { - $ret .= <<<EOT + { + if( $fields[$f]->getVar('field_element') == 3 ) { + $ret .= <<<EOT // Editor xoops_load('xoopseditorhandler'); -\$editor_handler = XoopsEditorHandler::getInstance(); +\$editorHandler = XoopsEditorHandler::getInstance(); \$modversion['config'][] = array( 'name' => "{$moduleDirname}_editor", 'title' => "{$language}EDITOR", 'description' => "{$language}EDITOR_DESC", 'formtype' => "select", 'valuetype' => "text", - 'options' => array_flip(\$editor_handler->getList()), + 'options' => array_flip(\$editorHandler->getList()), 'default' => "dhtml");\n\n EOT; + } } if ( $module->getVar('mod_permissions') == 1 ) { $ret .= <<<EOT @@ -427,9 +426,11 @@ 'default' => "{$moduleDirname}, {$keyword}");\n EOT; unset($this->keywords); - if( $fieldElement == 9 ) - { - $ret .= <<<EOT + foreach (array_keys($fields) as $f) + { + $fieldElement = $fields[$f]->getVar('field_element'); + if(( $fieldElement == 9 ) || ( $fieldElement == 10 )) { + $ret .= <<<EOT \n//Uploads : maxsize of image \$modversion['config'][] = array( 'name' => "maxsize", @@ -451,6 +452,7 @@ "jpeg" => "image/jpeg","jpg" => "image/jpg","jpe" => "image/jpe", "png" => "image/png"));\n EOT; + } } if ($table->getVar('table_admin') == 1) { $ret .= <<<EOT @@ -516,7 +518,7 @@ $tableName = $tables[$t]->getVar('table_name'); $count = count($tableName); if($tables[$t]->getVar('table_notifications') == 1) { - if($t <= $count) { + if($t < $count) { $notify_file .= "'".$tableName.".php', "; } else { $notify_file .= "'".$tableName.".php'"; @@ -539,7 +541,7 @@ 'name' => "category", 'title' => {$language}CATEGORY_NOTIFY, 'description' => {$language}CATEGORY_NOTIFY_DESC, - 'subscribe_from' => array('viewcat.php', 'singlefile.php'), + 'subscribe_from' => array({$notify_file}), 'item_name' => "cid", 'allow_bookmark' => 1); Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/docs/changelog.txt =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/docs/changelog.txt 2014-07-10 18:47:00 UTC (rev 12696) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/docs/changelog.txt 2014-07-10 19:07:25 UTC (rev 12697) @@ -2,7 +2,11 @@ 2014/01/02: Version 1.91 alpha 1 ================================= -- Under Construction +- Refactoring +- Rewritten from scratch +- Added templates admin +- Added fields table +- Added more parameters in fields form ================================= 2013/05/12: Version 1.39 RC 1 Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/language/english/admin.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/language/english/admin.php 2014-07-10 18:47:00 UTC (rev 12696) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/language/english/admin.php 2014-07-10 19:07:25 UTC (rev 12697) @@ -30,16 +30,6 @@ define('_AM_TDMCREATE_THEREARE_NUMMODULES', "There are <span class='red bold'>%s</span> modules stored in the Database"); define('_AM_TDMCREATE_THEREARE_NUMTABLES', "There are <span class='red bold'>%s</span> tables stored in the Database"); define('_AM_TDMCREATE_THEREARE_NUMFIELDS', "There are <span class='red bold'>%s</span> fields stored in the Database"); - -define('_AM_TDMCREATE_TABLES_FIELDS_MORE_ELEMENTS', "Forms: Elements"); -define('_AM_TDMCREATE_TABLES_FIELDS_MORE_PARENT_ID', "Parent: Category id"); -define('_AM_TDMCREATE_TABLES_FIELDS_MORE_DISPLAY_ADMIN', "Page: Show admin"); -define('_AM_TDMCREATE_TABLES_FIELDS_MORE_DISPLAY_USER', "Page: View User"); -define('_AM_TDMCREATE_TABLES_FIELDS_MORE_BLOC', "Block: View"); -define('_AM_TDMCREATE_TABLES_FIELDS_MORE_MAIN_FIELD', "Table: Main Field"); -define('_AM_TDMCREATE_TABLES_FIELDS_MORE_SEARCH', "Search: Index"); -define('_AM_TDMCREATE_TABLES_FIELDS_MORE_REQUIRED', "Forms: Required field"); - // General define('_AM_TDMCREATE_FORMOK', "Successfully saved"); define('_AM_TDMCREATE_FORMDELOK', "Successfully deleted"); @@ -54,7 +44,7 @@ define('_AM_TDMCREATE_FORM_INFO_TABLE_OPTIONAL_FIELD', "Optional fields"); define('_AM_TDMCREATE_FORM_INFO_TABLE_STRUCTURES_FIELD', "Structures fields"); define('_AM_TDMCREATE_FORM_INFO_TABLE_ICON_FIELD', "Icon fields"); - +// define('_AM_TDMCREATE_ID', "ID"); define('_AM_TDMCREATE_NAME', "Name"); define('_AM_TDMCREATE_BLOCKS', "Blocks"); @@ -70,8 +60,7 @@ //Form define('_AM_TDMCREATE_MODULE_NEW', "New module"); define('_AM_TDMCREATE_MODULE_EDIT', "Edit module"); -//define('_AM_TDMCREATE_MODULE_IMPORTANT', "Required Information"); - +// define('_AM_TDMCREATE_MODULE_IMPORTANT', "<span style='color: #FF0000'>Required - Information</span>"); define('_AM_TDMCREATE_MODULE_NOTIMPORTANT', "<span style='color: #00FF00'>Optional - Information</span>"); define('_AM_TDMCREATE_MODULE_ID', "Id"); @@ -175,7 +164,6 @@ define('_AM_TDMCREATE_TABLE_IMAGE_DESC', "<span class='red bold'>WARNING</span>: If you want to choose a new image, is best to name it with the module name before and follow with the name of the image so as not to overwrite any images with the same name, in the <span class='bold'>Frameworks/moduleclasses/moduleadmin/icons/32/</span>. Otherwise an other solution, would be to insert the images in the module, a new folder is created, with the creation of the same module - <span class='bold'>images/32</span>."); define('_AM_TDMCREATE_TABLE_FORM_CREATED_OK', "The table <b class='green'>%s</b> is successfully created"); define('_AM_TDMCREATE_TABLE_FORM_UPDATED_OK', "The table <b class='green'>%s</b> is successfully updated"); - // ------------------ Form Fields ------------------ // Caption define('_AM_TDMCREATE_FIELDS_NEW', "New fields"); @@ -298,8 +286,8 @@ define('_AM_TDMCREATE_BUILD_MODSELOPT', "Select and build a Module"); define('_AM_TDMCREATE_NOTMODULES', "There aren't modules, pleace create one first"); define('_AM_TDMCREATE_NOTTABLES', "There aren't tables, pleace create one first"); -define('_AM_TDMCREATE_FIELD_FORM_SAVED_OK', "Fields of table %s successfully saved"); -define('_AM_TDMCREATE_FIELD_FORM_UPDATED_OK', "Fields of table %s successfully updated"); +define('_AM_TDMCREATE_FIELDS_FORM_SAVED_OK', "Fields of table <b class='green'>%s</b> successfully saved"); +define('_AM_TDMCREATE_FIELDS_FORM_UPDATED_OK', "Fields of table <b class='green'>%s</b> successfully updated"); // define('_AM_TDMCREATE_THEREARENT_MODULES', "There aren't modules"); define('_AM_TDMCREATE_THEREARENT_TABLES', "There aren't tables"); Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/xoops_version.php ======... [truncated message content] |
From: <txm...@us...> - 2014-07-11 18:07:10
|
Revision: 12703 http://sourceforge.net/p/xoops/svn/12703 Author: txmodxoops Date: 2014-07-11 18:06:57 +0000 (Fri, 11 Jul 2014) Log Message: ----------- - Reorganized for modules without tables, but always accessible in admin Modified Paths: -------------- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/building.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fieldattributes.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fieldkey.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fieldnull.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fieldtype.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/header.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/index.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/menu.php 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/blocks.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/classes.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/formelements.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/file.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/comment_functions.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/comments.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/common.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/notifications.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/admin.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/modinfo.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/sql/mysql.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/pages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/blocks/blocks.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/footer.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/pages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/header.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/pages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/xoopsversion.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/sql/mysql.sql Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/building.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/building.php 2014-07-11 17:18:50 UTC (rev 12702) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/building.php 2014-07-11 18:06:57 UTC (rev 12703) @@ -83,11 +83,11 @@ } unset($nbModules); // Redirect if there aren't tables - $nbTables = $tdmcreate->getHandler('tables')->getCount(); + /*$nbTables = $tdmcreate->getHandler('tables')->getCount(); if($nbTables == 0) { redirect_header('tables.php?op=new', 2, _AM_TDMCREATE_NOTTABLES ); } - unset($nbTables); + unset($nbTables);*/ include_once TDMC_PATH . '/class/building.php'; $handler = TDMCreateBuilding::getInstance(); $form = $handler->getForm(); Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fieldattributes.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fieldattributes.php 2014-07-11 17:18:50 UTC (rev 12702) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fieldattributes.php 2014-07-11 18:06:57 UTC (rev 12703) @@ -32,7 +32,8 @@ public function __construct() { $this->XoopsObject(); - $this->initVar('fieldattribute_name', XOBJ_DTYPE_TXTBOX); + $this->initVar('fieldattribute_id', XOBJ_DTYPE_INT); + $this->initVar('fieldattribute_name', XOBJ_DTYPE_TXTBOX); $this->initVar('fieldattribute_value', XOBJ_DTYPE_TXTBOX); } } @@ -44,6 +45,6 @@ { function __construct(&$db) { - parent::__construct($db, 'tdmcreate_fieldattributes', 'tdmcreatefieldattributes', 'fieldattribute_name', 'fieldattribute_value'); + parent::__construct($db, 'tdmcreate_fieldattributes', 'tdmcreatefieldattributes', 'fieldattribute_id', 'fieldattribute_name'); } } \ No newline at end of file Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fieldkey.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fieldkey.php 2014-07-11 17:18:50 UTC (rev 12702) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fieldkey.php 2014-07-11 18:06:57 UTC (rev 12703) @@ -32,6 +32,7 @@ public function __construct() { $this->XoopsObject(); + $this->initVar('fieldkey_id', XOBJ_DTYPE_INT); $this->initVar('fieldkey_name', XOBJ_DTYPE_TXTBOX); $this->initVar('fieldkey_value', XOBJ_DTYPE_TXTBOX); } @@ -44,6 +45,6 @@ { function __construct(&$db) { - parent::__construct($db, 'tdmcreate_fieldkey', 'tdmcreatefieldkey', 'fieldkey_name', 'fieldkey_value'); + parent::__construct($db, 'tdmcreate_fieldkey', 'tdmcreatefieldkey', 'fieldkey_id', 'fieldkey_name'); } } \ No newline at end of file Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fieldnull.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fieldnull.php 2014-07-11 17:18:50 UTC (rev 12702) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fieldnull.php 2014-07-11 18:06:57 UTC (rev 12703) @@ -31,7 +31,8 @@ */ public function __construct() { - $this->XoopsObject(); + $this->XoopsObject(); + $this->initVar('fieldnull_id', XOBJ_DTYPE_INT); $this->initVar('fieldnull_name', XOBJ_DTYPE_TXTBOX); $this->initVar('fieldnull_value', XOBJ_DTYPE_TXTBOX); } @@ -44,6 +45,6 @@ { function __construct(&$db) { - parent::__construct($db, 'tdmcreate_fieldnull', 'tdmcreatefieldnull', 'fieldnull_name', 'fieldnull_value'); + parent::__construct($db, 'tdmcreate_fieldnull', 'tdmcreatefieldnull', 'fieldnull_id', 'fieldnull_name'); } } \ No newline at end of file Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fieldtype.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fieldtype.php 2014-07-11 17:18:50 UTC (rev 12702) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fieldtype.php 2014-07-11 18:06:57 UTC (rev 12703) @@ -31,7 +31,8 @@ */ public function __construct() { - $this->XoopsObject(); + $this->XoopsObject(); + $this->initVar('fieldtype_id', XOBJ_DTYPE_INT); $this->initVar('fieldtype_name', XOBJ_DTYPE_TXTBOX); $this->initVar('fieldtype_value', XOBJ_DTYPE_TXTBOX); } @@ -44,6 +45,6 @@ { function __construct(&$db) { - parent::__construct($db, 'tdmcreate_fieldtype', 'tdmcreatefieldtype', 'fieldtype_name', 'fieldtype_value'); + parent::__construct($db, 'tdmcreate_fieldtype', 'tdmcreatefieldtype', 'fieldtype_id', 'fieldtype_name'); } } \ No newline at end of file Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/header.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/header.php 2014-07-11 17:18:50 UTC (rev 12702) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/header.php 2014-07-11 18:06:57 UTC (rev 12703) @@ -70,15 +70,16 @@ \nrequire_once dirname(dirname(dirname(dirname(__FILE__)))). '/include/cp_header.php'; \$thisPath = dirname(dirname(__FILE__)); include_once \$thisPath.'/include/common.php'; -include_once \$thisPath.'/include/functions.php'; //\n EOT; - if ( $table->getVar('table_name') != '' ) { - $content .= <<<EOT + if (is_object($table)) { + if ( $table->getVar('table_name') != '' ) { + $content .= <<<EOT // Get instance of module \${$moduleDirname} = {$ucfModuleName}Helper::getInstance();\n EOT; - } + } + } $content .= <<<EOT // \$sysPathIcon16 = '../' . \$xoopsModule->getInfo('sysicons16'); Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/index.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/index.php 2014-07-11 17:18:50 UTC (rev 12702) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/index.php 2014-07-11 18:06:57 UTC (rev 12703) @@ -68,27 +68,39 @@ include_once 'header.php'; // Count elements\n EOT; - foreach (array_keys($tables) as $i) - { - $tableName = $tables[$i]->getVar('table_name'); - $content .= <<<EOT + $tableName = null; + if(is_array($tables)) { + foreach (array_keys($tables) as $i) + { + $tableName = $tables[$i]->getVar('table_name'); + $content .= <<<EOT \$count_{$tableName} = \${$tableName}Handler->getCount();\n EOT; + } } $content .= <<<EOT // Template Index -\$template_main = '{$moduleDirname}_admin_index.tpl'; +\$template_main = '{$moduleDirname}_admin_index.tpl';\n +EOT; + if(is_array($tables)) { + $content .= <<<EOT // InfoBox Statistics \$adminMenu->addInfoBox({$language}STATISTICS); // Info elements\n EOT; - foreach (array_keys($tables) as $i) - { - $tableName = $tables[$i]->getVar('table_name'); - $stuTableName = $language_thereare.strtoupper($tableName); - $content .= <<<EOT + foreach (array_keys($tables) as $i) + { + $tableName = $tables[$i]->getVar('table_name'); + $stuTableName = $language_thereare.strtoupper($tableName); + $content .= <<<EOT \$adminMenu->addInfoBoxLine({$language}STATISTICS, '<label>'.{$stuTableName}.'</label>', \$count_{$tableName});\n EOT; + } + } + if($tableName == null) { + $content .= <<<EOT +\$adminMenu->addInfoBoxLine({$language}STATISTICS, '<label>No statistics</label>', 0);\n +EOT; } $content .= <<<EOT // Render Index Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/menu.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/menu.php 2014-07-11 17:18:50 UTC (rev 12702) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/menu.php 2014-07-11 18:06:57 UTC (rev 12703) @@ -45,11 +45,13 @@ /* * @public function write * @param string $module - * @param mixed $tables + * @param object $table + * @param array $tables * @param string $filename */ - public function write($module, $tables, $filename) { + public function write($module, $table, $tables, $filename) { $this->setModule($module); + $this->setTable($table); $this->setTables($tables); $this->setFileName($filename); } @@ -93,7 +95,7 @@ { $fieldElement = $fields[$f]->getVar('field_element'); switch( $fieldElement ) { - case 10: + case 11: $ret = <<<EOT \$adminmenu[\$i]['icon'] = 'assets/images/icons/32/{$tables[$t]->getVar('table_image')}';\n EOT; @@ -113,6 +115,7 @@ */ public function render() { $module = $this->getModule(); + $table = $this->getTable(); $tables = $this->getTables(); $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); @@ -138,7 +141,7 @@ EOT; } } - if( $tablePermissions == 1 ) { + if (is_object($table) && $table->getVar('table_permissions') == 1) { $menu++; $content .= <<<EOT \$adminmenu[\$i]['title'] = {$language}{$menu}; 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-07-11 17:18:50 UTC (rev 12702) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/pages.php 2014-07-11 18:06:57 UTC (rev 12703) @@ -116,26 +116,21 @@ foreach(array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); - $rpFieldName = $fieldName; // Verify if table_fieldname is not empty $lpFieldName = !empty($tableFieldname) ? substr($fieldName, 0, strpos($fieldName, '_')) : $tableName; - if(strpos($fieldName, '_')) { - $str = strpos($fieldName, '_'); - if($str !== false){ - $rpFieldName = substr($fieldName, $str + 1, strlen($fieldName)); - } - } + $rpFieldName = $this->tdmcfile->getRightString($fieldName); + // $fieldElement = $fields[$f]->getVar('field_element'); if( ($fields[$f]->getVar('field_admin') == 1) || ($tableAutoincrement == 1) ) { switch($fieldElement) { - case 2: case 3: + case 4: $ret .= $this->adminobjects->getTextAreaGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); break; - case 7: + case 5: $ret .= $this->adminobjects->getSelectUserGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); break; - case 12: + case 13: $ret .= $this->adminobjects->getTextDateSelectGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); break; default: @@ -215,20 +210,20 @@ $fieldElement = $fields[$f]->getVar('field_element'); if($f > 0) { // If we want to hide field id switch($fieldElement) { - case 4: case 5: + case 6: $ret .= $this->adminobjects->getCheckBoxOrRadioYNSetVar($tableName, $fieldName); break; - case 9: + case 10: $ret .= $this->adminobjects->getImageListSetVar($moduleDirname, $tableName, $fieldName); break; - case 10: + case 11: $ret .= $this->adminobjects->getUploadImageSetVar($moduleDirname, $tableName, $fieldName); break; - case 11: + case 12: $ret .= $this->adminobjects->getUploadFileSetVar($moduleDirname, $tableName, $fieldName); break; - case 12: + case 13: $ret .= $this->adminobjects->getTextDateSelectSetVar($tableName, $fieldName); break; default: Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/architecture.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/architecture.php 2014-07-11 17:18:50 UTC (rev 12702) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/architecture.php 2014-07-11 18:06:57 UTC (rev 12703) @@ -113,16 +113,14 @@ $this->structure->makeDir($targetDirectory); // Copied of index.html file in "root module" folder $this->structure->copyFile('', $indexFile, 'index.html'); - if (is_object($table)) { - if ( $table->getVar('table_admin') == 1) { - // Creation of "admin" folder and index.html file - $this->structure->makeDirAndCopyFile('admin', $indexFile, 'index.html'); - } - if ( $table->getVar('table_blocks') == 1) { - // Creation of "blocks" folder and index.html file - $this->structure->makeDirAndCopyFile('blocks', $indexFile, 'index.html'); - } + if ( $module->getVar('mod_admin') == 1) { + // Creation of "admin" folder and index.html file + $this->structure->makeDirAndCopyFile('admin', $indexFile, 'index.html'); } + if ( $module->getVar('mod_blocks') == 1) { + // Creation of "blocks" folder and index.html file + $this->structure->makeDirAndCopyFile('blocks', $indexFile, 'index.html'); + } // Creation of "class" folder and index.html file $this->structure->makeDirAndCopyFile('class', $indexFile, 'index.html'); // Creation of "assets" folder and index.html file @@ -168,25 +166,25 @@ // Creation of "language/local_language" folder and index.html file $this->structure->makeDirAndCopyFile('language/'.$GLOBALS['xoopsConfig']['language'], $indexFile, 'index.html'); // Creation of "language/local_language/help" folder and index.html file - $this->structure->makeDirAndCopyFile('language/'.$GLOBALS['xoopsConfig']['language']. '/help', $indexFile, 'index.html'); - if (is_object($table)) { - if (( $table->getVar('table_user') == 1) || ( $table->getVar('table_admin') == 1 )) { - // Creation of "templates" folder and index.html file - $this->structure->makeDirAndCopyFile('templates', $indexFile, 'index.html'); - } - if ( $table->getVar('table_admin') == 1 ) { - // Creation of "templates/admin" folder and index.html file - $this->structure->makeDirAndCopyFile('templates/admin', $indexFile, 'index.html'); - } - if ( $table->getVar('table_blocks') == 1 ) { + $this->structure->makeDirAndCopyFile('language/'.$GLOBALS['xoopsConfig']['language']. '/help', $indexFile, 'index.html'); + if( $module->getVar('mod_admin') == 1 ) { + // Creation of "templates" folder and index.html file + $this->structure->makeDirAndCopyFile('templates', $indexFile, 'index.html'); + } + if( $module->getVar('mod_admin') == 1 ) { + // Creation of "templates/admin" folder and index.html file + $this->structure->makeDirAndCopyFile('templates/admin', $indexFile, 'index.html'); + } + if(is_object($table)) { + if( $table->getVar('table_blocks') == 1 ) { // Creation of "templates/blocks" folder and index.html file $this->structure->makeDirAndCopyFile('templates/blocks', $indexFile, 'index.html'); } - if ( $table->getVar('table_name') != null ) { + if( $table->getVar('table_name') != null ) { // Creation of "sql" folder and index.html file $this->structure->makeDirAndCopyFile('sql', $indexFile, 'index.html'); } - if ( $table->getVar('table_notifications') == 1 ) { + if( $table->getVar('table_notifications') == 1 ) { // Creation of "mail_template" folder and index.html file $this->structure->makeDirAndCopyFile('language/'.$GLOBALS['xoopsConfig']['language'].'/mail_template', $indexFile, 'index.html'); } @@ -277,7 +275,49 @@ // Language Modinfo File $languageModinfo = LanguageModinfo::getInstance(); $languageModinfo->write($module, $table, $tables, 'modinfo.php'); - $ret[] = $languageModinfo->render(); + $ret[] = $languageModinfo->render(); + if( $module->getVar('mod_admin') == 1 ) { + // Admin Header File + $adminHeader = AdminHeader::getInstance(); + $adminHeader->write($module, $table, $tables, 'header.php'); + $ret[] = $adminHeader->render(); + // Admin Index File + $adminIndex = AdminIndex::getInstance(); + $adminIndex->write($module, $tables, 'index.php'); + $ret[] = $adminIndex->render(); + // Admin Menu File + $adminMenu = AdminMenu::getInstance(); + $adminMenu->write($module, $table, $tables, 'menu.php'); + $ret[] = $adminMenu->render(); + // Admin About File + $adminAbout = AdminAbout::getInstance(); + $adminAbout->write($module, 'about.php'); + $ret[] = $adminAbout->render(); + // Admin Footer File + $adminFooter = AdminFooter::getInstance(); + $adminFooter->write($module, 'footer.php'); + $ret[] = $adminFooter->render(); + // Templates Admin About File + $adminTemplatesAbout = TemplatesAdminAbout::getInstance(); + $adminTemplatesAbout->write($module, $moduleDirname.'_admin_about.tpl'); + $ret[] = $adminTemplatesAbout->render(); + // Templates Admin Index File + $adminTemplatesIndex = TemplatesAdminIndex::getInstance(); + $adminTemplatesIndex->write($module, $moduleDirname.'_admin_index.tpl'); + $ret[] = $adminTemplatesIndex->render(); + // Templates Admin Footer File + $adminTemplatesFooter = TemplatesAdminFooter::getInstance(); + $adminTemplatesFooter->write($module, $moduleDirname.'_admin_footer.tpl'); + $ret[] = $adminTemplatesFooter->render(); + // Templates Admin Header File + $adminTemplatesHeader = TemplatesAdminHeader::getInstance(); + $adminTemplatesHeader->write($module, $moduleDirname.'_admin_header.tpl'); + $ret[] = $adminTemplatesHeader->render(); + // Language Admin File + $languageAdmin = LanguageAdmin::getInstance(); + $languageAdmin->write($module, $tables, 'admin.php'); + $ret[] = $languageAdmin->render(); + } // Creation of blocks language file if (is_object($table)) { if ( $table->getVar('table_blocks') == 1) { @@ -286,21 +326,12 @@ $languageBlocks->write($module, $tables, 'blocks.php'); $ret[] = $languageBlocks->render(); } - + // Class Helper File + $classHelper = ClassHelper::getInstance(); + $classHelper->write($module, 'helper.php'); + $ret[] = $classHelper->render(); // Creation of admin files - if ( $table->getVar('table_admin') == 1) { - // Admin Header File - $adminHeader = AdminHeader::getInstance(); - $adminHeader->write($module, $table, $tables, 'header.php'); - $ret[] = $adminHeader->render(); - // Admin Index File - $adminIndex = AdminIndex::getInstance(); - $adminIndex->write($module, $tables, 'index.php'); - $ret[] = $adminIndex->render(); - // Admin Menu File - $adminMenu = AdminMenu::getInstance(); - $adminMenu->write($module, $tables, 'menu.php'); - $ret[] = $adminMenu->render(); + if ( $table->getVar('table_admin') == 1) { // Creation of admin permission file if (( $table->getVar('table_permissions') == 1)) { // Admin Permissions File @@ -311,35 +342,7 @@ $adminTemplatesPermissions = TemplatesAdminPermissions::getInstance(); $adminTemplatesPermissions->write($module, $moduleDirname.'_admin_permissions.tpl'); $ret[] = $adminTemplatesPermissions->render(); - } - // Admin Aboutr File - $adminAbout = AdminAbout::getInstance(); - $adminAbout->write($module, 'about.php'); - $ret[] = $adminAbout->render(); - // Admin Footer File - $adminFooter = AdminFooter::getInstance(); - $adminFooter->write($module, 'footer.php'); - $ret[] = $adminFooter->render(); - // Language Admin File - $languageAdmin = LanguageAdmin::getInstance(); - $languageAdmin->write($module, $tables, 'admin.php'); - $ret[] = $languageAdmin->render(); - // Templates Admin About File - $adminTemplatesAbout = TemplatesAdminAbout::getInstance(); - $adminTemplatesAbout->write($module, $moduleDirname.'_admin_about.tpl'); - $ret[] = $adminTemplatesAbout->render(); - // Templates Admin Index File - $adminTemplatesIndex = TemplatesAdminIndex::getInstance(); - $adminTemplatesIndex->write($module, $moduleDirname.'_admin_index.tpl'); - $ret[] = $adminTemplatesIndex->render(); - // Templates Admin Footer File - $adminTemplatesFooter = TemplatesAdminFooter::getInstance(); - $adminTemplatesFooter->write($module, $moduleDirname.'_admin_footer.tpl'); - $ret[] = $adminTemplatesFooter->render(); - // Templates Admin Header File - $adminTemplatesHeader = TemplatesAdminHeader::getInstance(); - $adminTemplatesHeader->write($module, $moduleDirname.'_admin_header.tpl'); - $ret[] = $adminTemplatesHeader->render(); + } } // Creation of notifications files if ( $table->getVar('table_notifications') == 1 ) { @@ -361,7 +364,15 @@ // Sql File $sqlFile = SqlFile::getInstance(); $sqlFile->write($module, $tables, 'mysql.sql'); - $ret[] = $sqlFile->render(); + $ret[] = $sqlFile->render(); + // Include Functions File + $includeFunctions = IncludeFunctions::getInstance(); + $includeFunctions->write($module, 'functions.php'); + $ret[] = $includeFunctions->render(); + // Include Update File + $includeUpdate = IncludeUpdate::getInstance(); + $includeUpdate->write($module, 'update.php'); + $ret[] = $includeUpdate->renderFile(); } // Creation of search file if ( $table->getVar('table_search') == 1) { @@ -398,19 +409,7 @@ $ret[] = $includeCommentFunctions->renderFile(); } // Creation of user files - if ( ($table->getVar('table_user') == 1)) { - // Templates Index File - $userTemplatesIndex = TemplatesUserIndex::getInstance(); - $userTemplatesIndex->write($module, $moduleDirname.'_index.tpl'); - $ret[] = $userTemplatesIndex->render(); - // Templates Footer File - $userTemplatesFooter = TemplatesUserFooter::getInstance(); - $userTemplatesFooter->write($module, $table, $moduleDirname.'_footer.tpl'); - $ret[] = $userTemplatesFooter->render(); - // Templates Header File - $userTemplatesHeader = TemplatesUserHeader::getInstance(); - $userTemplatesHeader->write($module, $tables, $moduleDirname.'_header.tpl'); - $ret[] = $userTemplatesHeader->render(); + if ( ($table->getVar('table_user') == 1)) { // User Footer File $userFooter = UserFooter::getInstance(); $userFooter->write($module, 'footer.php'); @@ -434,27 +433,29 @@ $languageMain->write($module, $table, $tables, 'main.php'); $ret[] = $languageMain->render(); } - } - // Class Helper File - $classHelper = ClassHelper::getInstance(); - $classHelper->write($module, 'helper.php'); - $ret[] = $classHelper->render(); + } + if( $module->getVar('mod_admin') == 1 ) { + // Templates Index File + $userTemplatesIndex = TemplatesUserIndex::getInstance(); + $userTemplatesIndex->write($module, $moduleDirname.'_index.tpl'); + $ret[] = $userTemplatesIndex->render(); + // Templates Footer File + $userTemplatesFooter = TemplatesUserFooter::getInstance(); + $userTemplatesFooter->write($module, $table, $moduleDirname.'_footer.tpl'); + $ret[] = $userTemplatesFooter->render(); + // Templates Header File + $userTemplatesHeader = TemplatesUserHeader::getInstance(); + $userTemplatesHeader->write($module, $tables, $moduleDirname.'_header.tpl'); + $ret[] = $userTemplatesHeader->render(); + } // Css Styles File $cssStyles = CssStyles::getInstance(); $cssStyles->write($module, 'style.css'); $ret[] = $cssStyles->render(); // Include Common File $includeCommon = IncludeCommon::getInstance(); - $includeCommon->write($module, 'common.php'); - $ret[] = $includeCommon->render(); - // Include Functions File - $includeFunctions = IncludeFunctions::getInstance(); - $includeFunctions->write($module, 'functions.php'); - $ret[] = $includeFunctions->render(); - // Include Update File - $includeUpdate = IncludeUpdate::getInstance(); - $includeUpdate->write($module, 'update.php'); - $ret[] = $includeUpdate->renderFile(); + $includeCommon->write($module, $table, 'common.php'); + $ret[] = $includeCommon->render(); // Docs Changelog File $docsChangelog = DocsChangelog::getInstance(); $docsChangelog->write($module, 'changelog.txt'); Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/blocks/blocks.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/blocks/blocks.php 2014-07-11 17:18:50 UTC (rev 12702) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/blocks/blocks.php 2014-07-11 18:06:57 UTC (rev 12703) @@ -56,8 +56,8 @@ * @param null */ public function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tableCategory, $fields, $fpif) { - $stu_module_dirname = strtoupper($moduleDirname); - $ucfmod_name = ucfirst($moduleDirname); + $stuModuleDirname = strtoupper($moduleDirname); + $ucfModuleDirname = ucfirst($moduleDirname); $ret = <<<EOT include_once XOOPS_ROOT_PATH.'/modules/{$moduleDirname}/include/common.php'; include_once XOOPS_ROOT_PATH.'/modules/{$moduleDirname}/include/functions.php'; @@ -65,12 +65,12 @@ { include_once XOOPS_ROOT_PATH.'/modules/{$moduleDirname}/class/{$tableName}.php'; \$myts =& MyTextSanitizer::getInstance(); - \$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_upload_url', {$stu_module_dirname}_UPLOAD_URL); + \$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_upload_url', {$stuModuleDirname}_UPLOAD_URL); \${$tableFieldname} = array(); \$type_block = \$options[0]; \$nb_{$tableName} = \$options[1]; \$lenght_title = \$options[2]; - \${$moduleDirname} = {$ucfmod_name}Helper::getInstance(); + \${$moduleDirname} = {$ucfModuleDirname}Helper::getInstance(); \${$tableName}Handler =& \${$moduleDirname}->getHandler('{$tableName}'); \$criteria = new CriteriaCompo(); array_shift(\$options); @@ -100,26 +100,13 @@ foreach(array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); - $rp_field_name = $fieldName; - if( $fields[$f]->getVar('field_block') == 1 ) { - // Verify if table_fieldname is not empty - if(!empty($tableFieldname)) { - if(strpos($fieldName, '_')) { - $str = strpos($fieldName, '_'); - if($str !== false){ - $rp_field_name = substr($fieldName, $str + 1, strlen($fieldName)); - } - } - $tname = $tableFieldname; - $ret .= <<<EOT - \${$tname}['{$rp_field_name}'] = \${$tableName}_arr[\$i]->getVar('{$fieldName}');\n + // Verify if table_fieldname is not empty + $lpFieldName = !empty($tableFieldname) ? substr($fieldName, 0, strpos($fieldName, '_')) : $tableName; + $rpFieldName = $this->tdmcfile->getRightString($fieldName); + if( $fields[$f]->getVar('field_block') == 1 ) { + $ret .= <<<EOT + \${$lpFieldName}['{$rpFieldName}'] = \${$tableName}_arr[\$i]->getVar('{$fieldName}');\n EOT; - } else { - $tname = $tableName; - $ret .= <<<EOT - \${$tname}['{$rp_field_name}'] = \${$tableName}_arr[\$i]->getVar('{$fieldName}');\n -EOT; - } } } $ret .= <<<EOT Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/classes.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/classes.php 2014-07-11 17:18:50 UTC (rev 12702) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/classes.php 2014-07-11 18:06:57 UTC (rev 12703) @@ -132,14 +132,14 @@ * @param array $fields */ private function getHeadClass($moduleDirname, $tableName, $fields) { - $ucf_module_dirname = ucfirst($moduleDirname); - $ucf_table_name = ucfirst($tableName); + $ucfModuleDirname = ucfirst($moduleDirname); + $ucfTableName = ucfirst($tableName); $ret = <<<EOT defined('XOOPS_ROOT_PATH') or die("Restricted access"); /* - * Class Object {$ucf_module_dirname}{$ucf_table_name} + * Class Object {$ucfModuleDirname}{$ucfTableName} */ -class {$ucf_module_dirname}{$ucf_table_name} extends XoopsObject +class {$ucfModuleDirname}{$ucfTableName} extends XoopsObject { /* * @var mixed @@ -152,7 +152,7 @@ */ public function __construct() { - \$this->{$moduleDirname} = {$ucf_module_dirname}Helper::getInstance(); + \$this->{$moduleDirname} = {$ucfModuleDirname}Helper::getInstance(); {$this->getInitVars($fields)}\t} /* * @static function &getInstance @@ -212,9 +212,9 @@ * @param string $fpif */ private function getPermissionsInFunctionForm($moduleDirname, $fpif) { - $perm_approve = $this->getLanguage($moduleDirname, 'AM', 'PERMISSIONS_APPROVE'); - $perm_submit = $this->getLanguage($moduleDirname, 'AM', 'PERMISSIONS_SUBMIT'); - $perm_view = $this->getLanguage($moduleDirname, 'AM', 'PERMISSIONS_VIEW'); + $permissionApprove = $this->getLanguage($moduleDirname, 'AM', 'PERMISSIONS_APPROVE'); + $permissionSubmit = $this->getLanguage($moduleDirname, 'AM', 'PERMISSIONS_SUBMIT'); + $permissionView = $this->getLanguage($moduleDirname, 'AM', 'PERMISSIONS_VIEW'); $ret = <<<EOT // Permissions \$member_handler = & xoops_gethandler ( 'member' ); @@ -227,15 +227,15 @@ \$groups_ids_submit = \$gperm_handler->getGroupIds ( '{$moduleDirname}_submit', \$this->getVar ( '{$fpif}' ), \$xoopsModule->getVar ( 'mid' ) ); \$groups_ids_view = \$gperm_handler->getGroupIds ( '{$moduleDirname}_view', \$this->getVar ( '{$fpif}' ), \$xoopsModule->getVar ( 'mid' ) ); \$groups_ids_approve = array_values ( \$groups_ids_approve ); - \$groups_can_approve_checkbox = new XoopsFormCheckBox ( {$perm_approve}, 'groups_approve[]', \$groups_ids_approve ); + \$groups_can_approve_checkbox = new XoopsFormCheckBox ( {$permissionApprove}, 'groups_approve[]', \$groups_ids_approve ); \$groups_ids_submit = array_values ( \$groups_ids_submit ); - \$groups_can_submit_checkbox = new XoopsFormCheckBox ( {$perm_submit}, 'groups_submit[]', \$groups_ids_submit ); + \$groups_can_submit_checkbox = new XoopsFormCheckBox ( {$permissionSubmit}, 'groups_submit[]', \$groups_ids_submit ); \$groups_ids_view = array_values ( \$groups_ids_view ); - \$groups_can_view_checkbox = new XoopsFormCheckBox ( {$perm_view}, 'groups_view[]', \$groups_ids_view ); + \$groups_can_view_checkbox = new XoopsFormCheckBox ( {$permissionView}, 'groups_view[]', \$groups_ids_view ); } else { - \$groups_can_approve_checkbox = new XoopsFormCheckBox ( {$perm_approve}, 'groups_approve[]', \$full_list ); - \$groups_can_submit_checkbox = new XoopsFormCheckBox ( {$perm_submit}, 'groups_submit[]', \$full_list ); - \$groups_can_view_checkbox = new XoopsFormCheckBox ( {$perm_view}, 'groups_view[]', \$full_list ); + \$groups_can_approve_checkbox = new XoopsFormCheckBox ( {$permissionApprove}, 'groups_approve[]', \$full_list ); + \$groups_can_submit_checkbox = new XoopsFormCheckBox ( {$permissionSubmit}, 'groups_submit[]', \$full_list ); + \$groups_can_view_checkbox = new XoopsFormCheckBox ( {$permissionView}, 'groups_view[]', \$full_list ); } // For approve \$groups_can_approve_checkbox->addOptionArray ( \$group_list ); @@ -272,14 +272,14 @@ * @param string $fpmf */ private function getClassHandler($moduleDirname, $tableName, $fpif, $fpmf) { - $ucf_module_dirname = ucfirst($moduleDirname); - $ucf_table_name = ucfirst($tableName); - $ucf_mod_table_handler = $ucf_module_dirname . $ucf_table_name; + $ucfModuleDirname = ucfirst($moduleDirname); + $ucfTableName = ucfirst($tableName); + $ucfModuleTable = $ucfModuleDirname . $ucfTableName; $ret = <<<EOT /* - * Class Object Handler {$ucf_module_dirname}{$ucf_table_name} + * Class Object Handler {$ucfModuleDirname}{$ucfTableName} */ -class {$ucf_mod_table_handler}Handler extends XoopsPersistableObjectHandler +class {$ucfModuleTable}Handler extends XoopsPersistableObjectHandler { /* * Constructor Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/formelements.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/formelements.php 2014-07-11 17:18:50 UTC (rev 12702) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/formelements.php 2014-07-11 18:06:57 UTC (rev 12703) @@ -284,7 +284,7 @@ if($fields[$f]->getVar('field_parent') == 1) { $fieldName = $fields[$f]->getVar('field_name'); $field_element = $fields[$f]->getVar('field_element'); - if($field_element > 12) { + if($field_element > 13) { $fieldelement = $this->tdmcreate->getHandler('fieldelements')->get($field_element); $fieldelementName = $fieldelement->getVar('fieldelement_name'); $rpFieldelementName = strtolower(str_replace('Table : ', '', $fieldelementName)); @@ -364,40 +364,42 @@ // Switch elements switch($fieldElement) { - case 1: + case 1: + break; + case 2: $ret .= $this->getXoopsFormText($language, $fieldName, $required); break; - case 2: + case 3: $ret .= $this->getXoopsFormTextArea($language, $fieldName, $required); break; - case 3: + case 4: $ret .= $this->getXoopsFormDhtmlTextArea($language, $moduleDirname, $fieldName, $required); break; - case 4: + case 5: $ret .= $this->getXoopsFormCheckBox($language, $fieldName, $required); break; - case 5: + case 6: $ret .= $this->getXoopsFormRadioYN($language, $fieldName, $required); break; - case 6: + case 7: $ret .= $this->getXoopsFormSelect($language, $tableName, $fieldName, $required); break; - case 7: + case 8: $ret .= $this->getXoopsFormSelectUser($language, $fieldName, $required); break; - case 8: + case 9: $ret .= $this->getXoopsFormColorPicker($language, $moduleDirname, $fieldName, $required); break; - case 9: + case 10: $ret .= $this->getXoopsFormImageList($language_funct, $moduleDirname, $tableName, $fieldName, $required); break; - case 10: + case 11: $ret .= $this->getXoopsFormUploadImage($language_funct, $moduleDirname, $tableName, $required); break; - case 11: + case 12: $ret .= $this->getXoopsFormUploadFile($language, $moduleDirname, $tableName, $fieldName, $required); break; - case 12: + case 13: $ret .= $this->getXoopsFormTextDateSelect($language, $moduleDirname, $fieldName, $required); break; default: @@ -407,7 +409,7 @@ } break; } - if ($fieldElement > 12) { + if ($fieldElement > 13) { if($table->getVar('table_category') == 1) { $ret .= $this->getXoopsFormTopic($language, $moduleDirname, $table, $fields, $required); } else { Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/file.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/file.php 2014-07-11 17:18:50 UTC (rev 12702) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/file.php 2014-07-11 18:06:57 UTC (rev 12703) @@ -290,6 +290,21 @@ } /* + * @public function getRightString + * @param string $string + */ + public function getRightString($string) { + if(strpos($string, '_')) { + $str = strpos($string, '_'); + if($str !== false){ + $ret = substr($string, $str + 1, strlen($string)); + return $ret; + } + } + return $string; + } + + /* * @public function getHeaderFilesComments * @param string $module * @param string $fileName Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/comment_functions.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/comment_functions.php 2014-07-11 17:18:50 UTC (rev 12702) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/comment_functions.php 2014-07-11 18:06:57 UTC (rev 12703) @@ -62,8 +62,8 @@ $table = $this->getTable(); $moduleDirname = $module->getVar('mod_dirname'); $tableName = $table->getVar('table_name'); - $ucf_module_dirname = ucfirst($moduleDirname); - $ucf_table_name = ucfirst($tableName); + $ucfModuleDirname = ucfirst($moduleDirname); + $ucfTableName = ucfirst($tableName); $filename = $this->getFileName(); $content = $this->getHeaderFilesComments($module, $filename); $content .= <<<EOT @@ -71,7 +71,7 @@ function {$moduleDirname}_com_update(\$itemId, \$itemNumb) { \$itemId = intval(\$itemId); \$itemNumb = intval(\$itemNumb); - \$article = new {$ucf_module_dirname}{$ucf_table_name}(\$itemId); + \$article = new {$ucfModuleDirname}{$ucfTableName}(\$itemId); if (!\$article->updateComments(\$itemNumb)) { return false; } 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-07-11 17:18:50 UTC (rev 12702) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/comments.php 2014-07-11 18:06:57 UTC (rev 12703) @@ -58,13 +58,13 @@ */ public function renderCommentsIncludes($module, $filename) { - $module_dirname = $module->getVar('mod_dirname'); + $moduleDirname = $module->getVar('mod_dirname'); $content = $this->getHeaderFilesComments($module, $filename.'.php'); $content .= <<<EOT include_once '../../mainfile.php'; include_once XOOPS_ROOT_PATH.'/include/{$filename}.php'; EOT; - $this->tdmcfile->create($module_dirname, 'include', $filename.'.php', $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->tdmcfile->create($moduleDirname, 'include', $filename.'.php', $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); return $this->tdmcfile->renderFile(); } /* @@ -75,10 +75,8 @@ public function renderCommentsNew($module, $filename) { $table = $this->getTable(); - $module_dirname = strtolower($module->getVar('mod_dirname')); - $table_name = $table->getVar('table_name'); - $table_fieldname = $table->getVar('table_fieldname'); - $fpmf = null; + $moduleDirname = strtolower($module->getVar('mod_dirname')); + $tableName = $table->getVar('table_name'); $fields = $this->getTableFields($table->getVar('table_id')); foreach(array_keys($fields) as $f) { @@ -89,16 +87,16 @@ $content = $this->getHeaderFilesComments($module, $filename.'.php'); $content .= <<<EOT include '../../mainfile.php'; -include_once XOOPS_ROOT_PATH.'/modules/{$module_dirname}/class/{$table_name}.php'; +include_once XOOPS_ROOT_PATH.'/modules/{$moduleDirname}/class/{$tableName}.php'; \$com_itemid = isset(\$_REQUEST['com_itemid']) ? intval(\$_REQUEST['com_itemid']) : 0; if (\$com_itemid > 0) { - \${$table_name}Handler =& xoops_getModuleHandler('{$table_name}', '{$module_dirname}'); - \${$table_name} = \${$table_name}handler->get(\$com_itemid); - \$com_replytitle = \${$table_name}->getVar('{$fpmf}'); + \${$tableName}Handler =& xoops_getModuleHandler('{$tableName}', '{$moduleDirname}'); + \${$tableName} = \${$tableName}handler->get(\$com_itemid); + \$com_replytitle = \${$tableName}->getVar('{$fpmf}'); include XOOPS_ROOT_PATH.'/include/{$filename}.php'; } EOT; - $this->tdmcfile->create($module_dirname, 'include', $filename.'.php', $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->tdmcfile->create($moduleDirname, 'include', $filename.'.php', $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); return $this->tdmcfile->renderFile(); } /* @@ -109,33 +107,33 @@ $module = $this->getModule(); $table = $this->getTable(); $filename = $this->getFileName(); - $module_dirname = $module->getVar('mod_dirname'); + $moduleDirname = $module->getVar('mod_dirname'); $content = $this->getHeaderFilesComments($module, $filename); switch($filename) { case 'comment_edit.php': $content .= $this->getCommentsIncludes('comment_edit'); - $this->tdmcfile->create($module_dirname, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->tdmcfile->create($moduleDirname, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); return $this->tdmcfile->renderFile(); break; case 'comment_delete.php': $content .= $this->getCommentsIncludes('comment_delete'); - $this->tdmcfile->create($module_dirname, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->tdmcfile->create($moduleDirname, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); return $this->tdmcfile->renderFile(); break; case 'comment_post.php': $content .= $this->getCommentsIncludes('comment_post'); - $this->tdmcfile->create($module_dirname, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->tdmcfile->create($moduleDirname, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); return $this->tdmcfile->renderFile(); break; case 'comment_reply.php': $content .= $this->getCommentsIncludes('comment_reply'); - $this->tdmcfile->create($module_dirname, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->tdmcfile->create($moduleDirname, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); return $this->tdmcfile->renderFile(); break; case 'comment_new.php': - $content .= $this->getCommentsNew($module_dirname, 'comment_new'); - $this->tdmcfile->create($module_dirname, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $content .= $this->getCommentsNew($moduleDirname, 'comment_new'); + $this->tdmcfile->create($moduleDirname, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); return $this->tdmcfile->renderFile(); break; } Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/common.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/common.php 2014-07-11 17:18:50 UTC (rev 12702) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/common.php 2014-07-11 18:06:57 UTC (rev 12703) @@ -44,10 +44,12 @@ /* * @public function write * @param string $module + * @param object $table * @param string $filename */ - public function write($module, $filename) { + public function write($module, $table, $filename) { $this->setModule($module); + $this->setTable($table); $this->setFileName($filename); } /* @@ -56,26 +58,26 @@ */ private function getCommonCode($module) { + $table = $this->getTable(); $moduleDirname = $module->getVar('mod_dirname'); - $stu_mn = strtoupper($moduleDirname); - $mod_author = $module->getVar('mod_author'); - $mod_a_w_name = $module->getVar('mod_author_website_name'); - $mod_a_w_url = $module->getVar('mod_author_website_url'); - $awn = str_replace(' ', '', strtolower($mod_a_w_name)); - $mod_author_image = str_replace(' ', '', strtolower($mod_author)); + $stuModuleDirname = strtoupper($moduleDirname); + $moduleAuthor = $module->getVar('mod_author'); + $moduleAuthorWebsiteName = $module->getVar('mod_author_website_name'); + $moduleAuthorWebsiteUrl = $module->getVar('mod_author_website_url'); + $moduleAuthorImage = str_replace(' ', '', strtolower($moduleAuthor)); $ret = <<<EOT defined('XOOPS_ROOT_PATH') or die('Restricted access'); -if (!defined('{$stu_mn}_MODULE_PATH')) { - define('{$stu_mn}_DIRNAME', '{$moduleDirname}'); - define('{$stu_mn}_PATH', XOOPS_ROOT_PATH.'/modules/'.{$stu_mn}_DIRNAME); - define('{$stu_mn}_URL', XOOPS_URL.'/modules/'.{$stu_mn}_DIRNAME); - define('{$stu_mn}_UPLOAD_PATH', XOOPS_UPLOAD_PATH.'/'.{$stu_mn}_DIRNAME); - define('{$stu_mn}_UPLOAD_URL', XOOPS_UPLOAD_URL.'/'.{$stu_mn}_DIRNAME); - define('{$stu_mn}_IMAGE_PATH', {$stu_mn}_PATH.'/assets/images'); - define('{$stu_mn}_IMAGE_URL', {$stu_mn}_URL.'/assets/images/'); - define('{$stu_mn}_ADMIN', {$stu_mn}_URL . '/admin/index.php'); - \$local_logo = {$stu_mn}_IMAGE_URL . '/{$mod_author_image}_logo.gif'; - /*if(is_dir({$stu_mn}_IMAGE_PATH) && file_exists(\$local_logo)) { +if (!defined('{$stuModuleDirname}_MODULE_PATH')) { + define('{$stuModuleDirname}_DIRNAME', '{$moduleDirname}'); + define('{$stuModuleDirname}_PATH', XOOPS_ROOT_PATH.'/modules/'.{$stuModuleDirname}_DIRNAME); + define('{$stuModuleDirname}_URL', XOOPS_URL.'/modules/'.{$stuModuleDirname}_DIRNAME); + define('{$stuModuleDirname}_UPLOAD_PATH', XOOPS_UPLOAD_PATH.'/'.{$stuModuleDirname}_DIRNAME); + define('{$stuModuleDirname}_UPLOAD_URL', XOOPS_UPLOAD_URL.'/'.{$stuModuleDirname}_DIRNAME); + define('{$stuModuleDirname}_IMAGE_PATH', {$stuModuleDirname}_PATH.'/assets/images'); + define('{$stuModuleDirname}_IMAGE_URL', {$stuModuleDirname}_URL.'/assets/images/'); + define('{$stuModuleDirname}_ADMIN', {$stuModuleDirname}_URL . '/admin/index.php'); + \$local_logo = {$stuModuleDirname}_IMAGE_URL . '/{$moduleAuthorImage}_logo.gif'; + /*if(is_dir({$stuModuleDirname}_IMAGE_PATH) && file_exists(\$local_logo)) { \$logo = \$local_logo; } else { \$sysPathIcon32 = \$GLOBALS['xoopsModule']->getInfo('icons32'); @@ -83,12 +85,17 @@ }*/ } // module information -\$copyright = "<a href='{$mod_a_w_url}' title='{$mod_a_w_name}' target='_blank'> - <img src='".\$local_logo."' alt='{$mod_a_w_name}' /></a>"; +\$copyright = "<a href='{$moduleAuthorWebsiteUrl}' title='{$moduleAuthorWebsiteName}' target='_blank'> + <img src='".\$local_logo."' alt='{$moduleAuthorWebsiteName}' /></a>"; include_once XOOPS_ROOT_PATH.'/class/xoopsrequest.php'; -include_once {$stu_mn}_PATH.'/class/helper.php'; EOT; + if (is_object($table)) { + $ret .= <<<EOT +include_once {$stuModuleDirname}_PATH.'/class/helper.php'; +include_once {$stuModuleDirname}_PATH.'/include/functions.php'; +EOT; + } return $ret; } /* 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-07-11 17:18:50 UTC (rev 12702) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/notifications.php 2014-07-11 18:06:57 UTC (rev 12703) @@ -60,7 +60,8 @@ */ public function getNotificationsFunction($moduleDirname) { - $table = $this->getTable(); + $stuModuleDirname = strtoupper($moduleDirname); + $table = $this->getTable(); $tableName = $table->getVar('table_name'); $tableFieldname = $table->getVar('table_fieldname'); $fields = $this->getTableFields($table->getVar('table_id')); @@ -90,38 +91,35 @@ \$module =& \$xoopsModule; \$config =& \$xoopsModuleConfig; } - + // xoops_loadLanguage('main', '{$moduleDirname}'); - - if (\$category=='global') - { - \$item['name'] = ''; - \$item['url'] = ''; - return \$item; - } - + // global \$xoopsDB; - if (\$category=='category') - { - // Assume we have a valid category id - \$sql = 'SELECT {$fpmf} FROM ' . \$xoopsDB->prefix('mod_{$moduleDirname}_{$tableName}') . ' WHERE {$fpif} = '. \$item_id; - \$result = \$xoopsDB->query(\$sql); // TODO: error check - \$result_array = \$xoopsDB->fetchArray(\$result); - \$item['name'] = \$result_array['{$fpmf}']; - \$item['url'] = XOOPS_URL . '/modules/' . \$module->getVar('dirname') . '/{$tableName}.php?{$fieldName}=' . \$item_id; - return \$item; + switch(\$category) { + case 'global': + \$item['name'] = ''; + \$item['url'] = ''; + return \$item; + break; + case 'category': + // Assume we have a valid category id + \$sql = 'SELECT {$fpif}, {$fpmf} FROM ' . \$xoopsDB->prefix('{$moduleDirname}_{$tableName}') . ' WHERE {$fpif} = '. \$item_id; + \$result = \$xoopsDB->query(\$sql); // TODO: error check + \$result_array = \$xoopsDB->fetchArray(\$result); + \$item['name'] = \$result_array['{$fpmf}']; + \$item['url'] = {$stuModuleDirname}_URL . '/{$tableName}.php?{$fpif}=' . \$item_id; + return \$item; + break; + case '{$tableFieldname}': + // Assume we have a valid link id + \$sql = 'SELECT {$fpif}, {$fpmf} FROM '.\$xoopsDB->prefix('{$moduleDirname}_{$tableName}') . ' WHERE {$fpif} = ' . \$item_id; + \$result = \$xoopsDB->query(\$sql); // TODO: error check + \$result_array = \$xoopsDB->fetchArray(\$result); + \$item['name'] = \$result_array['{$fpmf}']; + \$item['url'] = {$stuModuleDirname}_URL . '/{$tableName}.php?{$fieldName}=' . \$result_array['{$fieldName}'] . '&{$fpif}=' . \$item_id; + return \$item; + break; } - - if (\$category=='{$tableFieldname}') - { - // Assume we have a valid link id - \$sql = 'SELECT {$fieldName}, {$fpmf} FROM '.\$xoopsDB->prefix('mod_{$moduleDirname}_{$tableName}') . ' WHERE {$fpif} = ' . \$item_id; - \$result = \$xoopsDB->query(\$sql); // TODO: error check - \$result_array = \$xoopsDB->fetchArray(\$result); - \$item['name'] = \$result_array['title']; - \$item['url'] = XOOPS_URL . '/modules/' . \$module->getVar('dirname') . '/{$tableName}.php?{$fieldName}=' . \$result_array['{$fieldName}'] . '&{$fpif}=' . \$item_id; - return \$item; - } } EOT; return $ret; Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/admin.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/admin.php 2014-07-11 17:18:50 UTC (rev 12702) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/admin.php 2014-07-11 18:06:57 UTC (rev 12703) @@ -247,10 +247,12 @@ $moduleDirname = $module->getVar('mod_dirname'); $language = $this->getLanguage($moduleDirname, 'AM'); $content = $this->getHeaderFilesComments($module, $filename); - $content .= $this->getLanguageAdminIndex($language, $tables); - $content .= $this->getLanguageAdminPages($language, $tables); - $content .= $this->getLanguageAdminClass($language, $tables); - $content .= $this->getLanguageAdminPermissions($language); + if(is_array($tables)) { + $content .= $this->getLanguageAdminIndex($language, $tables); + $content .= $this->getLanguageAdminPages($language, $tables); + $content .= $this->getLanguageAdminClass($language, $tables); + $content .= $this->getLanguageAdminPermissions($language); + } $content .= $this->getLanguageAdminFoot($language); // $this->tdmcfile->create($moduleDirname, 'language/'.$GLOBALS['xoopsConfig']['language'], $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); 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-07-11 17:18:50 UTC (rev 12702) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/modinfo.php 2014-07-11 18:06:57 UTC (rev 12703) @@ -83,12 +83,12 @@ foreach (array_keys($tables) as $i) { $menu++; - $ucf_table_name = ucfirst(str_replace('_', ' ', $tables[$i]->getVar('table_name'))); + $ucfTableName = ucfirst(str_replace('_', ' ', $tables[$i]->getVar('table_name'))); $ret .= <<<EOT -define('{$language}ADMENU{$menu}', "{$ucf_table_name}");\n +define('{$language}ADMENU{$menu}', "{$ucfTableName}");\n EOT; } - if ( $table->getVar('table_permissions') == 1 ) { + if (is_object($table) && $table->getVar('table_permissions') == 1) { $menu++; $ret .= <<<EOT define('{$language}ADMENU{$menu}', "Permissions");\n @@ -279,7 +279,8 @@ $moduleDirname = $module->getVar('mod_dirname'); $language = $this->getLanguage($moduleDirname, 'MI'); $content = $this->getHeaderFilesComments($module, $filename); - $content .= $this->getMain($language, $module); + $content .= $this->getMain($language, $module); + $content .= $this->getMenu($language, $table, $tables); if (is_object($table)) { if ( $table->getVar('table_admin') == 1 ) { $content .= $this->getAdmin($language); @@ -289,8 +290,7 @@ } if ( $table->getVar('table_submenu') == 1 ) { $content .= $this->getSubmenu($language, $tables); - } - $content .= $this->getMenu($language, $table, $tables); + } $content .= $this->getBlocks($language, $tables); $content .= $this->getConfig($language, $table); if ( $table->getVar('table_notifications') == 1 ) Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/sql/mysql.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/sql/mysql.php 2014-07-11 17:18:50 UTC (rev 12702) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/sql/mysql.php 2014-07-11 18:06:57 UTC (rev 12703) @@ -16,7 +16,7 @@ * @package tdmcreate * @since 2.5.0 * @author Txmod Xoops http://www.txmodxoops.org - * @version $Id: sql_file.php 12258 2014-01-02 09:33:29Z timgno $ + * @version $Id: mysql.php 12258 2014-01-02 09:33:29Z timgno $ */ defined('XOOPS_ROOT_PATH') or die('Restricted access'); @@ -58,10 +58,10 @@ } /* - * @public function getHeaderSqlComments + * @private function getHeaderSqlComments * @param string $moduleName */ - public function getHeaderSqlComments($moduleName) + private function getHeaderSqlComments($moduleName) { $date = date('D M d, Y'); $time = date('G:i'); @@ -83,19 +83,19 @@ } /* - * @public function getHeadDatabaseTable + * @private function getHeadDatabaseTable * @param string $moduleDirname * @param string $tableName - * @param integer $nb_fields + * @param integer $fieldsNumb * * Unused IF NOT EXISTS */ - public function getHeadDatabaseTable($moduleDirname, $tableName, $nb_fields) + private function getHeadDatabaseTable($moduleDirname, $tableName, $fieldsNumb) { $ret = <<<SQL # -# Structure table for `{$moduleDirname}_{$tableName}` {$nb_fields} +# Structure table for `{$moduleDirname}_{$tableName}` {$fieldsNumb} # CREATE TABLE `{$moduleDirname}_{$tableName}` (\n @@ -104,49 +104,49 @@ } /* - * @public function getDatabaseTables + * @private function getDatabaseTables * @param string $moduleDirname */ - public function getDatabaseTables($moduleDirname) + private function getDatabaseTables($moduleDirname) { $ret = null; $tables = $this->getTables(); foreach(array_keys($tables) as $t) { - $table_id = $tables[$t]->getVar('table_id'); + $tableId = $tables[$t]->getVar('table_id'); $tableName = $tables[$t]->getVar('table_name'); - $table_autoincrement = $tables[$t]->getVar('table_autoincrement'); - $nb_fields = $tables[$t]->getVar('table_nbfields'); - $ret .= $this->getDatabaseFields($moduleDirname, $table_id, $tableName, $table_autoincrement, $nb_fields); + $tableAutoincrement = $tables[$t]->getVar('table_autoincrement'); + $fieldsNumb = $tables[$t]->getVar('table_nbfields'); + $ret .= $this->getDatabaseFields($moduleDirname, $tableId, $tableName, $tableAutoincrement, $fieldsNumb); } return $ret; } /* - * @public function getDatabaseFields + * @private function getDatabaseFields * @param string $moduleDirname * @param string $tableName - * @param boolean $table_autoincrement - * @param integer $nb_fields + * @param integer $tableAutoincrement + * @param integer $fieldsNumb */ - public function getDatabaseFields($moduleDirname, $table_id, $tableName, $table_autoincrement, $nb_fields) + private function getDatabaseFields($moduleDirname, $tableId, $tableName, $tableAutoincrement, $fieldsNumb) { $ret = null; $j = 0; $comma = array(); $row = array(); - $fields = $this->getTableFields($table_id); + $fields = $this->getTableFields($tableId); foreach(array_keys($fields) as $f) { // Creation of database table - $ret = $this->getHeadDatabaseTable($moduleDirname, $tableName, $nb_fields); - $field_name = $fields[$f]->getVar('field_name'); - $field_type = $fields[$f]->getVar('field_type'); - $field_value = $fields[$f]->getVar('field_value'); - $field_attribute = $fields[$f]->getVar('field_attribute'); - $field_null = $fields[$f]->getVar('field_null'); - $field_default = $fields[$f]->getVar('field_default'); - $field_key = $fields[$f]->getVar('field_key'); - if ( !empty($field_name) ) + $ret = $this->getHeadDatabaseTable($moduleDirname, $tableName, $fieldsNumb); + $fieldName = $fields[$f]->getVar('field_name'); + $fieldType = $fields[$f]->getVar('field_type'); + $fieldValue = $fields[$f]->getVar('field_value'); + $fieldAttribute = $fields[$f]->getVar('field_attribute'); + $fieldNull = $fields[$f]->getVar('field_null'); + $fieldDefault = $fields[$f]->getVar('field_default'); + $fieldKey = $fields[$f]->getVar('field_key'); + ... [truncated message content] |
From: <txm...@us...> - 2014-07-12 07:41:49
|
Revision: 12704 http://sourceforge.net/p/xoops/svn/12704 Author: txmodxoops Date: 2014-07-12 07:41:43 +0000 (Sat, 12 Jul 2014) Log Message: ----------- - Fixed important bugs - Updated - Still work to do Modified Paths: -------------- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/classes.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/sql/mysql.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/pages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/xoopsversion.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/sql/mysql.sql XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/templates/admin/tdmcreate_tables.tpl Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/classes.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/classes.php 2014-07-11 18:06:57 UTC (rev 12703) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/classes.php 2014-07-12 07:41:43 UTC (rev 12704) @@ -81,44 +81,50 @@ { $fieldName = $fields[$f]->getVar('field_name'); $fieldType = $fields[$f]->getVar('field_type'); + if($fieldType > 1) { + $fType = $this->tdmcreate->getHandler('fieldtype')->get($fieldType); + $fieldTypeName = $fType->getVar('fieldtype_name'); + } else { + $fieldType = null; + } switch($fieldType) { - case 'INT': - case 'TINYINT': - case 'MEDIUMINT': - case 'SMALLINT': + case 2: + case 3: + case 4: + case 5: $ret .= $this->getInitVar($fieldName, 'INT'); break; - case 'CHAR': - case 'VARCHAR': - $ret .= $this->getInitVar($fieldName, 'TXTBOX'); - break; - case 'TEXT': - case 'TINYTEXT': - case 'MEDIUMTEXT': - case 'LONGTEXT': - $ret .= $this->getInitVar($fieldName, 'TXTAREA'); - break; - case 'FLOAT': + case 6: $ret .= $this->getInitVar($fieldName, 'FLOAT'); break; - case 'DECIMAL': - case 'DOUBLE': + case 7: + case 8: $ret .= $this->getInitVar($fieldName, 'DECIMAL'); break; - case 'ENUM': + case 10: $ret .= $this->getInitVar($fieldName, 'ENUM'); break; - case 'EMAIL': + case 11: $ret .= $this->getInitVar($fieldName, 'EMAIL'); break; - case 'URL': + case 12: $ret .= $this->getInitVar($fieldName, 'URL'); - break; - case 'DATE': - case 'DATETIME': - case 'TIMESTAMP': - case 'TIME': - case 'YEAR': + break; + case 13: + case 14: + $ret .= $this->getInitVar($fieldName, 'TXTBOX'); + break; + case 15: + case 16: + case 17: + case 18: + $ret .= $this->getInitVar($fieldName, 'TXTAREA'); + break; + case 19: + case 20: + case 21: + case 22: + case 23: $ret .= $this->getInitVar($fieldName, 'LTIME'); break; } Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/sql/mysql.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/sql/mysql.php 2014-07-11 18:06:57 UTC (rev 12703) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/sql/mysql.php 2014-07-12 07:41:43 UTC (rev 12704) @@ -144,55 +144,73 @@ $fieldNull = $fields[$f]->getVar('field_null'); $fieldDefault = $fields[$f]->getVar('field_default'); $fieldKey = $fields[$f]->getVar('field_key'); + if($fieldType > 1) { + $fType = $this->tdmcreate->getHandler('fieldtype')->get($fieldType); + $fieldTypeName = $fType->getVar('fieldtype_name'); + } else { + $fieldType = null; + } + if($fieldAttribute > 1) { + $fAttribute = $this->tdmcreate->getHandler('fieldattributes')->get($fieldAttribute); + $fieldAttribute = $fAttribute->getVar('fieldattribute_name'); + } else { + $fieldAttribute = null; + } + if($fieldNull > 1) { + $fNull = $this->tdmcreate->getHandler('fieldnull')->get($fieldNull); + $fieldNull = $fNull->getVar('fieldnull_name'); + } else { + $fieldNull = null; + } if ( !empty($fieldName) ) { switch( $fieldType ) { - case 'TEXT': - case 'TINYTEXT': - case 'MEDIUMTEXT': - case 'LONGTEXT': - case 'DATE': - case 'DATETIME': - case 'TIMESTAMP': - $type = $fieldType; + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + $type = $fieldTypeName; $default = null; break; default: - $type = $fieldType.'('.$fieldValue.')'; + $type = $fieldTypeName.'('.$fieldValue.')'; $default = "DEFAULT '{$fieldDefault}'"; break; } if( ($f == 0) && ($tableAutoincrement == 1) ) { $row[] = $this->getFieldRow($fieldName, $type, $fieldAttribute, $fieldNull, null, 'AUTO_INCREMENT'); - $comma[$j] = $this->getKey(1, $fieldName); + $comma[$j] = $this->getKey(2, $fieldName); $j++; } elseif( ($f == 0) && ($tableAutoincrement == 0) ) { $row[] = $this->getFieldRow($fieldName, $type, $fieldAttribute, $fieldNull, $default); - $comma[$j] = $this->getKey(1, $fieldName); + $comma[$j] = $this->getKey(2, $fieldName); $j++; } else { - if( $fieldKey == 'UNIQUE' || $fieldKey == 'KEY' || $fieldKey == 'INDEX' || $fieldKey == 'FULLTEXT') + if( $fieldKey == 3 || $fieldKey == 4 || $fieldKey == 5 || $fieldKey == 6) { switch( $fieldKey ) { - case 'UNIQUE': + case 3: $row[] = $this->getFieldRow($fieldName, $type, $fieldAttribute, $fieldNull, $default); - $comma[$j] = $this->getKey(2, $fieldName); - $j++; - break; - case 'KEY': - $row[] = $this->getFieldRow($fieldName, $type, $fieldAttribute, $fieldNull, $default); $comma[$j] = $this->getKey(3, $fieldName); $j++; break; - case 'INDEX': + case 4: $row[] = $this->getFieldRow($fieldName, $type, $fieldAttribute, $fieldNull, $default); $comma[$j] = $this->getKey(4, $fieldName); $j++; break; - case 'FULLTEXT': + case 5: $row[] = $this->getFieldRow($fieldName, $type, $fieldAttribute, $fieldNull, $default); $comma[$j] = $this->getKey(5, $fieldName); $j++; + break; + case 6: + $row[] = $this->getFieldRow($fieldName, $type, $fieldAttribute, $fieldNull, $default); + $comma[$j] = $this->getKey(6, $fieldName); + $j++; break; } } else { @@ -266,27 +284,27 @@ */ private function getKey($key, $fieldName) { switch( $key ) { - case 1: // PRIMARY KEY + case 2: // PRIMARY KEY $ret = <<<SQL PRIMARY KEY (`{$fieldName}`) SQL; break; - case 2: // UNIQUE KEY + case 3: // UNIQUE KEY $ret = <<<SQL UNIQUE KEY `{$fieldName}` (`{$fieldName}`) SQL; break; - case 3: // KEY + case 4: // KEY $ret = <<<SQL KEY `{$fieldName}` (`{$fieldName}`) SQL; break; - case 4: // INDEX + case 5: // INDEX $ret = <<<SQL INDEX (`{$fieldName}`) SQL; break; - case 5: // FULLTEXT KEY + case 6: // FULLTEXT KEY $ret = <<<SQL FULLTEXT KEY `{$fieldName}` (`{$fieldName}`) SQL; Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/pages.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/pages.php 2014-07-11 18:06:57 UTC (rev 12703) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/pages.php 2014-07-12 07:41:43 UTC (rev 12704) @@ -135,10 +135,10 @@ } $ret .= <<<EOT <td class="center"> - <a href="{$tableName}.php?op=edit&{$field_id}=<{\$list.{$rp_field_id}}>" title="<{\$smarty.const._EDIT}>"> + <a href="{$tableName}.php?op=edit&{$field_id}=<{\$list.{$rpFieldName}}>" title="<{\$smarty.const._EDIT}>"> <img src="<{xoModuleIcons16 edit.png}>" alt="<{\$smarty.const._EDIT}>" /> </a> - <a href="{$tableName}.php?op=delete&{$field_id}=<{\$list.{$rp_field_id}}>" title="<{\$smarty.const._DELETE}>"> + <a href="{$tableName}.php?op=delete&{$field_id}=<{\$list.{$rpFieldName}}>" title="<{\$smarty.const._DELETE}>"> <img src="<{xoModuleIcons16 delete.png}>" alt="<{\$smarty.const._DELETE}>" /> </a> </td> 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-07-11 18:06:57 UTC (rev 12703) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/xoopsversion.php 2014-07-12 07:41:43 UTC (rev 12704) @@ -359,7 +359,7 @@ $fields = $this->getTableFields($table->getVar('table_id')); foreach (array_keys($fields) as $f) { - if( $fields[$f]->getVar('field_element') == 3 ) { + if( $fields[$f]->getVar('field_element') == 4 ) { $ret .= <<<EOT // Editor xoops_load('xoopseditorhandler'); Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/sql/mysql.sql =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/sql/mysql.sql 2014-07-11 18:06:57 UTC (rev 12703) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/sql/mysql.sql 2014-07-12 07:41:43 UTC (rev 12704) @@ -140,7 +140,7 @@ )ENGINE =MyISAM; INSERT INTO `tdmcreate_fieldtype` (`fieldtype_id`, `fieldtype_name`, `fieldtype_value`) VALUES - (1, '', ''), + (1, '...', ''), (2, 'INT', 'INT'), (3, 'TINYINT', 'TINYINT'), (4, 'MEDIUMINT', 'MEDIUMINT'), @@ -177,7 +177,7 @@ )ENGINE =MyISAM; INSERT INTO `tdmcreate_fieldattributes` (`fieldattribute_id`, `fieldattribute_name`, `fieldattribute_value`) VALUES - (1, '', ''), + (1, '...', ''), (2, 'BINARY', 'BINARY'), (3, 'UNSIGNED', 'UNSIGNED'), (4, 'UNSIGNED_ZEROFILL', 'UNSIGNED_ZEROFILL'), @@ -196,7 +196,7 @@ )ENGINE =MyISAM; INSERT INTO `tdmcreate_fieldnull` (`fieldnull_id`, `fieldnull_name`, `fieldnull_value`) VALUES - (1, '', ''), + (1, '...', ''), (2, 'NOT NULL', 'NOT NULL'), (3, 'NULL', 'NULL'); @@ -213,7 +213,7 @@ )ENGINE =MyISAM; INSERT INTO `tdmcreate_fieldkey` (`fieldkey_id`, `fieldkey_name`, `fieldkey_value`) VALUES - (1, '', ''), + (1, '...', ''), (2, 'PRIMARY', 'PRIMARY'), (3, 'UNIQUE', 'UNIQUE'), (4, 'KEY', 'KEY'), @@ -236,7 +236,7 @@ )ENGINE =MyISAM; INSERT INTO `tdmcreate_fieldelements` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES - (1, 0, 0, '', ''), + (1, 0, 0, '...', ''), (2, 0, 0, 'Text', 'XoopsFormText'), (3, 0, 0, 'TextArea', 'XoopsFormTextArea'), (4, 0, 0, 'DhtmlTextArea', 'XoopsFormDhtmlTextArea'), Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/templates/admin/tdmcreate_tables.tpl =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/templates/admin/tdmcreate_tables.tpl 2014-07-11 18:06:57 UTC (rev 12703) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/templates/admin/tdmcreate_tables.tpl 2014-07-12 07:41:43 UTC (rev 12704) @@ -32,7 +32,7 @@ </td> <td class='center bold green'><{$module.name}></td> <td class='center'><img src="<{$tdmc_upload_imgmod_url}>/<{$module.image}>" alt="" height="35" /></td> - <td class='center'><img src="<{$modPathIcon16}>/nb_fields.png" alt="16" /></td> + <td class='center'><img src="<{$modPathIcon16}>/fields.png" alt="16" /></td> <td class='center'><img src="<{$modPathIcon16}>/blocks.png" alt="16" /></td> <td class='center'><img id="loading_img_admin<{$module.id}>" src="<{$modPathIcon16}>/spinner.gif" style="display:none;" title="<{$smarty.const._AM_SYSTEM_LOADING}>" alt="<{$smarty.const._AM_SYSTEM_LOADING}>" /><img style="cursor:pointer;" class="tooltip" id="img_admin<{$module.id}>" onclick="tdmcreate_setStatus( { op: 'display', mod_id: <{$module.id}>, mod_admin: <{if $module.admin == 1}>0<{else}>1<{/if}> }, 'img_admin<{$module.id}>', 'modules.php' )" src="<{xoModuleIcons16}><{$module.admin}>.png" alt="<{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}>" title="<{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}>" /> </td> |
From: <txm...@us...> - 2014-07-13 10:24:24
|
Revision: 12709 http://sourceforge.net/p/xoops/svn/12709 Author: txmodxoops Date: 2014-07-13 10:24:13 +0000 (Sun, 13 Jul 2014) Log Message: ----------- - Fixed bugs - Updated - Still work to do Modified Paths: -------------- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/tables.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/objects.php 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/blocks.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/install.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/admin.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/structure.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/pages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/pages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/objects.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/pages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/sql/mysql.sql Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/tables.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/tables.php 2014-07-13 00:34:40 UTC (rev 12708) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/tables.php 2014-07-13 10:24:13 UTC (rev 12709) @@ -202,7 +202,7 @@ if( $tablesObj->isNew() ) { $tableIid = $GLOBALS['xoopsDB']->getInsertId(); $table_action='&field_mid='.$tableMid.'&field_tid='.$tableIid.'&field_numb='.$tableNumbFields.'&field_name='.$tableFieldname; - redirect_header('fields.php?op=new'.$table_action, 5, sprintf(_AM_TDMCREATE_TABLE_FORM_SAVED_OK, $_POST['table_name'])); + redirect_header('fields.php?op=new'.$table_action, 5, sprintf(_AM_TDMCREATE_TABLE_FORM_CREATED_OK, $_POST['table_name'])); } else { // Get fields where table id $fields =& $tdmcreate->getHandler('fields'); Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/objects.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/objects.php 2014-07-13 00:34:40 UTC (rev 12708) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/objects.php 2014-07-13 10:24:13 UTC (rev 12709) @@ -169,6 +169,22 @@ return $ret; } /* + * @public function getUploadImageGetVar + * @param string $lpFieldName + * @param string $rpFieldName + * @param string $tableName + * @param string $fieldName + */ + public function getUploadImageGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { + $ret = <<<EOT +\t\t\t\t// Get Var {$fieldName} +\t\t\t\t\${$fieldName} = \${$tableName}_arr[\$i]->getVar('{$fieldName}'); +\t\t\t\t\$upload_image = \${$fieldName} ? \${$fieldName} : 'blank.gif'; +\t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = \$upload_image;\n +EOT; + return $ret; + } + /* * @public function getTextAreaGetVar * @param string $lpFieldName * @param string $rpFieldName 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-07-13 00:34:40 UTC (rev 12708) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/pages.php 2014-07-13 10:24:13 UTC (rev 12709) @@ -61,7 +61,7 @@ * @param string $moduleDirname * @param string $tableName */ - public function getAdminPagesHeader($moduleDirname, $tableName, $fpif) { + public function getAdminPagesHeader($moduleDirname, $table, $fpif) { $ret = <<<EOT include_once 'header.php'; @@ -127,9 +127,12 @@ case 4: $ret .= $this->adminobjects->getTextAreaGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); break; - case 5: + case 8: $ret .= $this->adminobjects->getSelectUserGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); - break; + break; + case 11: + $ret .= $this->adminobjects->getUploadImageGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); + break; case 13: $ret .= $this->adminobjects->getTextDateSelectGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); break; Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/architecture.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/architecture.php 2014-07-13 00:34:40 UTC (rev 12708) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/architecture.php 2014-07-13 10:24:13 UTC (rev 12709) @@ -320,6 +320,10 @@ } // Creation of blocks language file if (is_object($table)) { + // Include Install File + $includeInstall = IncludeInstall::getInstance(); + $includeInstall->write($module, $table, $tables, 'install.php'); + $ret[] = $includeInstall->render(); if ( $table->getVar('table_blocks') == 1) { // Language Blocks File $languageBlocks = LanguageBlocks::getInstance(); @@ -354,11 +358,7 @@ $languageMailTpl = LanguageMailTpl::getInstance(); $languageMailTpl->write($module); $ret[] = $languageMailTpl->renderFile('category_new_notify.tpl'); - } - // Include Install File - $includeInstall = IncludeInstall::getInstance(); - $includeInstall->write($module, $table, $tables, 'install.php'); - $ret[] = $includeInstall->render(); + } // Creation of sql file if ( $table->getVar('table_name') != null) { // Sql File Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/blocks/blocks.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/blocks/blocks.php 2014-07-13 00:34:40 UTC (rev 12708) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/blocks/blocks.php 2014-07-13 10:24:13 UTC (rev 12709) @@ -60,7 +60,7 @@ $ucfModuleDirname = ucfirst($moduleDirname); $ret = <<<EOT include_once XOOPS_ROOT_PATH.'/modules/{$moduleDirname}/include/common.php'; -include_once XOOPS_ROOT_PATH.'/modules/{$moduleDirname}/include/functions.php'; +// Function show block function b_{$moduleDirname}_{$tableName}_show(\$options) { include_once XOOPS_ROOT_PATH.'/modules/{$moduleDirname}/class/{$tableName}.php'; @@ -128,6 +128,7 @@ $stuModuleDirname = strtoupper($moduleDirname); $ucfModuleDirname = ucfirst($moduleDirname); $ret = <<<EOT +// Function edit block function b_{$moduleDirname}_{$tableName}_edit(\$options) { include_once XOOPS_ROOT_PATH.'/modules/{$moduleDirname}/class/{$tableName}.php'; 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-07-13 00:34:40 UTC (rev 12708) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/install.php 2014-07-13 10:24:13 UTC (rev 12709) @@ -181,7 +181,7 @@ $fieldElement = $fields[$f]->getVar('field_element'); // All fields elements selected switch( $fieldElement ) { - case 10: + case 11: $content .= $this->getInstallImagesFolder($moduleDirname); foreach(array_keys($tables) as $t) { @@ -189,7 +189,7 @@ $content .= $this->getInstallTableImagesFolder($tableName); } break; - case 11: + case 12: $content .= $this->getInstallFilesFolder($moduleDirname); foreach(array_keys($tables) as $t) { Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/admin.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/admin.php 2014-07-13 00:34:40 UTC (rev 12708) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/admin.php 2014-07-13 10:24:13 UTC (rev 12709) @@ -165,17 +165,17 @@ EOT; switch($fieldElement) { - case 9: + case 10: $ret .= <<<EOT define('{$language}FORM_UPLOAD_IMAGE_LIST_{$stuTableName}', "{$fieldNameDesc} in frameworks images");\n EOT; break; - case 10: + case 11: $ret .= <<<EOT define('{$language}FORM_UPLOAD_IMAGE_{$stuTableName}', "{$fieldNameDesc} in uploads images");\n EOT; break; - case 11: + case 12: $ret .= <<<EOT define('{$language}FORM_UPLOAD_FILE_{$stuTableName}', "{$fieldNameDesc} in uploads files");\n EOT; Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/structure.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/structure.php 2014-07-13 00:34:40 UTC (rev 12708) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/structure.php 2014-07-13 10:24:13 UTC (rev 12709) @@ -43,6 +43,10 @@ */ private $path = null; /* + * @var mixed + */ + //private $uploadPath = null; + /* * @var string */ private $fromFile = null; @@ -70,12 +74,40 @@ return $instance; } /* + * @public function setPath + * @param string $path + */ + /*public function setPath($path) { + $this->path = TDMC_PATH . DIRECTORY_SEPARATOR . $path; + }*/ + /* + * @public function setUploadPath + * @param string $path + */ + /*public function setUploadPath($path) { + $this->uploadPath = TDMC_UPLOAD_PATH . DIRECTORY_SEPARATOR . $path; + }*/ + /* * @public function getPath * @param string $path */ + /*public function getPath() { + return $this->path; + }*/ + /* + * @public function getUploadPath + * @param string $path + */ + /*public function getUploadPath() { + return $this->uploadPath; + }*/ + /* + * @public function getPath + * @param string $path + */ public function getPath($path) { $this->path = $path; - } + } /* * @public function isDir * @param string $dname Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/pages.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/pages.php 2014-07-13 00:34:40 UTC (rev 12708) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/pages.php 2014-07-13 10:24:13 UTC (rev 12709) @@ -58,7 +58,9 @@ * @param string $fields * @param string $language */ - private function getTemplatesAdminPagesHeader($moduleDirname, $tableName, $fields, $language) { + private function getTemplatesAdminPagesHeader($moduleDirname, $table, $fields, $language) + { + $tableName = $table->getVar('table_name'); $ret = <<<EOT <{include file="db:{$moduleDirname}_admin_header.tpl"}> <{if {$tableName}_list}> @@ -70,7 +72,8 @@ { $fieldName = $fields[$f]->getVar('field_name'); $lang_fn = $language.strtoupper($fieldName); - if( $fields[$f]->getVar('field_inlist') == 1 ) { + if( ($fields[$f]->getVar('field_inlist') == 1) || ($table->getVar('table_autoincrement') == 1) + ) { $ret .= <<<EOT <th class="center"><{\$smarty.const.{$lang_fn}}></th>\n EOT; @@ -90,8 +93,9 @@ * @param string $fields * @param string $language */ - private function getTemplatesAdminPagesBody($moduleDirname, $tableName, $fields, $language) + private function getTemplatesAdminPagesBody($moduleDirname, $table, $fields, $language) { + $tableName = $table->getVar('table_name'); $ret = <<<EOT <tbody> <{foreach item=list from=\${$tableName}_list}> @@ -108,7 +112,7 @@ $rpFieldName = $this->tdmcfile->getRightString($fieldName); } $lp_field_name = substr($fieldName, 0, strpos($fieldName, '_')); - if( $fields[$f]->getVar('field_inlist') == 1 ) { + if( ($fields[$f]->getVar('field_inlist') == 1) || ($table->getVar('table_autoincrement') == 1) ) { switch( $fieldElement ) { case 9: $ret .= <<<EOT @@ -156,8 +160,9 @@ * @param string $fields * @param string $language */ - private function getTemplatesAdminPagesBodyFieldnameEmpty($moduleDirname, $tableName, $fields, $language) + private function getTemplatesAdminPagesBodyFieldnameEmpty($moduleDirname, $table, $fields, $language) { + $tableName = $table->getVar('table_name'); $ret = <<<EOT <tbody> <{foreach item=list from=\${$tableName}_list}> @@ -169,8 +174,8 @@ $fieldElement = $fields[$f]->getVar('field_element'); if($f == 0) { $field_id = $fieldName; - } - if( $fields[$f]->getVar('field_inlist') == 1 ) { + } + if( ($fields[$f]->getVar('field_inlist') == 1) || ($table->getVar('table_autoincrement') == 1) ) { switch( $fieldElement ) { case 9: $ret .= <<<EOT @@ -222,11 +227,11 @@ <!-- Display navigation --> <div class="xo-pagenav floatright"><{\$pagenav}></div><div class="clear spacer"></div> <{/if}> - <{if \$error}> - <div class="errorMsg"> - <strong><{\$error}></strong> - </div> - <{/if}> +<{/if}> +<{if \$error}> + <div class="errorMsg"> + <strong><{\$error}></strong> + </div> <{/if}> <{if \$form}> <!-- Display form (add,edit) --> @@ -246,16 +251,15 @@ $module = $this->getModule(); $table = $this->getTable(); $moduleDirname = $module->getVar('mod_dirname'); - $tableName = $table->getVar('table_name'); $tableFieldname = $table->getVar('table_fieldname'); $language = $this->getLanguage($moduleDirname, 'AM'); $fields = $this->getTableFields($table->getVar('table_id')); - $content = $this->getTemplatesAdminPagesHeader($moduleDirname, $tableName, $fields, $language); + $content = $this->getTemplatesAdminPagesHeader($moduleDirname, $table, $fields, $language); // Verify if table_fieldname is not empty if(!empty($tableFieldname)) { - $content .= $this->getTemplatesAdminPagesBody($moduleDirname, $tableName, $fields, $language); + $content .= $this->getTemplatesAdminPagesBody($moduleDirname, $table, $fields, $language); } else { - $content .= $this->getTemplatesAdminPagesBodyFieldnameEmpty($moduleDirname, $tableName, $fields, $language); + $content .= $this->getTemplatesAdminPagesBodyFieldnameEmpty($moduleDirname, $table, $fields, $language); } $content .= $this->getTemplatesAdminPagesFooter($moduleDirname); // Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/pages.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/pages.php 2014-07-13 00:34:40 UTC (rev 12708) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/pages.php 2014-07-13 10:24:13 UTC (rev 12709) @@ -71,7 +71,7 @@ { $fieldName = $fields[$f]->getVar('field_name'); $langStuFieldName = $language.strtoupper($fieldName); - if( $fields[$f]->getVar('field_user') == 1 ) { + if( ($fields[$f]->getVar('field_user') == 1) || ($table->getVar('table_autoincrement') == 1) ) { $ret .= <<<EOT <th class="center"><{\$smarty.const.{$langStuFieldName}}></th>\n EOT; @@ -103,7 +103,7 @@ $fieldName = $fields[$f]->getVar('field_name'); $fieldElement = $fields[$f]->getVar('field_element'); $rpFieldName = $this->tdmcfile->getRightString($fieldName); - if( $fields[$f]->getVar('field_user') == 1 ) { + if( ($fields[$f]->getVar('field_user') == 1) || ($table->getVar('table_autoincrement') == 1) ) { switch( $fieldElement ) { case 9: $ret .= <<<EOT @@ -155,7 +155,7 @@ { $fieldName = $fields[$f]->getVar('field_name'); $fieldElement = $fields[$f]->getVar('field_element'); - if( $fields[$f]->getVar('field_user') == 1 ) { + if( ($fields[$f]->getVar('field_user') == 1) || ($table->getVar('table_autoincrement') == 1) ) { switch( $fieldElement ) { case 9: $ret .= <<<EOT Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/objects.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/objects.php 2014-07-13 00:34:40 UTC (rev 12708) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/objects.php 2014-07-13 10:24:13 UTC (rev 12709) @@ -16,7 +16,7 @@ * @package tdmcreate * @since 2.5.0 * @author Txmod Xoops http://www.txmodxoops.org - * @version $Id: user_objects.php 12258 2014-01-02 09:33:29Z timgno $ + * @version $Id: objects.php 12258 2014-01-02 09:33:29Z timgno $ */ defined('XOOPS_ROOT_PATH') or die('Restricted access'); @@ -78,12 +78,28 @@ */ public function getSimpleGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { $ret = <<<EOT -\t\t\t// Get Var {$fieldName} -\t\t\t\${$lpFieldName}['{$rpFieldName}'] = \${$tableName}_arr[\$i]->getVar('{$fieldName}');\n +\t\t// Get Var {$fieldName} +\t\t\${$lpFieldName}['{$rpFieldName}'] = \${$tableName}_arr[\$i]->getVar('{$fieldName}');\n EOT; return $ret; } /* + * @public function getUploadImageGetVar + * @param string $lpFieldName + * @param string $rpFieldName + * @param string $tableName + * @param string $fieldName + */ + public function getUploadImageGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { + $ret = <<<EOT +\t\t// Get Var {$fieldName} +\t\t\${$fieldName} = \${$tableName}_arr[\$i]->getVar('{$fieldName}'); +\t\t\$upload_image = \${$fieldName} ? \${$fieldName} : 'blank.gif'; +\t\t\${$lpFieldName}['{$rpFieldName}'] = \$upload_image;\n +EOT; + return $ret; + } + /* * @public function getTextAreaGetVar * @param string $lpFieldName * @param string $rpFieldName @@ -92,8 +108,8 @@ */ public function getTextAreaGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { $ret = <<<EOT -\t\t\t// Get Var {$fieldName} -\t\t\t\${$lpFieldName}['{$rpFieldName}'] = strip_tags(\${$tableName}_arr[\$i]->getVar('{$fieldName}'));\n +\t\t// Get Var {$fieldName} +\t\t\${$lpFieldName}['{$rpFieldName}'] = strip_tags(\${$tableName}_arr[\$i]->getVar('{$fieldName}'));\n EOT; return $ret; } @@ -106,8 +122,8 @@ */ public function getSelectUserGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { $ret = <<<EOT -\t\t\t// Get Var {$fieldName} -\t\t\t\${$lpFieldName}['{$rpFieldName}'] = XoopsUser::getUnameFromId(\${$tableName}_arr[\$i]->getVar('{$fieldName}'), 's');\n +\t\t// Get Var {$fieldName} +\t\t\${$lpFieldName}['{$rpFieldName}'] = XoopsUser::getUnameFromId(\${$tableName}_arr[\$i]->getVar('{$fieldName}'), 's');\n EOT; return $ret; } @@ -120,8 +136,8 @@ */ public function getTextDateSelectGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { $ret = <<<EOT -\t\t\t// Get Var {$fieldName} -\t\t\t\${$lpFieldName}['{$rpFieldName}'] = formatTimeStamp(\${$tableName}_arr[\$i]->getVar('{$fieldName}'), 's');\n +\t\t// Get Var {$fieldName} +\t\t\${$lpFieldName}['{$rpFieldName}'] = formatTimeStamp(\${$tableName}_arr[\$i]->getVar('{$fieldName}'), 's');\n EOT; 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-07-13 00:34:40 UTC (rev 12708) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/pages.php 2014-07-13 10:24:13 UTC (rev 12709) @@ -67,10 +67,10 @@ $table = $this->getTable(); $tableName = $table->getVar('table_name'); $tableFieldname = $table->getVar('table_fieldname'); - $tableAutoincrement = $table->getVar('table_autoincrement'); $stuModuleDirname = strtoupper($moduleDirname); $stuTableName = strtoupper($tableName); $stlTableName = strtolower($tableName); + $ucfTableName = ucfirst($tableName); $ret = <<<EOT \ninclude_once 'header.php'; \$GLOBALS['xoopsOption']['template_main'] = '{$moduleDirname}_{$tableName}.tpl'; @@ -84,9 +84,10 @@ // \$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_upload_url', {$stuModuleDirname}_UPLOAD_URL); // -\$criteria = new CriteriaCompo(); -\${$stlTableName}_count = \${$stlTableName}Handler->getCount(\$criteria); -\${$stlTableName}_arr = \${$stlTableName}Handler->getAll(\$criteria); +\$criteria{$ucfTableName} = new CriteriaCompo(); +\${$stlTableName}_count = \${$stlTableName}Handler->getCount(\$criteria{$ucfTableName}); +\${$stlTableName}_arr = \${$stlTableName}Handler->getAll(\$criteria{$ucfTableName}); +unset(\$criteria{$ucfTableName}); \$keywords = array(); if (\${$stlTableName}_count > 0) { foreach (array_keys(\${$stlTableName}_arr) as \$i) @@ -104,16 +105,19 @@ $fpmf = $fieldName; // fpmf = fields parameters main field } $fieldElement = $fields[$f]->getVar('field_element'); - if( ($fields[$f]->getVar('field_user') == 1) || ($tableAutoincrement == 1) ) { + if( ($fields[$f]->getVar('field_user') == 1) || ($table->getVar('table_autoincrement') == 1) ) { switch($fieldElement) { - case 2: case 3: + case 4: $ret .= $this->userobjects->getTextAreaGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); break; - case 7: + case 8: $ret .= $this->userobjects->getSelectUserGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); - break; - case 12: + break; + case 11: + $ret .= $this->userobjects->getUploadImageGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); + break; + case 13: $ret .= $this->userobjects->getTextDateSelectGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); break; default: Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/sql/mysql.sql =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/sql/mysql.sql 2014-07-13 00:34:40 UTC (rev 12708) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/sql/mysql.sql 2014-07-13 10:24:13 UTC (rev 12709) @@ -110,7 +110,8 @@ `field_required` TINYINT(1) NOT NULL DEFAULT '0', PRIMARY KEY (`field_id`), KEY `field_mid` (`field_mid`), - KEY `field_tid` (`field_tid`) + KEY `field_tid` (`field_tid`), + KEY `field_name` (`field_name`) )ENGINE =MyISAM; # |
From: <txm...@us...> - 2014-07-28 17:13:40
|
Revision: 12732 http://sourceforge.net/p/xoops/svn/12732 Author: txmodxoops Date: 2014-07-28 17:13:26 +0000 (Mon, 28 Jul 2014) Log Message: ----------- - Updated Modified Paths: -------------- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/fields.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/files/admin/header.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/objects.php 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/include/common.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/notifications.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/admin.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/blocks.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/templates/user/footer.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/header.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/index.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/objects.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/pages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/xoopsversion.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/sql/mysql.sql XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/templates/admin/tdmcreate_fields.tpl XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/templates/admin/tdmcreate_modules.tpl XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/templates/admin/tdmcreate_tables.tpl XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/xoops_version.php Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/fields.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/fields.php 2014-07-28 04:36:09 UTC (rev 12731) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/fields.php 2014-07-28 17:13:26 UTC (rev 12732) @@ -22,14 +22,14 @@ // Recovered value of arguments op in the URL $ $op = XoopsRequest::getString('op', 'list'); // Get fields Variables -$field_mid = TDMCreate_CleanVars($_REQUEST, 'field_mid'); +/*$fieldMid = TDMCreate_CleanVars($_REQUEST, 'field_mid'); $fieldTid = TDMCreate_CleanVars($_REQUEST, 'field_tid'); $fieldNumb = TDMCreate_CleanVars($_REQUEST, 'field_numb'); -$fieldName = TDMCreate_CleanVars($_REQUEST, 'field_name', '', 'string');/**/ -/*$field_mid = XoopsRequest::getInt('field_mid'); +$fieldName = TDMCreate_CleanVars($_REQUEST, 'field_name', '', 'string');*/ +$fieldMid = XoopsRequest::getInt('field_mid'); $fieldTid = XoopsRequest::getInt('field_tid'); $fieldNumb = XoopsRequest::getInt('field_numb'); -$fieldName = XoopsRequest::getString('field_name', ''); */ +$fieldName = XoopsRequest::getString('field_name'); /**/ // switch ($op) { @@ -53,66 +53,67 @@ $GLOBALS['xoopsTpl']->assign('sysPathIcon32', $sysPathIcon32); //var_dump($sysPathIcon32); // Redirect if there aren't modules - $nb_modules = $tdmcreate->getHandler('modules')->getCount(); - if ( $nb_modules == 0 ) { + $countModules = $tdmcreate->getHandler('modules')->getCount(); + if ( $countModules == 0 ) { redirect_header('modules.php?op=new', 2, _AM_TDMCREATE_NOTMODULES ); } - unset($nb_modules); + unset($countModules); // Redirect if there aren't tables - $nb_tables = $tdmcreate->getHandler('tables')->getCount(); - if ($nb_tables == 0) { + $countTables = $tdmcreate->getHandler('tables')->getCount(); + if ($countTables == 0) { redirect_header('tables.php?op=new', 2, _AM_TDMCREATE_NOTTABLES ); } - unset($nb_tables); + unset($countTables); // Get the list of tables $criteria = new CriteriaCompo(); $criteria->setSort('table_id ASC, table_name'); $criteria->setOrder('ASC'); - $nb_tables = $tdmcreate->getHandler('tables')->getCount($criteria); - $tables_arr = $tdmcreate->getHandler('tables')->getAll($criteria); + $countTables = $tdmcreate->getHandler('tables')->getCount($criteria); + $tablesAll = $tdmcreate->getHandler('tables')->getAll($criteria); unset($criteria); - if ($nb_tables > 0) + if ($countTables > 0) { - foreach (array_keys($tables_arr) as $tid) + foreach (array_keys($tablesAll) as $tid) { // Display tables list $table['id'] = $tid; - $table['mid'] = $tables_arr[$tid]->getVar('table_mid'); - $table['name'] = ucfirst($tables_arr[$tid]->getVar('table_name')); - $table['image'] = $tables_arr[$tid]->getVar('table_image'); - $table['nbfields'] = $tables_arr[$tid]->getVar('table_nbfields'); - $table['autoincrement'] = $tables_arr[$tid]->getVar('table_autoincrement'); - $table['blocks'] = $tables_arr[$tid]->getVar('table_blocks'); - $table['admin'] = $tables_arr[$tid]->getVar('table_admin'); - $table['user'] = $tables_arr[$tid]->getVar('table_user'); - $table['search'] = $tables_arr[$tid]->getVar('table_search'); + $table['mid'] = $tablesAll[$tid]->getVar('table_mid'); + $table['name'] = ucfirst($tablesAll[$tid]->getVar('table_name')); + $table['image'] = $tablesAll[$tid]->getVar('table_image'); + $table['nbfields'] = $tablesAll[$tid]->getVar('table_nbfields'); + $table['autoincrement'] = $tablesAll[$tid]->getVar('table_autoincrement'); + $table['blocks'] = $tablesAll[$tid]->getVar('table_blocks'); + $table['admin'] = $tablesAll[$tid]->getVar('table_admin'); + $table['user'] = $tablesAll[$tid]->getVar('table_user'); + $table['search'] = $tablesAll[$tid]->getVar('table_search'); // Get the list of fields $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('field_mid', $table['mid'])); $criteria->add(new Criteria('field_tid', $tid)); $criteria->setSort('field_id ASC, field_name'); $criteria->setOrder('ASC'); - $nb_fields = $tdmcreate->getHandler('fields')->getCount($criteria); - $fields_arr = $tdmcreate->getHandler('fields')->getObjects($criteria); + $countFields = $tdmcreate->getHandler('fields')->getCount($criteria); + $fieldsAll = $tdmcreate->getHandler('fields')->getObjects($criteria); unset($criteria); // Display fields list $fields = array(); $lid = 1; - if ( $nb_fields > 0 ) + if ( $countFields > 0 ) { - foreach (array_keys($fields_arr) as $fid) + foreach (array_keys($fieldsAll) as $fid) { $field['id'] = $fid; $field['lid'] = $lid; - $field['name'] = str_replace('_', ' ', ucfirst($fields_arr[$fid]->getVar('field_name'))); - $field['parent'] = $fields_arr[$fid]->getVar('field_parent'); - $field['inlist'] = $fields_arr[$fid]->getVar('field_inlist'); - $field['inform'] = $fields_arr[$fid]->getVar('field_inform'); - $field['admin'] = $fields_arr[$fid]->getVar('field_admin'); - $field['user'] = $fields_arr[$fid]->getVar('field_user'); - $field['block'] = $fields_arr[$fid]->getVar('field_block'); - $field['main'] = $fields_arr[$fid]->getVar('field_main'); - $field['search'] = $fields_arr[$fid]->getVar('field_search'); - $field['required'] = $fields_arr[$fid]->getVar('field_required'); + $field['name'] = str_replace('_', ' ', ucfirst($fieldsAll[$fid]->getVar('field_name'))); + $field['parent'] = $fieldsAll[$fid]->getVar('field_parent'); + $field['inlist'] = $fieldsAll[$fid]->getVar('field_inlist'); + $field['inform'] = $fieldsAll[$fid]->getVar('field_inform'); + $field['admin'] = $fieldsAll[$fid]->getVar('field_admin'); + $field['user'] = $fieldsAll[$fid]->getVar('field_user'); + $field['block'] = $fieldsAll[$fid]->getVar('field_block'); + $field['main'] = $fieldsAll[$fid]->getVar('field_main'); + $field['search'] = $fieldsAll[$fid]->getVar('field_search'); + $field['required'] = $fieldsAll[$fid]->getVar('field_required'); $fields[] = $field; unset($field); $lid++; @@ -123,14 +124,18 @@ $GLOBALS['xoopsTpl']->append('tables_list', $table); unset($table); } - if ( $nb_tables > $limit ) { + if ( $countTables > $limit ) { include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new XoopsPageNav($nb_tables, $limit, $start, 'start', 'op=list&limit=' . $limit); + $pagenav = new XoopsPageNav($countTables, $limit, $start, 'start', 'op=list&limit=' . $limit); $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); } } else { $GLOBALS['xoopsTpl']->assign('error', _AM_TDMCREATE_THEREARENT_FIELDS); - } + } + var_dump($fieldMid); + var_dump($fieldTid); + var_dump($fieldNumb); + var_dump($fieldName); break; case 'new': @@ -144,10 +149,10 @@ $GLOBALS['xoopsTpl']->assign('buttons', $adminMenu->renderButton()); // Form Add $fieldsObj =& $tdmcreate->getHandler('fields')->create(); - $form = $fieldsObj->getFormNew($field_mid, $fieldTid, $fieldNumb, $fieldName); + $form = $fieldsObj->getFormNew($fieldMid, $fieldTid, $fieldNumb, $fieldName); $GLOBALS['xoopsTpl']->assign('form', $form->render()); // Test -> Will be removed - var_dump($field_mid); + var_dump($fieldMid); var_dump($fieldTid); var_dump($fieldNumb); var_dump($fieldName); @@ -172,9 +177,9 @@ $fieldsObj =& $fields->get($value); break; } - if (isset($field_mid) && isset($fieldTid) && !empty($_POST['field_name'][$key])) { + if (isset($fieldMid) && isset($fieldTid) && !empty($_POST['field_name'][$key])) { // Set Data - $fieldsObj->setVar( 'field_mid', $field_mid ); + $fieldsObj->setVar( 'field_mid', $fieldMid ); $fieldsObj->setVar( 'field_tid', $fieldTid ); $fieldsObj->setVar( 'field_numb', $fieldNumb ); $fieldsObj->setVar( 'field_name', (isset($_POST['field_name'][$key]) ? $_POST['field_name'][$key] : '') ); @@ -205,7 +210,7 @@ if ($fieldsObj->isNew()) { // Fields Elements Handler $fieldelementObj =& $tdmcreate->getHandler('fieldelements')->create(); - $fieldelementObj->setVar( 'fieldelement_mid', $field_mid ); + $fieldelementObj->setVar( 'fieldelement_mid', $fieldMid ); $fieldelementObj->setVar( 'fieldelement_tid', $fieldTid ); $fieldelementObj->setVar( 'fieldelement_name', 'Table : '.ucfirst($table_name) ); $fieldelementObj->setVar( 'fieldelement_value', 'XoopsFormTables-'.ucfirst($table_name) ); @@ -234,7 +239,7 @@ // Form Edit $fieldId = XoopsRequest::getInt('field_id'); $fieldsObj = $tdmcreate->getHandler('fields')->get( $fieldId ); - $form = $fieldsObj->getFormEdit($field_mid, $fieldTid); + $form = $fieldsObj->getFormEdit($fieldMid, $fieldTid); $GLOBALS['xoopsTpl']->assign('form', $form->render()); // Test -> Will be removed var_dump($fieldTid); @@ -270,61 +275,46 @@ exit; break; - case 'display': - $fieldId = XoopsRequest::getInt('field_id'); - // Get the list of fields - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('field_tid', $fieldTid)); - $fields = $tdmcreate->getHandler('fields')->getObjects($criteria); - $fieldsObj =& $tdmcreate->getHandler('fields')->get($fieldId); - if (isset($_GET['field_tid'])) { - if (isset($_GET['field_parent'])) { - foreach ($fields as $field) { - $fld_parent = $field->getVar('field_parent'); - $field_parent = ($field->getVar('field_id') == $fld_parent) ? '1' : '0'; - $fieldsObj->setVar('field_parent', $field_parent); - } - } elseif (isset($_GET['field_inlist'])) { - $fld_inlist = intval($_GET['field_inlist']); - $field_inlist = ($fld_inlist == 1) ? '0' : '1'; - $fieldsObj->setVar('field_inlist', $field_inlist); - } elseif (isset($_GET['field_inform'])) { - $fld_inform = intval($_GET['field_inform']); - $field_inform = ($fld_inform == 1) ? '0' : '1'; - $fieldsObj->setVar('field_inform', $field_inform); - } elseif (isset($_GET['field_admin'])) { - $fld_admin = intval($_GET['field_admin']); - $field_admin = ($fld_admin == 1) ? '0' : '1'; - $fieldsObj->setVar('field_admin', $field_admin); - } elseif (isset($_GET['field_user'])) { - $fld_user = intval($_GET['field_user']); - $field_user = ($fld_user == 1) ? '0' : '1'; - $fieldsObj->setVar('field_user', $field_user); - } elseif (isset($_GET['field_block'])) { - $fld_block = intval($_GET['field_block']); - $field_block = ($fld_block == 1) ? '0' : '1'; - $fieldsObj->setVar('field_block', $field_block); - } elseif (isset($_GET['field_main'])) { - foreach ($fields as $field) { - $fld_main = $field->getVar('field_main'); - $field_main = ($field->getVar('field_id') == $fld_main) ? '1' : '0'; - $fieldsObj->setVar('field_main', $field_main); - } - } elseif (isset($_GET['field_search'])) { - $fld_search = intval($_GET['field_search']); - $field_search = ($fld_search == 1) ? '0' : '1'; - $fieldsObj->setVar('field_search', $field_search); - } elseif (isset($_GET['field_required'])) { - $fld_required = intval($_GET['field_required']); - $field_required = ($fld_required == 1) ? '0' : '1'; - $fieldsObj->setVar('field_required', $field_required); - } - if ($tdmcreate->getHandler('fields')->insert($fieldsObj, true)) { - redirect_header('fields.php', 3, _AM_TDMCREATE_TOGGLE_SUCCESS); - } else { - redirect_header('fields.php', 3, _AM_TDMCREATE_TOGGLE_FAILED); - } - } + case 'display': + // + $fields = $tdmcreate->getHandler('fields'); + // Fields Handler + foreach($_REQUEST['field_id'] as $key => $value) + { + /*$fieldId = XoopsRequest::getInt('field_id'); + $fieldParent = XoopsRequest::getInt('field_parent'); + $fieldInlist = XoopsRequest::getInt('field_inlist'); + $fieldInform = XoopsRequest::getInt('field_inform'); + $fieldAdmin = XoopsRequest::getInt('field_admin'); + $fieldUser = XoopsRequest::getInt('field_user'); + $fieldBlock = XoopsRequest::getInt('field_block'); + $fieldMain = XoopsRequest::getInt('field_main'); + $fieldSearch = XoopsRequest::getInt('field_search'); + $fieldRequired = XoopsRequest::getInt('field_required');*/ + + $fieldsObj =& $fields->get($value); + /*$fieldsObj->setVar('field_parent', $fieldParent); + $fieldsObj->setVar('field_inlist', $fieldInlist); + $fieldsObj->setVar('field_inform', $fieldInform); + $fieldsObj->setVar('field_admin', $fieldAdmin); + $fieldsObj->setVar('field_user', $fieldUser); + $fieldsObj->setVar('field_block', $fieldBlock); + $fieldsObj->setVar('field_main', $fieldMain); + $fieldsObj->setVar('field_search', $fieldSearch); + $fieldsObj->setVar('field_required', $fieldRequired);*/ + $fieldsObj->setVar( 'field_parent', $_POST['field_parent'][$key]); + $fieldsObj->setVar( 'field_inlist', $_POST['field_inlist'][$key]); + $fieldsObj->setVar( 'field_inform', $_POST['field_inform'][$key]); + $fieldsObj->setVar( 'field_admin', $_POST['field_admin'][$key]); + $fieldsObj->setVar( 'field_user', $_POST['field_user'][$key]); + $fieldsObj->setVar( 'field_block', $_POST['field_block'][$key]); + $fieldsObj->setVar( 'field_main', $_POST['field_main'][$key]); + $fieldsObj->setVar( 'field_search', $_POST['field_search'][$key]); + $fieldsObj->setVar( 'field_required', $_POST['field_required'][$key]); + // + $fields->insert($fieldsObj, true); + } + redirect_header('fields.php', 3, _AM_TDMCREATE_TOGGLE_SUCCESS); break; } include 'footer.php'; \ No newline at end of file Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/modules.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/modules.php 2014-07-28 04:36:09 UTC (rev 12731) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/modules.php 2014-07-28 17:13:26 UTC (rev 12732) @@ -61,7 +61,8 @@ $mod['release'] = $mods_arr[$i]->getVar('mod_release'); $mod['status'] = $mods_arr[$i]->getVar('mod_status'); $mod['admin'] = $mods_arr[$i]->getVar('mod_admin'); - $mod['user'] = $mods_arr[$i]->getVar('mod_user'); + $mod['user'] = $mods_arr[$i]->getVar('mod_user'); + $mod['blocks'] = $mods_arr[$i]->getVar('mod_blocks'); $mod['search'] = $mods_arr[$i]->getVar('mod_search'); $mod['comments'] = $mods_arr[$i]->getVar('mod_comments'); $mod['notifications'] = $mods_arr[$i]->getVar('mod_notifications'); @@ -205,19 +206,32 @@ break; case 'display': - $mod_admin = XoopsRequest::getInt('mod_admin'); - $mod_user = XoopsRequest::getInt('mod_user'); - $mod_search = XoopsRequest::getInt('mod_search'); - $mod_comments = XoopsRequest::getInt('mod_comments'); - $mod_notifications = XoopsRequest::getInt('mod_notifications'); - $mod_permissions = XoopsRequest::getInt('mod_permissions'); - - if ( $mod_id > 0 ) { + //if ( $mod_id > 0 ) { + $mod_admin = XoopsRequest::getInt('mod_admin'); + $mod_user = XoopsRequest::getInt('mod_user'); + $mod_blocks = XoopsRequest::getInt('mod_blocks'); + $mod_search = XoopsRequest::getInt('mod_search'); + $mod_comments = XoopsRequest::getInt('mod_comments'); + $mod_notifications = XoopsRequest::getInt('mod_notifications'); + $mod_permissions = XoopsRequest::getInt('mod_permissions'); + + //foreach($_POST['mod_id'] as $key => $value) + //{ + /*$mod_admin = TDMCreate_CleanVars($_REQUEST, 'mod_admin'); + $mod_user = TDMCreate_CleanVars($_REQUEST, 'mod_user'); + $mod_blocks = TDMCreate_CleanVars($_REQUEST, 'mod_blocks'); + $mod_search = TDMCreate_CleanVars($_REQUEST, 'mod_search'); + $mod_comments = TDMCreate_CleanVars($_REQUEST, 'mod_comments'); + $mod_notifications = TDMCreate_CleanVars($_REQUEST, 'mod_notifications'); + $mod_permissions = TDMCreate_CleanVars($_REQUEST, 'mod_permissions'); */ + $modulesObj =& $tdmcreate->getHandler('modules')->get($mod_id); - if(isset($mod_adminm)) { + if(isset($mod_admin)) { $modulesObj->setVar('mod_admin', $mod_admin); } elseif(isset($mod_user)) { $modulesObj->setVar('mod_user', $mod_user); + } elseif(isset($mod_blocks)) { + $modulesObj->setVar('mod_blocks', $mod_blocks); } elseif(isset($mod_search)) { $modulesObj->setVar('mod_search', $mod_search); } elseif(isset($mod_comments)) { @@ -232,7 +246,7 @@ } else { redirect_header('modules.php', 1, _AM_TDMCREATE_TOGGLE_FAILED); } - } + //} break; } include 'footer.php'; \ No newline at end of file Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/tables.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/tables.php 2014-07-28 04:36:09 UTC (rev 12731) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/tables.php 2014-07-28 17:13:26 UTC (rev 12732) @@ -76,7 +76,8 @@ $mod['name'] = $mods_arr[$i]->getVar('mod_name'); $mod['image'] = $mods_arr[$i]->getVar('mod_image'); $mod['admin'] = $mods_arr[$i]->getVar('mod_admin'); - $mod['user'] = $mods_arr[$i]->getVar('mod_user'); + $mod['user'] = $mods_arr[$i]->getVar('mod_user'); + $mod['blocks'] = $mods_arr[$i]->getVar('mod_blocks'); $mod['search'] = $mods_arr[$i]->getVar('mod_search'); $mod['comments'] = $mods_arr[$i]->getVar('mod_comments'); $mod['notifications'] = $mods_arr[$i]->getVar('mod_notifications'); @@ -248,41 +249,63 @@ } break; - case 'display': - $tableBlocks = XoopsRequest::getInt('table_blocks'); - $tableAdmin = XoopsRequest::getInt('table_admin'); - $tableUser = XoopsRequest::getInt('table_user'); - $tableSubmenu = XoopsRequest::getInt('table_submenu'); - $tableSearch = XoopsRequest::getInt('table_search'); - $tableComments = XoopsRequest::getInt('table_comments'); - $tableNotifications = XoopsRequest::getInt('table_notifications'); - $tablePermissions = XoopsRequest::getInt('table_permissions'); - - if ( $tableId > 0 ) { - $tablesObj =& $tdmcreate->getHandler('tables')->get($tableId); - if(isset($tableBlocks)) { - $tablesObj->setVar('table_blocks', $tableBlocks); - } elseif(isset($tableAdminm)) { - $tablesObj->setVar('table_admin', $tableAdmin); - } elseif(isset($tableUser)) { - $tablesObj->setVar('table_user', $tableUser); - } elseif(isset($tableSubmenu)) { - $tablesObj->setVar('table_submenu', $tableSubmenu); - } elseif(isset($tableSearch)) { - $tablesObj->setVar('table_search', $tableSearch); - } elseif(isset($tableComments)) { - $tablesObj->setVar('table_comments', $tableComments); - } elseif(isset($tableNotifications)) { - $tablesObj->setVar('table_notifications', $tableNotifications); - } elseif(isset($tablePermissions)) { - $tablesObj->setVar('table_permissions', $tablePermissions); + case 'display_modules': + foreach($_POST['mod_id'] as $key => $value) + { + $moduleAdmin = XoopsRequest::getInt('mod_admin'); + $moduleUser = XoopsRequest::getInt('mod_user'); + $moduleBlocks = XoopsRequest::getInt('mod_blocks'); + $moduleSearch = XoopsRequest::getInt('mod_search'); + $moduleComments = XoopsRequest::getInt('mod_comments'); + $moduleNotifications = XoopsRequest::getInt('mod_notifications'); + $modulePermissions = XoopsRequest::getInt('mod_permissions'); + + if( $tableMid > 0 ) { + $modulesObj =& $tdmcreate->getHandler('modules')->get($tableMid); + $modulesObj->setVar('mod_admin', ((isset($_REQUEST['mod_admin'][$key]) == 1) ? 0 : 1)); + $modulesObj->setVar('mod_user', ((isset($_REQUEST['mod_user'][$key]) == 1) ? 0 : 1)); + $modulesObj->setVar('mod_blocks', ((isset($_REQUEST['mod_blocks'][$key]) == 1) ? 0 : 1)); + $modulesObj->setVar('mod_search', ((isset($_REQUEST['mod_search'][$key]) == 1) ? 0 : 1)); + $modulesObj->setVar('mod_comments', ((isset($_REQUEST['mod_comments'][$key]) == 1) ? 0 : 1)); + $modulesObj->setVar('mod_notifications', ((isset($_REQUEST['mod_notifications'][$key]) == 1) ? 0 : 1)); + $modulesObj->setVar('mod_permissions', ((isset($_REQUEST['mod_permissions'][$key]) == 1) ? 0 : 1)); + if($tdmcreate->getHandler('modules')->insert($modulesObj, true)) { + redirect_header('modules.php', 1, _AM_TDMCREATE_TOGGLE_SUCCESS); + } else { + redirect_header('modules.php', 1, _AM_TDMCREATE_TOGGLE_FAILED); + } } - if ($tdmcreate->getHandler('tables')->insert($tablesObj, true)) { - redirect_header('modules.php', 1, _AM_TDMCREATE_TOGGLE_SUCCESS); - } else { - redirect_header('modules.php', 1, _AM_TDMCREATE_TOGGLE_FAILED); + } + break; + + case 'display_tables': + foreach($_POST['table_id'] as $key => $value) + { + $tableAdmin = XoopsRequest::getInt('table_admin'); + $tableUser = XoopsRequest::getInt('table_user'); + $tableBlocks = XoopsRequest::getInt('table_blocks'); + $tableSubmenu = XoopsRequest::getInt('table_submenu'); + $tableSearch = XoopsRequest::getInt('table_search'); + $tableComments = XoopsRequest::getInt('table_comments'); + $tableNotifications = XoopsRequest::getInt('table_notifications'); + $tablePermissions = XoopsRequest::getInt('table_permissions'); + + if( $tableId > 0 ) { + $tablesObj =& $tdmcreate->getHandler('tables')->get($tableId); + $tablesObj->setVar('table_admin', ((isset($_REQUEST['table_admin'][$key]) == 1) ? 0 : 1)); + $tablesObj->setVar('table_user', ((isset($_REQUEST['table_user'][$key]) == 1) ? 0 : 1)); + $tablesObj->setVar('table_blocks', ((isset($_REQUEST['table_blocks'][$key]) == 1) ? 0 : 1)); + $tablesObj->setVar('table_submenu', ((isset($_REQUEST['table_submenu'][$key]) == 1) ? 0 : 1)); + $tablesObj->setVar('table_search', ((isset($_REQUEST['table_search'][$key]) == 1) ? 0 : 1)); + $tablesObj->setVar('table_comments', ((isset($_REQUEST['table_comments'][$key]) == 1) ? 0 : 1)); + $tablesObj->setVar('table_notifications', ((isset($_REQUEST['table_notifications'][$key]) == 1) ? 0 : 1)); + if($tdmcreate->getHandler('tables')->insert($tablesObj, true)) { + redirect_header('tables.php', 1, _AM_TDMCREATE_TOGGLE_SUCCESS); + } else { + redirect_header('tables.php', 1, _AM_TDMCREATE_TOGGLE_FAILED); + } } - } - break; + } + break; } include 'footer.php'; \ No newline at end of file Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/header.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/header.php 2014-07-28 04:36:09 UTC (rev 12731) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/header.php 2014-07-28 17:13:26 UTC (rev 12732) @@ -45,13 +45,14 @@ * @public function write * @param string $module * @param mixed $table + * @param array $tables * @param string $filename */ public function write($module, $table, $tables, $filename) { - $this->setModule($module); - $this->setFileName($filename); + $this->setModule($module); $this->setTable($table); $this->setTables($tables); + $this->setFileName($filename); } /* * @public function render @@ -63,39 +64,35 @@ $tables = $this->getTables(); $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); - $ucfModuleName = ucfirst($moduleDirname); + $ucfModuleDirname = ucfirst($moduleDirname); $language = $this->getLanguage('AM'); $content = $this->getHeaderFilesComments($module, $filename); $content .= <<<EOT \nrequire_once dirname(dirname(dirname(dirname(__FILE__)))). '/include/cp_header.php'; \$thisPath = dirname(dirname(__FILE__)); include_once \$thisPath.'/include/common.php'; -//\n +\$sysPathIcon16 = '../' . \$xoopsModule->getInfo('sysicons16'); +\$sysPathIcon32 = '../' . \$xoopsModule->getInfo('sysicons32'); +\$pathModuleAdmin = \$GLOBALS['xoopsModule']->getInfo('dirmoduleadmin'); +// +\$modPathIcon16 = \$xoopsModule->getInfo('modicons16'); +\$modPathIcon32 = \$xoopsModule->getInfo('modicons32');\n EOT; if (is_object($table)) { if ( $table->getVar('table_name') != '' ) { $content .= <<<EOT // Get instance of module -\${$moduleDirname} = {$ucfModuleName}Helper::getInstance();\n +\${$moduleDirname} = {$ucfModuleDirname}Helper::getInstance();\n EOT; - } - } - $content .= <<<EOT -// -\$sysPathIcon16 = '../' . \$xoopsModule->getInfo('sysicons16'); -\$sysPathIcon32 = '../' . \$xoopsModule->getInfo('sysicons32'); -\$pathModuleAdmin = \$GLOBALS['xoopsModule']->getInfo('dirmoduleadmin'); -// -\$modPathIcon16 = \$xoopsModule->getInfo('modicons16'); -\$modPathIcon32 = \$xoopsModule->getInfo('modicons32'); -//\n -EOT; - foreach (array_keys($tables) as $i) - { - $tableName = $tables[$i]->getVar('table_name'); - $content .= <<<EOT + } + foreach (array_keys($tables) as $t) + { + $tableName = $tables[$t]->getVar('table_name'); + $content .= <<<EOT +// {$tableName} \${$tableName}Handler =& \${$moduleDirname}->getHandler('{$tableName}');\n EOT; + } } $content .=<<<EOT // Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/objects.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/objects.php 2014-07-28 04:36:09 UTC (rev 12731) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/objects.php 2014-07-28 17:13:26 UTC (rev 12732) @@ -39,7 +39,7 @@ * @param string $tableName * @param string $fieldName */ - public function getSimpleSetVar($tableName, $fieldName) { + public function getSimpleSetVar($tableName, $fieldName) { $ret = <<<EOT // Set Var {$fieldName} \${$tableName}Obj->setVar('{$fieldName}', \$_POST['{$fieldName}']);\n @@ -169,6 +169,23 @@ return $ret; } /* + * @public function getTopicGetVar + * @param string $lpFieldName + * @param string $rpFieldName + * @param string $tableName + * @param string $tableNameTopic + * @param string $fieldNameParent + * @param string $fieldNameTopic + */ + public function getTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableNameTopic, $fieldNameParent, $fieldNameTopic) { + $ret = <<<EOT +\t\t\t\t// Get Var {$fieldNameParent} +\t\t\t\t\${$rpFieldName} =& \${$tableNameTopic}Handler->get(\${$tableName}_arr[\$i]->getVar('{$fieldNameParent}')); +\t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = \${$rpFieldName}->getVar('{$fieldNameTopic}');\n +EOT; + return $ret; + } + /* * @public function getUploadImageGetVar * @param string $lpFieldName * @param string $rpFieldName 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-07-28 04:36:09 UTC (rev 12731) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/pages.php 2014-07-28 17:13:26 UTC (rev 12732) @@ -79,15 +79,17 @@ /* * @public function getAdminPagesList * @param string $moduleDirname - * @param string $tableName + * @param string $table * @param string $tableFieldname * @param string $language * @param string $fields * @param string $fpif * @param string $fpmf */ - public function getAdminPagesList($moduleDirname, $tableName, $tableFieldname, $tableAutoincrement, $language, $fields, $fpif, $fpmf) { + public function getAdminPagesList($moduleDirname, $table, $tableFieldname, $language, $fields, $fpif, $fpmf) { $stuModuleDirname = strtoupper($moduleDirname); + $tableName = $table->getVar('table_name'); + $tableAutoincrement = $table->getVar('table_autoincrement'); $stuTableName = strtoupper($tableName); $stuTableFieldname = strtoupper($tableFieldname); $ret = <<<EOT @@ -116,6 +118,7 @@ foreach(array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); + $fieldParent = $fields[$f]->getVar('field_parent'); // Verify if table_fieldname is not empty $lpFieldName = !empty($tableFieldname) ? substr($fieldName, 0, strpos($fieldName, '_')) : $tableName; $rpFieldName = $this->tdmcfile->getRightString($fieldName); @@ -137,7 +140,30 @@ $ret .= $this->adminobjects->getTextDateSelectGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); break; default: - $ret .= $this->adminobjects->getSimpleGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); + if( ($fieldParent == 1) && !$table->getVar('table_category') ) { + if($fieldElement > 13) { + $fieldElements = $this->tdmcreate->getHandler('fieldelements')->get($fieldElement); + $fieldElementTid = $fieldElements->getVar('fieldelement_tid'); + $fieldElementName = $fieldElements->getVar('fieldelement_name'); + $rpFieldElementName = strtolower(str_replace('Table : ', '', $fieldElementName)); + } + // + $fieldNameParent = $fieldName; + // + $criteriaFieldsTopic = new CriteriaCompo(); + $criteriaFieldsTopic->add(new Criteria('field_tid', $fieldElementTid)); + $fieldsTopic = $this->tdmcreate->getHandler('fields')->getObjects($criteriaFieldsTopic); + unset($criteriaFieldsTopic); + foreach(array_keys($fieldsTopic) as $ft) + { + if( $fieldsTopic[$ft]->getVar('field_main') == 1 ) { + $fieldNameTopic = $fieldsTopic[$ft]->getVar('field_name'); + } + } + $ret .= $this->adminobjects->getTopicGetVar($lpFieldName, $rpFieldName, $tableName, $rpFieldElementName, $fieldNameParent, $fieldNameTopic); + } else { + $ret .= $this->adminobjects->getSimpleGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); + } break; } } @@ -326,8 +352,7 @@ $table = $this->getTable(); $moduleDirname = $module->getVar('mod_dirname'); $tableName = $table->getVar('table_name'); - $tableFieldname = $table->getVar('table_fieldname'); - $tableAutoincrement = $table->getVar('table_autoincrement'); + $tableFieldname = $table->getVar('table_fieldname'); $language = $this->getLanguage($moduleDirname, 'AM'); $fields = $this->getTableFields($table->getVar('table_id')); foreach(array_keys($fields) as $f) @@ -342,7 +367,7 @@ } $content = $this->getHeaderFilesComments($module, $filename); $content .= $this->getAdminPagesHeader($moduleDirname, $tableName, $fpif); - $content .= $this->getAdminPagesList($moduleDirname, $tableName, $tableFieldname, $tableAutoincrement, $language, $fields, $fpif, $fpmf); + $content .= $this->getAdminPagesList($moduleDirname, $table, $tableFieldname, $language, $fields, $fpif, $fpmf); $content .= $this->getAdminPagesNew($moduleDirname, $tableName, $language); $content .= $this->getAdminPagesSave($moduleDirname, $tableName, $language, $fields, $fpif, $fpmf); $content .= $this->getAdminPagesEdit($moduleDirname, $tableName, $tableFieldname, $language, $fpif); Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/architecture.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/architecture.php 2014-07-28 04:36:09 UTC (rev 12731) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/architecture.php 2014-07-28 17:13:26 UTC (rev 12732) @@ -81,7 +81,8 @@ public function createBaseFoldersFiles( $module ) { // Module - $modId = $module->getVar('mod_id'); + $modId = $module->getVar('mod_id'); + $language = $GLOBALS['xoopsConfig']['language']; // Id of tables $criteriaTables = new CriteriaCompo(); $criteriaTables->add(new Criteria('table_mid', $modId)); @@ -142,7 +143,7 @@ $logoGifFrom = $uploadImagesRepository.'/'.$stlModuleAuthor.'_logo.gif'; if (!file_exists($logoGifFrom)) { copy($logosFolder.'/'.$stlModuleAuthor.'_logo.gif', $logoGifFrom); - } + } // Creation of 'module_author_logo.gif' file $this->structure->copyFile('assets/images', $logoGifFrom, $stlModuleAuthor.'_logo.gif'); // Creation of "images" folder and index.html file @@ -163,10 +164,15 @@ $this->structure->makeDirAndCopyFile('include', $indexFile, 'index.html'); // Creation of "language" folder and index.html file $this->structure->makeDirAndCopyFile('language', $indexFile, 'index.html'); + // Creation of 'default english' folder + if($language != 'english' ) { + // Creation of "english" folder and index.html file + $this->structure->makeDirAndCopyFile('language/english', $indexFile, 'index.html'); + } // Creation of "language/local_language" folder and index.html file - $this->structure->makeDirAndCopyFile('language/'.$GLOBALS['xoopsConfig']['language'], $indexFile, 'index.html'); + $this->structure->makeDirAndCopyFile('language/'.$language, $indexFile, 'index.html'); // Creation of "language/local_language/help" folder and index.html file - $this->structure->makeDirAndCopyFile('language/'.$GLOBALS['xoopsConfig']['language']. '/help', $indexFile, 'index.html'); + $this->structure->makeDirAndCopyFile('language/'.$language. '/help', $indexFile, 'index.html'); if( $module->getVar('mod_admin') == 1 ) { // Creation of "templates" folder and index.html file $this->structure->makeDirAndCopyFile('templates', $indexFile, 'index.html'); @@ -186,7 +192,7 @@ } if( $table->getVar('table_notifications') == 1 ) { // Creation of "mail_template" folder and index.html file - $this->structure->makeDirAndCopyFile('language/'.$GLOBALS['xoopsConfig']['language'].'/mail_template', $indexFile, 'index.html'); + $this->structure->makeDirAndCopyFile('language/'.$language.'/mail_template', $indexFile, 'index.html'); } } } @@ -318,6 +324,14 @@ $languageAdmin->write($module, $tables, 'admin.php'); $ret[] = $languageAdmin->render(); } + // Class Helper File + $classHelper = ClassHelper::getInstance(); + $classHelper->write($module, 'helper.php'); + $ret[] = $classHelper->render(); + // Include Functions File + $includeFunctions = IncludeFunctions::getInstance(); + $includeFunctions->write($module, 'functions.php'); + $ret[] = $includeFunctions->render(); // Creation of blocks language file if (is_object($table)) { // Include Install File @@ -329,11 +343,7 @@ $languageBlocks = LanguageBlocks::getInstance(); $languageBlocks->write($module, $tables, 'blocks.php'); $ret[] = $languageBlocks->render(); - } - // Class Helper File - $classHelper = ClassHelper::getInstance(); - $classHelper->write($module, 'helper.php'); - $ret[] = $classHelper->render(); + } // Creation of admin files if ( $table->getVar('table_admin') == 1) { // Creation of admin permission file @@ -364,11 +374,7 @@ // Sql File $sqlFile = SqlFile::getInstance(); $sqlFile->write($module, $tables, 'mysql.sql'); - $ret[] = $sqlFile->render(); - // Include Functions File - $includeFunctions = IncludeFunctions::getInstance(); - $includeFunctions->write($module, 'functions.php'); - $ret[] = $includeFunctions->render(); + $ret[] = $sqlFile->render(); // Include Update File $includeUpdate = IncludeUpdate::getInstance(); $includeUpdate->write($module, 'update.php'); @@ -407,33 +413,9 @@ $includeCommentFunctions = IncludeCommentFunctions::getInstance(); $includeCommentFunctions->write($module, $table, 'comment_functions.php'); $ret[] = $includeCommentFunctions->renderFile(); - } - // Creation of user files - if ( ($table->getVar('table_user') == 1)) { - // User Footer File - $userFooter = UserFooter::getInstance(); - $userFooter->write($module, 'footer.php'); - $ret[] = $userFooter->render(); - // User Header File - $userHeader = UserHeader::getInstance(); - $userHeader->write($module, 'header.php'); - $ret[] = $userHeader->render(); - // User Notification Update File - if ( ($table->getVar('table_notifications') == 1 )) { - $userNotificationUpdate = UserNotificationUpdate::getInstance(); - $userNotificationUpdate->write($module, 'notification_update.php'); - $ret[] = $userNotificationUpdate->render(); - } - // User Index File - $userIndex = UserIndex::getInstance(); - $userIndex->write($module, 'index.php'); - $ret[] = $userIndex->render(); - // Language Main File - $languageMain = LanguageMain::getInstance(); - $languageMain->write($module, $tables, 'main.php'); - $ret[] = $languageMain->render(); - } + } } + // Creation of admin files if( $module->getVar('mod_admin') == 1 ) { // Templates Index File $userTemplatesIndex = TemplatesUserIndex::getInstance(); @@ -447,6 +429,31 @@ $userTemplatesHeader = TemplatesUserHeader::getInstance(); $userTemplatesHeader->write($module, $tables, $moduleDirname.'_header.tpl'); $ret[] = $userTemplatesHeader->render(); + } + // Creation of user files + if( $module->getVar('mod_user') == 1 ) { + // User Footer File + $userFooter = UserFooter::getInstance(); + $userFooter->write($module, 'footer.php'); + $ret[] = $userFooter->render(); + // User Header File + $userHeader = UserHeader::getInstance(); + $userHeader->write($module, $table, $tables, 'header.php'); + $ret[] = $userHeader->render(); + // User Notification Update File + if ( ($module->getVar('mod_notifications') == 1 )) { + $userNotificationUpdate = UserNotificationUpdate::getInstance(); + $userNotificationUpdate->write($module, 'notification_update.php'); + $ret[] = $userNotificationUpdate->render(); + } + // User Index File + $userIndex = UserIndex::getInstance(); + $userIndex->write($module, 'index.php'); + $ret[] = $userIndex->render(); + // Language Main File + $languageMain = LanguageMain::getInstance(); + $languageMain->write($module, $tables, 'main.php'); + $ret[] = $languageMain->render(); } // Css Styles File $cssStyles = CssStyles::getInstance(); Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/common.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/common.php 2014-07-28 04:36:09 UTC (rev 12731) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/common.php 2014-07-28 17:13:26 UTC (rev 12732) @@ -89,13 +89,9 @@ <img src='".\$local_logo."' alt='{$moduleAuthorWebsiteName}' /></a>"; include_once XOOPS_ROOT_PATH.'/class/xoopsrequest.php'; -EOT; - if (is_object($table)) { - $ret .= <<<EOT include_once {$stuModuleDirname}_PATH.'/class/helper.php'; include_once {$stuModuleDirname}_PATH.'/include/functions.php'; EOT; - } return $ret; } /* 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-07-28 04:36:09 UTC (rev 12731) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/notifications.php 2014-07-28 17:13:26 UTC (rev 12732) @@ -51,8 +51,8 @@ */ public function write($module, $table, $filename) { $this->setModule($module); - $this->setFileName($filename); $this->setTable($table); + $this->setFileName($filename); } /* * @static function getNotificationsFunction @@ -72,15 +72,15 @@ } if($fields[$f]->getVar('field_main') == 1) { $fpmf = $fieldName; - } + } } $ret = <<<EOT \n// comment callback functions function {$moduleDirname}_notify_iteminfo(\$category, \$item_id) { - global \$xoopsModule, \$xoopsModuleConfig, \$xoopsConfig; - + global \$xoopsModule, \$xoopsModuleConfig, \$xoopsDB; + // if (empty(\$xoopsModule) || \$xoopsModule->getVar('dirname') != '{$moduleDirname}') { \$module_handler =& xoops_gethandler('module'); @@ -90,11 +90,8 @@ } else { \$module =& \$xoopsModule; \$config =& \$xoopsModuleConfig; - } + } // - xoops_loadLanguage('main', '{$moduleDirname}'); - // - global \$xoopsDB; switch(\$category) { case 'global': \$item['name'] = ''; @@ -103,7 +100,7 @@ break; case 'category': // Assume we have a valid category id - \$sql = 'SELECT {$fpif}, {$fpmf} FROM ' . \$xoopsDB->prefix('{$moduleDirname}_{$tableName}') . ' WHERE {$fpif} = '. \$item_id; + \$sql = 'SELECT {$fpmf} FROM ' . \$xoopsDB->prefix('{$moduleDirname}_{$tableName}') . ' WHERE {$fpif} = '. \$item_id; \$result = \$xoopsDB->query(\$sql); // TODO: error check \$result_array = \$xoopsDB->fetchArray(\$result); \$item['name'] = \$result_array['{$fpmf}']; Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/admin.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/admin.php 2014-07-28 04:36:09 UTC (rev 12731) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/admin.php 2014-07-28 17:13:26 UTC (rev 12732) @@ -65,7 +65,7 @@ */ public function getLanguageAdminIndex($language, $tables) { - $ret = $this->defines->getAboveDefines('---------------- Admin Index ----------------'); + $ret = $this->defines->getAboveHeadDefines('Admin Index'); $ret .= $this->defines->getDefine($language, 'STATISTICS', "Statistics"); $ret .= $this->defines->getAboveDefines('There are'); foreach (array_keys($tables) as $t) @@ -84,7 +84,7 @@ */ public function getLanguageAdminPages($language, $tables) { - $ret = $this->defines->getAboveDefines('---------------- Admin Files ----------------'); + $ret = $this->defines->getAboveHeadDefines('Admin Files'); $ret .= $this->defines->getAboveDefines('There aren\'t'); foreach (array_keys($tables) as $t) { @@ -127,7 +127,7 @@ */ public function getLanguageAdminClass($language, $tables) { - $ret = $this->defines->getAboveDefines('---------------- Admin Classes ----------------'); + $ret = $this->defines->getAboveHeadDefines('Admin Classes'); // foreach (array_keys($tables) as $t) { @@ -186,7 +186,7 @@ */ public function getLanguageAdminPermissions($language) { - $ret = $this->defines->getAboveDefines('---------------- Admin Permissions ----------------'); + $ret = $this->defines->getAboveHeadDefines('Admin Permissions'); $ret .= $this->defines->getAboveDefines('Permissions'); $ret .= $this->defines->getDefine($language, 'GLOBAL', "Permissions global"); $ret .= $this->defines->getDefine($language, 'GLOBAL_DESC', "Permissions global"); @@ -208,9 +208,9 @@ */ public function getLanguageAdminFoot($language) { - $ret = $this->defines->getAboveDefines('---------------- Admin Others ----------------'); + $ret = $this->defines->getAboveHeadDefines('Admin Others'); $ret .= $this->defines->getDefine($language, 'MAINTAINEDBY', " is maintained by "); - $ret .= $this->defines->getBelowDefines('---------------- End ----------------'); + $ret .= $this->defines->getBelowDefines('End'); return $ret; } /* Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/blocks.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/blocks.php 2014-07-28 04:36:09 UTC (rev 12731) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/blocks.php 2014-07-28 17:13:26 UTC (rev 12732) @@ -66,9 +66,7 @@ private function getLanguageBlock($module, $language) { $tables = $this->getTables(); - $ret = <<<EOT -// Admin Edit\n -EOT; + $ret = $this->defines->getAboveDefines('Admin Edit'); $ret .= $this->defines->getDefine($language, 'DISPLAY', "How Many Tables to Display"); $ret .= $this->defines->getDefine($language, 'TITLELENGTH', "Title Length"); $ret .= $this->defines->getDefine($language, 'CATTODISPLAY', "Categories to Display"); @@ -77,9 +75,7 @@ { $tableName = $tables[$t]->getVar('table_name'); $ucfTableName = ucfirst($tableName); - $ret .= <<<EOT -// {$ucfTableName}\n -EOT; + $ret .= $this->defines->getAboveDefines($ucfTableName); $fields = $this->getTableFields($tables[$t]->getVar('table_id')); foreach (array_keys($fields) as $f) { @@ -102,9 +98,7 @@ */ private function getLanguageFooter() { - $ret = <<<EOT -// ---------------- End ---------------- -EOT; + $ret = $this->defines->getBelowDefines('End'); return $ret; } /* 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-07-28 04:36:09 UTC (rev 12731) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/main.php 2014-07-28 17:13:26 UTC (rev 12732) @@ -100,11 +100,13 @@ } /* * @private function geLanguagetMainFooter - * @param null + * @param string $language */ - private function geLanguagetMainFooter() + private function geLanguagetMainFooter($language) { - $ret = $this->defines->getBelowDefines('End'); + $ret = $this->defines->getAboveDefines('Admin link'); + $ret .= $this->defines->getDefine($language, 'ADMIN', "Admin"); + $ret .= $this->defines->getBelowDefines('End'); return $ret; } /* @@ -118,7 +120,7 @@ $language = $this->getLanguage($moduleDirname, 'MA'); $content = $this->getHeaderFilesComments($module, $filename); $content .= $this->geLanguagetMain($module, $language); - $content .= $this->geLanguagetMainFooter(); + $content .= $this->geLanguagetMainFooter($language); // $this->tdmcfile->create($moduleDirname, 'language/'.$GLOBALS['xoopsConfig']['language'], $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); return $this->tdmcfile->renderFile(); 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-07-28 04:36:09 UTC (rev 12731) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/modinfo.php 2014-07-28 17:13:26 UTC (rev 12732) @@ -167,16 +167,23 @@ private function getLanguageConfig($language, $table) { $ret = $this->defines->getAboveDefines('Config'); - $ret .= $this->defines->getDefine($language, "EDITOR", "Editor"); - $ret .= $this->defines->getDefine($language, "EDITOR_DESC", "Select the Editor to use"); + if (is_object($table)) { + if ( $table->getVar('table_image') != '' ) + { + $ret .= $this->defines->getDefine($language, "EDITOR", "Editor"); + $ret .= $this->defines->getDefine($language, "EDITOR_DESC", "Select the Editor to use"); + } + } $ret .= $this->defines->getDefine($language, "KEYWORDS", "Keywords"); $ret .= $this->defines->getDefine($language, "KEYWORDS_DESC", "Insert here the keywords (separate by comma)"); - if ( $table->getVar('table_image') != '' ) - { - $ret .= $this->defines->getDefine($language, "MAXSIZE", "Max size"); - $ret .= $this->defines->getDefine($language, "MAXSIZE_DESC", "Set a number of max size uploads file in byte"); - $ret .= $this->defines->getDefine($language, "MIMETYPES", "Mime Types"); - $ret .= $this->defines->getDefine($language, "MIMETYPES_DESC", "Set the mime types selected"); + if (is_object($table)) { + if ( $table->getVar('table_image') != '' ) + { + $ret .= $this->defines->getDefine($language, "MAXSIZE", "Max size"); + $ret .= $this->defines->getDefine($language, "MAXSIZE_DESC", "Set a number of max size uploads file in byte"); + $ret .= $this->defines->getDefine($language, "MIMETYPES", "Mime Types"); + $ret .= $this->defines->getDefine($language, "MIMETYPES_DESC", "Set the mime types selected"); + } } $ret .= $this->defines->getDefine($language, "IDPAYPAL", "Paypal ID"); $ret .= $this->defines->getDefine($language, "IDPAYPAL_DESC", "Insert here your PayPal ID for donactions."); @@ -281,9 +288,11 @@ } if ( $table->getVar('table_submenu') == 1 ) { $content .= $this->getLanguageSubmenu($language, $tables); - } + } $content .= $this->getLanguageBlocks($language, $tables); - $content .= $this->getLanguageConfig($language, $table); + } + $content .= $this->getLanguageConfig($language, $table); + if (is_object($table)) { if ( $table->getVar('table_notifications') == 1 ) { $content .= $this->getLanguageNotifications($language); Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/footer.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/footer.php 2014-07-28 04:36:09 UTC (rev 12731) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/footer.php 2014-07-28 17:13:26 UTC (rev 12732) @@ -81,11 +81,13 @@ <br />\n EOT; } - $content .= <<<EOT + } + $content .= <<<EOT <{if \$xoops_isadmin}> <div class="center bold"><a href="<{\$admin}>"><{\$smarty.const.{$language}ADMIN}></a></div><br /> <{/if}>\n EOT; + if (is_object($table)) { if ( $table->getVar('table_comments') == 1 ) { $content .= <<<EOT <div class="pad2 marg2"> Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/header.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/header.php 2014-07-28 04:36:09 UTC (rev 12731) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/header.php 2014-07-28 17:13:26 UTC (rev 12732) @@ -44,10 +44,14 @@ /* * @public function write * @param string $module + * @param mixed $table + * @param array $tables * @param string $filename */ - public function write($module, $filename) { - $this->setModule($module); + public function write($module, $table, $tables, $filename) { + $this->setModule($module); + $this->setTable($table); + $this->setTables($tables); $this->setFileName($filename); } /* @@ -56,6 +60,8 @@ */ public function render() { $module = $this->getModule(); + $table = $this->getTable(); + $tables = $this->getTables(); $moduleDirname = $module->getVar('mod_dirname'); $filename = $this->getFileName(); $stuModuleDirname = strtoupper($moduleDirname); @@ -66,6 +72,21 @@ \$dirname = \$GLOBALS['xoopsModule']->getVar('dirname'); \$pathname = XOOPS_ROOT_PATH. '/modules/'.\$dirname; include_once \$pathname . '/include/common.php'; +// Get instance of module +\${$moduleDirname} = {$ucfModuleDirname}Helper::getInstance();\n +EOT; + if (is_object($table)) { + foreach (array_keys($tables) as $t) + { + $tableName = $tables[$t]->getVar('table_name'); + $content .= <<<EOT +// {$tableName} +\${$tableName}Handler =& \${$moduleDirname}->getHandler('{$tableName}');\n +EOT; + } + } + $content .=<<<EOT +// \$myts =& MyTextSanitizer::getInstance(); \$style = {$stuModuleDirname}_URL . '/assets/css/style.css'; if(file_exists(\$style)) { return true; } @@ -79,8 +100,6 @@ // xoops_loadLanguage('modinfo', \$dirname); xoops_loadLanguage('main', \$dirname); -// -\${$moduleDirname} = {$ucfModuleDirname}Helper::getInstance(); EOT; $this->tdmcfile->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); return $this->tdmcfile->renderFile(); Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/index.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/index.php 2014-07-28 04:36:09 UTC (rev 12731) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/index.php 2014-07-28 17:13:26 UTC (rev 12732) @@ -68,7 +68,7 @@ // Define Stylesheet \$xoTheme->addStylesheet( \$style ); // keywords -{$moduleDirname}_meta_keywords(xoops_getModuleOption('keywords', \$dirname)); +{$moduleDirname}_meta_keywords(\${$moduleDirname}->getConfig('keywords')); // description {$moduleDirname}_meta_description({$language}DESC); // Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/objects.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/objects.php 2014-07-28 04:36:09 UTC (rev 12731) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/objects.php 2014-07-28 17:13:26 UTC (rev 12732) @@ -84,6 +84,23 @@ return $ret; } /* + * @public function getTopicGetVar + * @param string $lpFieldName + * @param string $rpFieldName + * @param string $tableName + * @param string $tableNameTopic + * @param string $fieldNameParent + * @param string $fieldNameTopic + */ + public function getTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableNameTopic, $fieldNameParent, $fieldNameTopic) { + $ret = <<<EOT +\t\t// Get Var {$fieldNameParent} +\t\t\${$rpFieldName} =& \${$tableNameTopic}Handler->get(\${$tableName}_arr[\$i]->getVar('{$fieldNameParent}')); +\t\t\${$lpFieldName}['{$rpFieldName}'] = \${$rpFieldName}->getVar('{$fieldNameTopic}');\n +EOT; + return $ret; + } + /* * @public function getUploadImageGetVar * @param string $lpFieldName * @param string $rpFieldName 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-07-28 04:36:09 UTC (rev 12731) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/pages.php 2014-07-28 17:13:26 UTC (rev 12732) @@ -79,8 +79,6 @@ \$limit = \${$moduleDirname}->getConfig('userpager'); // Define Stylesheet \$xoTheme->addStylesheet( \$style ); -// Get Handler -\${$stlTableName}Handler =& \${$moduleDirname}->getHandler('{$stlTableName}'); // \$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_upload_url', {$stuModuleDirname}_UPLOAD_URL); // @@ -98,6 +96,7 @@ foreach(array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); + $fieldParent = $fields[$f]->getVar('field_parent'); // Verify if table_fieldname is not empty $lpFieldName = !empty($tableFieldname) ? substr($fieldName, 0, strpos($fieldName, '_')) : $tableName; $rpFieldName = $this->tdmcfile->getRightString($fieldName); @@ -121,7 +120,30 @@ $ret .= $this->userobjects->getTextDateSelectGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); break; default: - $ret .= $this->userobjects->getSimpleGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); + if( ($fieldParent == 1) && !$table->getVar('table_category') ) { + if($fieldElement > 13) { + $fieldElements = $this->tdmcreate->getHandler('fieldelements')->get($fieldElement); + $fieldElementTid = $fieldElements->getVar('fieldelement_tid'); + $fieldElementName = $fieldElements->getVar('fieldelement_name'); + $rpFieldElementName = strtolower(str_replace('Table : ', '', $fieldElementName)); + } + // + $fieldNameParent = $fieldName; + // + $criteriaFieldsTopic = new CriteriaCompo(); + $criteriaFieldsTopic->add(new Criteria('field_tid', $fieldElementTid)); + $fieldsTopic = $this->tdmcreate->getHandler('fields')->getObjects($criteriaFieldsTopic); + unset($criteriaFieldsTopic); + foreach(array_keys($fieldsTopic) as $ft) + { + if( $fieldsTopic[$ft]->getVar('field_main') == 1 ) { + $fieldNameTopic = $fieldsTopic[$ft]->getVar('field_name'); + } + } + $ret .= $this->userobjects->getTopicGetVar($lpFieldName, $rpFieldName, $tableName, $rpFieldElementName, $fieldNameParent, $fieldNameTopic); + } else { + $ret .= $this->userobjects->getSimpleGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); + } break; } } 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-07-28 04:36:09 UTC (rev 12731) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/xoopsversion.php 2014-07-28 17:13:26 UTC (rev 12732) @@ -339,7 +339,7 @@ 'show_func' => "b_{$moduleDirname}_{$tableName}_show", 'edit_func' => "b_{$moduleDirname}_{$tableName}_edit", 'options' => "{$tables[$i]->getVar('table_fieldname')}|5|25|0", - 'template' => "'{$moduleDirname}_block_{$tableName}.tpl");\n\n + 'template' => "'{$moduleDirname}_block_{$tableName}.tpl");\n EOT; } } @@ -356,11 +356,12... [truncated message content] |
From: <txm...@us...> - 2014-08-07 06:47:33
|
Revision: 12734 http://sourceforge.net/p/xoops/svn/12734 Author: txmodxoops Date: 2014-08-07 06:47:28 +0000 (Thu, 07 Aug 2014) Log Message: ----------- - Fixed bugs (goffy/timgno) Modified Paths: -------------- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/tables.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/tables.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/language/english/admin.php Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/tables.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/tables.php 2014-07-28 20:17:51 UTC (rev 12733) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/tables.php 2014-08-07 06:47:28 UTC (rev 12734) @@ -57,14 +57,14 @@ $numbModules = $tdmcreate->getHandler('modules')->getCount($criteria); // Redirect if there aren't modules if ( $numbModules == 0 ) { - redirect_header('modules.php?op=new', 2, _AM_TDMCREATE_NOTMODULES ); + redirect_header('modules.php?op=new', 10, _AM_TDMCREATE_NOTMODULES ); } $mods_arr = $tdmcreate->getHandler('modules')->getAll($criteria); unset($criteria); $numbTables = $tdmcreate->getHandler('tables')->getObjects(null); // Redirect if there aren't tables if ($numbTables == 0) { - redirect_header('tables.php?op=new', 2, _AM_TDMCREATE_NOTTABLES ); + redirect_header('tables.php?op=new', 10, _AM_TDMCREATE_NOTTABLES ); } unset($numbTables); // Display modules list @@ -147,6 +147,12 @@ if ( !$GLOBALS['xoopsSecurity']->check() ) { redirect_header('tables.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } + // By goffy/timgno + if( ($tableMid == 0) { + redirect_header('tables.php?op=new', 10, _AM_TDMCREATE_ERROR_NO_MODULE_SEL); + exit(); + } + // $tables =& $tdmcreate->getHandler('tables'); if (!isset($tableId)) { // Checking if table name exist Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/tables.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/tables.php 2014-07-28 20:17:51 UTC (rev 12733) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/tables.php 2014-08-07 06:47:28 UTC (rev 12734) @@ -106,7 +106,7 @@ // $modules = $this->tdmcreate->getHandler('modules')->getObjects(null); $mods_select = new XoopsFormSelect(_AM_TDMCREATE_TABLE_MODULES, 'table_mid', $table_mid); - $mods_select->addOption($action, _AM_TDMCREATE_TABLE_MODSELOPT); + $mods_select->addOption(0, _AM_TDMCREATE_TABLE_MODSELOPT); foreach ($modules as $mod) {//$mods_select->addOptionArray(); $mods_select->addOption($mod->getVar('mod_id'), $mod->getVar('mod_name')); } Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/language/english/admin.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/language/english/admin.php 2014-07-28 20:17:51 UTC (rev 12733) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/language/english/admin.php 2014-08-07 06:47:28 UTC (rev 12734) @@ -302,4 +302,6 @@ define('_AM_TDMCREATE_FILE_NOTCREATED', "Problems: Creating file <b class='red'>%s</b> in the <span class='red bold'>%s</span> folder"); // define('_AM_TDMCREATE_BUILDING_DIRECTORY', "Files created in the directory <span class='bold'>uploads/tdmcreate/repository/</span> of the module <span class='bold green'>%s</span>"); -define('_AM_TDMCREATE_FIELD_PARAMETERS_LIST', "<b>Parameters List</b>"); \ No newline at end of file +define('_AM_TDMCREATE_FIELD_PARAMETERS_LIST', "<b>Parameters List</b>"); +// By goffy/timgno +define('_AM_TDMCREATE_ERROR_NO_MODULE_SEL', "ERROR: No module selected"); \ No newline at end of file |
From: <txm...@us...> - 2014-08-07 07:08:38
|
Revision: 12736 http://sourceforge.net/p/xoops/svn/12736 Author: txmodxoops Date: 2014-08-07 07:08:29 +0000 (Thu, 07 Aug 2014) Log Message: ----------- - Poured code @goffy since the control is done by javascript instead of using 0, we use two single quotes as string Modified Paths: -------------- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/tables.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/tables.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/language/english/admin.php Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/tables.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/tables.php 2014-08-07 06:50:36 UTC (rev 12735) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/tables.php 2014-08-07 07:08:29 UTC (rev 12736) @@ -146,12 +146,7 @@ case 'save': if ( !$GLOBALS['xoopsSecurity']->check() ) { redirect_header('tables.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - // By goffy/timgno - if($tableMid == 0) { - redirect_header('tables.php?op=new', 10, _AM_TDMCREATE_ERROR_NO_MODULE_SEL); - exit(); - } + } // $tables =& $tdmcreate->getHandler('tables'); if (!isset($tableId)) { Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/tables.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/tables.php 2014-08-07 06:50:36 UTC (rev 12735) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/tables.php 2014-08-07 07:08:29 UTC (rev 12736) @@ -106,7 +106,7 @@ // $modules = $this->tdmcreate->getHandler('modules')->getObjects(null); $mods_select = new XoopsFormSelect(_AM_TDMCREATE_TABLE_MODULES, 'table_mid', $table_mid); - $mods_select->addOption(0, _AM_TDMCREATE_TABLE_MODSELOPT); + $mods_select->addOption('', _AM_TDMCREATE_TABLE_MODSELOPT); foreach ($modules as $mod) {//$mods_select->addOptionArray(); $mods_select->addOption($mod->getVar('mod_id'), $mod->getVar('mod_name')); } Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/language/english/admin.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/language/english/admin.php 2014-08-07 06:50:36 UTC (rev 12735) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/language/english/admin.php 2014-08-07 07:08:29 UTC (rev 12736) @@ -302,6 +302,4 @@ define('_AM_TDMCREATE_FILE_NOTCREATED', "Problems: Creating file <b class='red'>%s</b> in the <span class='red bold'>%s</span> folder"); // define('_AM_TDMCREATE_BUILDING_DIRECTORY', "Files created in the directory <span class='bold'>uploads/tdmcreate/repository/</span> of the module <span class='bold green'>%s</span>"); -define('_AM_TDMCREATE_FIELD_PARAMETERS_LIST', "<b>Parameters List</b>"); -// By goffy/timgno -define('_AM_TDMCREATE_ERROR_NO_MODULE_SEL', "ERROR: No module selected"); \ No newline at end of file +define('_AM_TDMCREATE_FIELD_PARAMETERS_LIST', "<b>Parameters List</b>"); \ No newline at end of file |
From: <txm...@us...> - 2014-11-23 09:41:25
|
Revision: 12867 http://sourceforge.net/p/xoops/svn/12867 Author: txmodxoops Date: 2014-11-23 09:41:18 +0000 (Sun, 23 Nov 2014) Log Message: ----------- Added classes for autoLoader Fixed bugs Commented creation image file blank.gif in include/install.php for module repository Modified Paths: -------------- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/building.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fields.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/objects.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/pages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/include/common.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/include/install.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/templates/admin/tdmcreate_tables.tpl Added Paths: ----------- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/TDMCreateAutoload.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/cache/ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/cache/index.html XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/TDMCreateAbstract.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/TDMCreateArchitecture.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/TDMCreateFile.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/TDMCreateHtmlSmartyCodes.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/TDMCreateStructure.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/TDMCreateTableFields.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/AdminAbout.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/AdminFooter.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/AdminHeader.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/AdminIndex.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/AdminMenu.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/AdminObjects.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/AdminPages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/AdminPermissions.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/blocks/BlocksFiles.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/ClassFiles.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/ClassFormElements.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/ClassHelper.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/css/CssStyles.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/docs/DocsChangelog.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/docs/DocsFiles.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/IncludeCommentFunctions.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/IncludeComments.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/IncludeCommon.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/IncludeFunctions.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/IncludeInstall.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/IncludeJquery.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/IncludeNotifications.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/IncludeSearch.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/IncludeUpdate.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/LanguageAdmin.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/LanguageBlocks.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/LanguageDefines.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/LanguageHelp.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/LanguageMailTpl.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/LanguageMain.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/LanguageModinfo.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/sql/SqlFile.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/TemplatesAdminAbout.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/TemplatesAdminFooter.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/TemplatesAdminHeader.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/TemplatesAdminIndex.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/TemplatesAdminPages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/TemplatesAdminPermissions.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/blocks/TemplatesBlocks.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/TemplatesUserFooter.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/TemplatesUserHeader.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/TemplatesUserIndex.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/TemplatesUserPages.php Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/building.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/building.php 2014-11-22 23:53:55 UTC (rev 12866) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/building.php 2014-11-23 09:41:18 UTC (rev 12867) @@ -43,7 +43,7 @@ } } // Structure - include_once TDMC_PATH . '/class/files/architecture.php'; + include_once TDMC_PATH . '/class/files/TDMCreateArchitecture.php'; $handler = TDMCreateArchitecture::getInstance(); $handler->getPath( TDMC_PATH ); $handler->getUploadPath( TDMC_UPLOAD_PATH ); Added: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/TDMCreateAutoload.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/TDMCreateAutoload.php (rev 0) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/TDMCreateAutoload.php 2014-11-23 09:41:18 UTC (rev 12867) @@ -0,0 +1,195 @@ +<?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: autoloader.php 12258 2014-01-02 09:33:29Z timgno $ + */ +defined('XOOPS_ROOT_PATH') or die('Restricted access'); +/** + * @since 1.91 + */ +class TDMCreateAutoload +{ + /** + * File where classes index is stored + */ + const INDEX_FILE = 'cache/class_index.php'; + + /** + * @var Autoload + */ + protected static $instance; + + /** + * @var string module directory + */ + protected $mod_dir; + + /** + * @var array array('classname' => 'path/to/filename') + */ + public $index = array(); + + protected static $class_aliases = array('Autoload' => 'TDMCreateAutoload'); + + protected function __construct() + { + $this->mod_dir = TDMC_PATH.'/'; + $file = TDMC_CLASSES_PATH.TDMCreateAutoload::INDEX_FILE; + if (@filemtime($file) && is_readable($file)) + $this->index = include($file); + else + $this->generateIndex(); + } + + /** + * Get instance of autoload + * + * @return TDMCreateAutoload + */ + public static function getInstance() + { + if (!TDMCreateAutoload::$instance) + TDMCreateAutoload::$instance = new TDMCreateAutoload(); + + return TDMCreateAutoload::$instance; + } + + /** + * Retrieve informations about a class in classes index and load it + * + * @param string $classname + */ + public function load($classname) + { + // Retrocompatibility + if (isset(TDMCreateAutoload::$class_aliases[$classname]) && !interface_exists($classname, false) && !class_exists($classname, false)) + return eval('class '.$classname.' extends '.TDMCreateAutoload::$class_aliases[$classname].' {}'); + // regenerate the class index if the requested file doesn't exists + if ((isset($this->index[$classname]) && $this->index[$classname]['path'] && !is_file($this->mod_dir.$this->index[$classname]['path']))) + $this->generateIndex(); + // Call directly class + if (isset($this->index[$classname]['path']) && $this->index[$classname]['path']) + require($this->mod_dir.$this->index[$classname]['path']); + } + + /** + * Generate classes index + */ + public function generateIndex() + { + $classes = array_merge( $this->getClassesFromDir('class/'), + $this->getClassesFromDir('class/files/'), + $this->getClassesFromDir('class/files/admin/'), + $this->getClassesFromDir('class/files/blocks/'), + $this->getClassesFromDir('class/files/classes/'), + $this->getClassesFromDir('class/files/css/'), + $this->getClassesFromDir('class/files/docs/'), + $this->getClassesFromDir('class/files/include/'), + $this->getClassesFromDir('class/files/language/'), + $this->getClassesFromDir('class/files/sql/'), + $this->getClassesFromDir('class/files/templates/'), + $this->getClassesFromDir('class/files/user/') ); + ksort($classes); + $content = '<?php return '.var_export($classes, true).'; ?>'; + + // Write classes index on disc to cache it + $filename = TDMC_CLASSES_PATH.TDMCreateAutoload::INDEX_FILE; + $filename_tmp = tempnam(dirname($filename), basename($filename.'.')); + if ($filename_tmp !== false && file_put_contents($filename_tmp, $content) !== false) + { + if (!@rename($filename_tmp, $filename)) + unlink($filename_tmp); + else + @chmod($filename, 0644); + } + // $filename_tmp couldn't be written . $filename should be there anyway (even if outdated), no need to die. + else + error_log('Cannot write temporary file '.$filename_tmp); + $this->index = $classes; + } + + /** + * Retrieve recursively all classes in a directory and its subdirectories + * + * @param string $path Relative path from root to the directory + * @return array + */ + protected function getClassesFromDir($path) + { + $classes = array(); + $mod_dir = $this->mod_dir; + + foreach (scandir($mod_dir.$path) as $file) + { + if ($file[0] != '.') + { + if (is_dir($mod_dir.$path.$file)) + $classes = array_merge($classes, $this->getClassesFromDir($path.$file.'/')); + else if (substr($file, -4) == '.php') + { + $content = file_get_contents($mod_dir.$path.$file); + $pattern = '#\W((abstract\s+)?class|interface)\s+(?P<classname>'.basename($file, '.php').'?)'.'(?:\s+extends\s+[a-z][a-z0-9_]*)?(?:\s+implements\s+[a-z][a-z0-9_]*(?:\s*,\s*[a-z][a-z0-9_]*)*)?\s*\{#i'; + if (preg_match($pattern, $content, $m)) { + $classes[$m['classname']] = array('path' => $path.$file); + } + } + } + } + + return $classes; + } + + public function getClassPath($classname) { + return (isset($this->index[$classname]) && isset($this->index[$classname]['path'])) ? $this->index[$classname]['path'] : null; + } +} +/* + function autoLoader($className) { + // Directories + $directories = array( + '', + 'files/', + 'files/admin/', + 'files/blocks/', + 'files/classes/', + 'files/css/', + 'files/docs/', + 'files/include/', + 'files/language/', + 'files/sql/', + 'files/templates/user/', + 'files/templates/admin/', + 'files/templates/blocks/', + 'files/user/' + ); + + // File naming format + $fileNameFormats = array( '%s.php' ); + + foreach($directories as $directory) { + foreach($fileNameFormats as $fileNameFormat) { + $path = $directory.sprintf($fileNameFormat, $className); + if(file_exists($path)) { + include_once $path; + return true; + } + } + } + return false; +}*/ +//spl_autoload_register('TDMCreateAutoload'); Added: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/cache/index.html =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/cache/index.html (rev 0) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/cache/index.html 2014-11-23 09:41:18 UTC (rev 12867) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fields.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fields.php 2014-11-22 23:53:55 UTC (rev 12866) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fields.php 2014-11-23 09:41:18 UTC (rev 12867) @@ -123,257 +123,297 @@ return $form; } - /* - * @public function getFormNew - * - * @param integer $field_mid - * @param integer $field_tid - * @param integer $field_numb - * @param string $f_name - * @param mixed $action - */ - public function getFormNew($field_mid = null, $field_tid = null, $field_numb = null, $f_name = null, $action = false) - { - // Header function class - $fields_form = TDMCreateFields::getInstance(); - $form = $fields_form->getHeaderForm($action); - // - $table_autoincrement = $this->tdmcreate->getHandler('tables')->get($field_tid); - // - $class = 'even'; - for($i = 1; $i <= $field_numb; $i++) { - $class = ($class == 'even') ? 'odd' : 'even'; - $form->addElement(new XoopsFormHidden('field_id['.$i.']', 'new')); - $form->addElement(new XoopsFormHidden('field_mid', $field_mid)); - $form->addElement(new XoopsFormHidden('field_tid', $field_tid)); - - $form->addElement(new TDMCreateFormLabel('<tr class="'.$class.'">')); - // Index ID - $form->addElement(new TDMCreateFormLabel('<td class="center">'.$i.'</td>')); - // Field Name - $this_field_name = (!empty($f_name) ? $f_name . '_' : ''); - $field_name = new XoopsFormText(_AM_TDMCREATE_FIELD_NAME, 'field_name['.$i.']', 15, 255, $this_field_name); - $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_name->render().'</td>')); - // Field Type - $fieldtype_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_TYPE, 'field_type['.$i.']'); - $fieldtype_select->addOptionArray($this->tdmcreate->getHandler('fieldtype')->getList()); - $form->addElement(new TDMCreateFormLabel('<td class="center">'.$fieldtype_select->render().'</td>')); - // Field Value - $value = ($i == 1) && ($table_autoincrement->getVar('table_autoincrement') == 1) ? '8' : ''; - $field_value = new XoopsFormText(_AM_TDMCREATE_FIELD_VALUE, 'field_value['.$i.']', 5, 20, $value); - $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_value->render().'</td>')); - // Field Attributes - $field_attributes_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_TYPE, 'field_attribute['.$i.']'); - $field_attributes_select->addOptionArray($this->tdmcreate->getHandler('fieldattributes')->getList()); - $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_attributes_select->render().'</td>')); - // Field Null - $field_null_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_NULL, 'field_null['.$i.']'); - $field_null_select->addOptionArray($this->tdmcreate->getHandler('fieldnull')->getList()); - $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_null_select->render().'</td>')); - // Field Default - $field_default = new XoopsFormText(_AM_TDMCREATE_FIELD_DEFAULT, 'field_default['.$i.']', 15, 25); - $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_default->render().'</td>')); - // Field Key - $field_key_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_KEY, 'field_key['.$i.']'); - $field_key_select->addOptionArray($this->tdmcreate->getHandler('fieldkey')->getList()); - $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_key_select->render().'</td>')); - // Field Void - if( ($i == 1) && ($table_autoincrement->getVar('table_autoincrement') == 1)) { - $form->addElement(new TDMCreateFormLabel('<td> </td></tr>')); - } else { - // Box header row - $parameters_tray = new XoopsFormElementTray('', '<br />'); - // Field Elements - $criteria_element = new CriteriaCompo(); - $criteria_element->add(new Criteria('fieldelement_tid', 0)); - $criteria_table = new CriteriaCompo(); - $criteria_table->add(new Criteria('fieldelement_mid', $field_mid)); - $field_elements_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_ELEMENT_NAME, 'field_element['.$i.']'); - $field_elements_select->addOptionArray($this->tdmcreate->getHandler('fieldelements')->getList($criteria_element)); - $field_elements_select->addOptionArray($this->tdmcreate->getHandler('fieldelements')->getList($criteria_table)); - unset($criteria_element); unset($criteria_table); - $parameters_tray->addElement($field_elements_select); - - $field_parent = 0; - $check_field_parent = new XoopsFormCheckBox(' ', 'field_parent['.$i.']'); - $check_field_parent->addOption($field_parent, _AM_TDMCREATE_FIELD_PARENT ); - $parameters_tray->addElement($check_field_parent); - - $field_inlist = 0; - $check_field_inlist = new XoopsFormCheckBox(' ', 'field_inlist['.$i.']', $field_inlist); - $check_field_inlist->addOption(1, _AM_TDMCREATE_FIELD_INLIST); - $parameters_tray->addElement($check_field_inlist); - - $field_inform = 0; - $check_field_inform = new XoopsFormCheckBox(' ', 'field_inform['.$i.']', $field_inform); - $check_field_inform->addOption(1, _AM_TDMCREATE_FIELD_INFORM); - $parameters_tray->addElement($check_field_inform); + /* + * @public function getFormNew + * + * @param integer $field_mid + * @param integer $field_tid + * @param integer $field_numb + * @param string $f_name + * @param mixed $action + */ + public function getFormNew($field_mid = null, $field_tid = null, $field_numb = null, $f_name = null, $action = false) + { + // Header function class + $fields_form = TDMCreateFields::getInstance(); + $form = $fields_form->getHeaderForm($action); + // Get handler tables + $table_obj = $this->tdmcreate->getHandler('tables')->get($field_tid); // Changed by goffy + $table_autoincrement = $table_obj->getVar('table_autoincrement'); // Added by goffy + // Loop for fields number + $class = 'even'; + for($i = 1; $i <= $field_numb; $i++) { + $class = ($class == 'even') ? 'odd' : 'even'; + // Replaced creation of new line by new function - goffy + $this->getFormNewLine($form, $class, $i, $field_mid, $field_tid, $f_name, $table_autoincrement); + } + // Footer form + return $fields_form->getFooterForm($form); + } + + /* + * @public function getFormNewLine + * + * @param mixed $form + * @param mixed $class + * @param integer $i + * @param integer $field_mid + * @param integer $field_tid + * @param mixed $f_name + * @param integer $table_autoincrement + * + * @author timgno - modified in getFormNewLine by goffy + */ + public function getFormNewLine($form, $class, $i, $field_mid, $field_tid, $f_name, $table_autoincrement) + { + $form->addElement(new XoopsFormHidden('field_id['.$i.']', 'new')); + $form->addElement(new XoopsFormHidden('field_mid', $field_mid)); + $form->addElement(new XoopsFormHidden('field_tid', $field_tid)); + + $form->addElement(new TDMCreateFormLabel('<tr class="'.$class.'">')); + // Index ID + $form->addElement(new TDMCreateFormLabel('<td class="center">'.$i.'</td>')); + // Field Name + $this_field_name = (!empty($f_name) ? $f_name . '_' : ''); + $field_name = new XoopsFormText(_AM_TDMCREATE_FIELD_NAME, 'field_name['.$i.']', 15, 255, $this_field_name); + $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_name->render().'</td>')); + // Field Type + $value = ($i == 1) && ($table_autoincrement == 1) ? '2' : ''; + $fieldtype_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_TYPE, 'field_type['.$i.']', $value); + $fieldtype_select->addOptionArray($this->tdmcreate->getHandler('fieldtype')->getList()); + $form->addElement(new TDMCreateFormLabel('<td class="center">'.$fieldtype_select->render().'</td>')); + // Field Value + $value = ($i == 1) && ($table_autoincrement == 1) ? '8' : ''; + $field_value = new XoopsFormText(_AM_TDMCREATE_FIELD_VALUE, 'field_value['.$i.']', 5, 20, $value); + $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_value->render().'</td>')); + // Field Attributes + $field_attributes_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_TYPE, 'field_attribute['.$i.']'); + $field_attributes_select->addOptionArray($this->tdmcreate->getHandler('fieldattributes')->getList()); + $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_attributes_select->render().'</td>')); + // Field Null + $field_null_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_NULL, 'field_null['.$i.']'); + $field_null_select->addOptionArray($this->tdmcreate->getHandler('fieldnull')->getList()); + $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_null_select->render().'</td>')); + // Field Default + $field_default = new XoopsFormText(_AM_TDMCREATE_FIELD_DEFAULT, 'field_default['.$i.']', 15, 25); + $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_default->render().'</td>')); + // Field Key + $field_key_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_KEY, 'field_key['.$i.']'); + $field_key_select->addOptionArray($this->tdmcreate->getHandler('fieldkey')->getList()); + $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_key_select->render().'</td>')); + // Field Void + if( ($i == 1) && ($table_autoincrement == 1)) { + $form->addElement(new TDMCreateFormLabel('<td> </td></tr>')); + } else { + // Box header row + $parameters_tray = new XoopsFormElementTray('', '<br />'); + // Field Elements + $criteria_element = new CriteriaCompo(); + $criteria_element->add(new Criteria('fieldelement_tid', 0)); + $criteria_table = new CriteriaCompo(); + $criteria_table->add(new Criteria('fieldelement_mid', $field_mid)); + $field_elements_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_ELEMENT_NAME, 'field_element['.$i.']'); + $field_elements_select->addOptionArray($this->tdmcreate->getHandler('fieldelements')->getList($criteria_element)); + $field_elements_select->addOptionArray($this->tdmcreate->getHandler('fieldelements')->getList($criteria_table)); + unset($criteria_element); unset($criteria_table); + $parameters_tray->addElement($field_elements_select); + + $field_parent = 0; + $check_field_parent = new XoopsFormCheckBox(' ', 'field_parent['.$i.']'); + $check_field_parent->addOption($field_parent, _AM_TDMCREATE_FIELD_PARENT ); + $parameters_tray->addElement($check_field_parent); + + $field_inlist = 0; + $check_field_inlist = new XoopsFormCheckBox(' ', 'field_inlist['.$i.']', $field_inlist); + $check_field_inlist->addOption(1, _AM_TDMCREATE_FIELD_INLIST); + $parameters_tray->addElement($check_field_inlist); + + $field_inform = 0; + $check_field_inform = new XoopsFormCheckBox(' ', 'field_inform['.$i.']', $field_inform); + $check_field_inform->addOption(1, _AM_TDMCREATE_FIELD_INFORM); + $parameters_tray->addElement($check_field_inform); - $field_admin = 0; - $check_field_admin = new XoopsFormCheckBox(' ', 'field_admin['.$i.']', $field_admin); - $check_field_admin->addOption(1, _AM_TDMCREATE_FIELD_ADMIN); - $parameters_tray->addElement($check_field_admin); + $field_admin = 0; + $check_field_admin = new XoopsFormCheckBox(' ', 'field_admin['.$i.']', $field_admin); + $check_field_admin->addOption(1, _AM_TDMCREATE_FIELD_ADMIN); + $parameters_tray->addElement($check_field_admin); - $field_user = 0; - $check_field_user = new XoopsFormCheckBox(' ', 'field_user['.$i.']', $field_user); - $check_field_user->addOption(1, _AM_TDMCREATE_FIELD_USER); - $parameters_tray->addElement($check_field_user); + $field_user = 0; + $check_field_user = new XoopsFormCheckBox(' ', 'field_user['.$i.']', $field_user); + $check_field_user->addOption(1, _AM_TDMCREATE_FIELD_USER); + $parameters_tray->addElement($check_field_user); - $field_block = 0; - $check_field_block = new XoopsFormCheckBox('', 'field_block['.$i.']', $field_block); - $check_field_block->addOption(1, _AM_TDMCREATE_FIELD_BLOCK); - $parameters_tray->addElement($check_field_block); - - if(($i == 1)) { - $field_main = 1; - $check_field_main = new XoopsFormRadio('', 'field_main['.$i.']', $field_main); - $check_field_main->addOption($field_main, _AM_TDMCREATE_FIELD_MAINFIELD ); - } else { - $field_main = 0; - $check_field_main = new XoopsFormRadio('', 'field_main['.$i.']'); - $check_field_main->addOption($field_main, _AM_TDMCREATE_FIELD_MAINFIELD ); - } - $parameters_tray->addElement($check_field_main); - - $field_search = 0; - $check_field_search = new XoopsFormCheckBox(' ', 'field_search['.$i.']', $field_search); - $check_field_search->addOption(1, _AM_TDMCREATE_FIELD_SEARCH); - $parameters_tray->addElement($check_field_search); + $field_block = 0; + $check_field_block = new XoopsFormCheckBox('', 'field_block['.$i.']', $field_block); + $check_field_block->addOption(1, _AM_TDMCREATE_FIELD_BLOCK); + $parameters_tray->addElement($check_field_block); + + if(($i == 1)) { + $field_main = 1; + $check_field_main = new XoopsFormRadio('', 'field_main['.$i.']', $field_main); + $check_field_main->addOption($field_main, _AM_TDMCREATE_FIELD_MAINFIELD ); + } else { + $field_main = 0; + $check_field_main = new XoopsFormRadio('', 'field_main['.$i.']'); + $check_field_main->addOption($field_main, _AM_TDMCREATE_FIELD_MAINFIELD ); + } + $parameters_tray->addElement($check_field_main); + + $field_search = 0; + $check_field_search = new XoopsFormCheckBox(' ', 'field_search['.$i.']', $field_search); + $check_field_search->addOption(1, _AM_TDMCREATE_FIELD_SEARCH); + $parameters_tray->addElement($check_field_search); - $field_required = 0; - $check_field_required = new XoopsFormCheckBox(' ', 'field_required['.$i.']', $field_required); - $check_field_required->addOption(1, _AM_TDMCREATE_FIELD_REQUIRED); - $parameters_tray->addElement($check_field_required); - $form->addElement(new TDMCreateFormLabel('<td><div class="portlet"><div class="portlet-header">'._AM_TDMCREATE_FIELD_PARAMETERS_LIST.'</div><div class="portlet-content">'.$parameters_tray->render().'</div></div></td></tr>')); - } - } - // Footer form - return $fields_form->getFooterForm($form); - } - - /* - * @public function getFormEdit - * - * @param integer $field_mid - * @param integer $field_tid - * @param mixed $action - */ - public function getFormEdit($field_mid = null, $field_tid = null, $action = false) - { - // Header function class - $fields_form = TDMCreateFields::getInstance(); - $form = $fields_form->getHeaderForm($action); - // - $class = 'even'; - // Get the list of fields - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('field_mid', $field_mid)); - $criteria->add(new Criteria('field_tid', $field_tid)); - $fields = $this->tdmcreate->getHandler('fields')->getObjects($criteria); - unset($criteria); - $id = 1; - foreach($fields as $field) { - $class = ($class == 'even') ? 'odd' : 'even'; - $field_id = $field->getVar('field_id'); - // - $form->addElement(new XoopsFormHidden('field_id['.$field_id.']', $field_id)); - $form->addElement(new XoopsFormHidden('field_mid', $field_mid)); - $form->addElement(new XoopsFormHidden('field_tid', $field_tid)); - - $form->addElement(new TDMCreateFormLabel('<tr class="'.$class.'">')); - // Index ID - $form->addElement(new TDMCreateFormLabel('<td class="center">'.$id.'</td>')); - // Field Name - $field_name = new XoopsFormText(_AM_TDMCREATE_FIELD_NAME, 'field_name['.$field_id.']', 15, 255, $field->getVar('field_name')); - $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_name->render().'</td>')); - // Field Type - $fieldtype_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_TYPE, 'field_type['.$field_id.']', $field->getVar('field_type')); - $fieldtype_select->addOptionArray($this->tdmcreate->getHandler('fieldtype')->getList()); - $form->addElement(new TDMCreateFormLabel('<td class="center">'.$fieldtype_select->render().'</td>')); - // Field Value - $field_value = new XoopsFormText(_AM_TDMCREATE_FIELD_VALUE, 'field_value['.$field_id.']', 5, 20, $field->getVar('field_value')); - $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_value->render().'</td>')); - // Field Attributes - $field_attributes_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_TYPE, 'field_attribute['.$field_id.']', $field->getVar('field_attribute')); - $field_attributes_select->addOptionArray($this->tdmcreate->getHandler('fieldattributes')->getList()); - $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_attributes_select->render().'</td>')); - // Field Null - $field_null_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_NULL, 'field_null['.$field_id.']', $field->getVar('field_null')); - $field_null_select->addOptionArray($this->tdmcreate->getHandler('fieldnull')->getList()); - $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_null_select->render().'</td>')); - // Field Default - $field_default = new XoopsFormText(_AM_TDMCREATE_FIELD_DEFAULT, 'field_default['.$field_id.']', 15, 25, $field->getVar('field_default')); - $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_default->render().'</td>')); - // Field Key - $field_key_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_KEY, 'field_key['.$field_id.']', $field->getVar('field_key')); - $field_key_select->addOptionArray($this->tdmcreate->getHandler('fieldkey')->getList()); - $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_key_select->render().'</td>')); - // Field Void - $table_autoincrement = $this->tdmcreate->getHandler('tables')->get($field_tid); - if( ($id == 1) && ($table_autoincrement->getVar('table_autoincrement') == 1)) { - $form->addElement(new TDMCreateFormLabel('<td> </td></tr>')); - } else { - // Box header row - $parameters_tray = new XoopsFormElementTray('', '<br />'); - // Field Elements - $criteria_element = new CriteriaCompo(); - $criteria_element->add(new Criteria('fieldelement_tid', 0)); - $criteria_table = new CriteriaCompo(); - $criteria_table->add(new Criteria('fieldelement_mid', $field_mid)); - $field_elements_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_ELEMENT_NAME, 'field_element['.$field_id.']', $field->getVar('field_element')); - $field_elements_select->addOptionArray($this->tdmcreate->getHandler('fieldelements')->getList($criteria_element)); - $field_elements_select->addOptionArray($this->tdmcreate->getHandler('fieldelements')->getList($criteria_table)); - unset($criteria_element); unset($criteria_table); - $parameters_tray->addElement($field_elements_select); - - $check_field_parent = new XoopsFormCheckBox(' ', 'field_parent['.$field_id.']', $field->getVar('field_parent')); - $check_field_parent->addOption(1, _AM_TDMCREATE_FIELD_PARENT ); - $parameters_tray->addElement($check_field_parent); - - $check_field_inlist = new XoopsFormCheckBox(' ', 'field_inlist['.$field_id.']', $field->getVar('field_inlist')); - $check_field_inlist->addOption(1, _AM_TDMCREATE_FIELD_INLIST); - $parameters_tray->addElement($check_field_inlist); - - $check_field_inform = new XoopsFormCheckBox(' ', 'field_inform['.$field_id.']', $field->getVar('field_inform')); - $check_field_inform->addOption(1, _AM_TDMCREATE_FIELD_INFORM); - $parameters_tray->addElement($check_field_inform); + $field_required = 0; + $check_field_required = new XoopsFormCheckBox(' ', 'field_required['.$i.']', $field_required); + $check_field_required->addOption(1, _AM_TDMCREATE_FIELD_REQUIRED); + $parameters_tray->addElement($check_field_required); + $form->addElement(new TDMCreateFormLabel('<td><div class="portlet"><div class="portlet-header">'._AM_TDMCREATE_FIELD_PARAMETERS_LIST.'</div><div class="portlet-content">'.$parameters_tray->render().'</div></div></td></tr>')); + } + } + + /* + * @public function getFormEdit + * + * @param integer $field_mid + * @param integer $field_tid + * @param mixed $action + */ + public function getFormEdit($field_mid = null, $field_tid = null, $action = false) + { + // Header function class + $fields_form = TDMCreateFields::getInstance(); + $form = $fields_form->getHeaderForm($action); + // + $class = 'even'; + // Get the number of fields - goffy + $tablesHandler =& $this->tdmcreate->getHandler('tables'); + $table_nbfields = $tablesHandler->get($field_tid)->getVar('table_nbfields'); + $f_name = $tablesHandler->get($field_tid)->getVar('table_fieldname'); - $check_field_admin = new XoopsFormCheckBox(' ', 'field_admin['.$field_id.']', $field->getVar('field_admin')); - $check_field_admin->addOption(1, _AM_TDMCREATE_FIELD_ADMIN); - $parameters_tray->addElement($check_field_admin); + // Get the list of fields + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('field_mid', $field_mid)); + $criteria->add(new Criteria('field_tid', $field_tid)); + $criteria->setSort('field_id'); //added by goffy + $fields = $this->tdmcreate->getHandler('fields')->getObjects($criteria); + unset($criteria); + $id = 1; + foreach($fields as $field) { + $class = ($class == 'even') ? 'odd' : 'even'; + $field_id = $field->getVar('field_id'); + if ($id>$table_nbfields) { //delete additional fields, if number of fields is reduced - goffy + $fieldsObj =& $this->tdmcreate->getHandler('fields')->get( $field_id ); + $this->tdmcreate->getHandler('fields')->delete($fieldsObj, true); + } else { + // show field with settings + $form->addElement(new XoopsFormHidden('field_id['.$field_id.']', $field_id)); + $form->addElement(new XoopsFormHidden('field_mid', $field_mid)); + $form->addElement(new XoopsFormHidden('field_tid', $field_tid)); + + $form->addElement(new TDMCreateFormLabel('<tr class="'.$class.'">')); + // Index ID + $form->addElement(new TDMCreateFormLabel('<td class="center">'.$id.'</td>')); + // Field Name + $field_name = new XoopsFormText(_AM_TDMCREATE_FIELD_NAME, 'field_name['.$field_id.']', 15, 255, $field->getVar('field_name')); + $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_name->render().'</td>')); + // Field Type + $fieldtype_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_TYPE, 'field_type['.$field_id.']', $field->getVar('field_type')); + $fieldtype_select->addOptionArray($this->tdmcreate->getHandler('fieldtype')->getList()); + $form->addElement(new TDMCreateFormLabel('<td class="center">'.$fieldtype_select->render().'</td>')); + // Field Value + $field_value = new XoopsFormText(_AM_TDMCREATE_FIELD_VALUE, 'field_value['.$field_id.']', 5, 20, $field->getVar('field_value')); + $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_value->render().'</td>')); + // Field Attributes + $field_attributes_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_TYPE, 'field_attribute['.$field_id.']', $field->getVar('field_attribute')); + $field_attributes_select->addOptionArray($this->tdmcreate->getHandler('fieldattributes')->getList()); + $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_attributes_select->render().'</td>')); + // Field Null + $field_null_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_NULL, 'field_null['.$field_id.']', $field->getVar('field_null')); + $field_null_select->addOptionArray($this->tdmcreate->getHandler('fieldnull')->getList()); + $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_null_select->render().'</td>')); + // Field Default + $field_default = new XoopsFormText(_AM_TDMCREATE_FIELD_DEFAULT, 'field_default['.$field_id.']', 15, 25, $field->getVar('field_default')); + $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_default->render().'</td>')); + // Field Key + $field_key_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_KEY, 'field_key['.$field_id.']', $field->getVar('field_key')); + $field_key_select->addOptionArray($this->tdmcreate->getHandler('fieldkey')->getList()); + $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_key_select->render().'</td>')); + // Field Void + $table_autoincrement = $this->tdmcreate->getHandler('tables')->get($field_tid); + if( ($id == 1) && ($table_autoincrement->getVar('table_autoincrement') == 1)) { + $form->addElement(new TDMCreateFormLabel('<td> </td></tr>')); + } else { + // Box header row + $parameters_tray = new XoopsFormElementTray('', '<br />'); + // Field Elements + $criteria_element = new CriteriaCompo(); + $criteria_element->add(new Criteria('fieldelement_tid', 0)); + $criteria_table = new CriteriaCompo(); + $criteria_table->add(new Criteria('fieldelement_mid', $field_mid)); + $field_elements_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_ELEMENT_NAME, 'field_element['.$field_id.']', $field->getVar('field_element')); + $field_elements_select->addOptionArray($this->tdmcreate->getHandler('fieldelements')->getList($criteria_element)); + $field_elements_select->addOptionArray($this->tdmcreate->getHandler('fieldelements')->getList($criteria_table)); + unset($criteria_element); unset($criteria_table); + $parameters_tray->addElement($field_elements_select); + + $check_field_parent = new XoopsFormCheckBox(' ', 'field_parent['.$field_id.']', $field->getVar('field_parent')); + $check_field_parent->addOption(1, _AM_TDMCREATE_FIELD_PARENT ); + $parameters_tray->addElement($check_field_parent); + + $check_field_inlist = new XoopsFormCheckBox(' ', 'field_inlist['.$field_id.']', $field->getVar('field_inlist')); + $check_field_inlist->addOption(1, _AM_TDMCREATE_FIELD_INLIST); + $parameters_tray->addElement($check_field_inlist); + + $check_field_inform = new XoopsFormCheckBox(' ', 'field_inform['.$field_id.']', $field->getVar('field_inform')); + $check_field_inform->addOption(1, _AM_TDMCREATE_FIELD_INFORM); + $parameters_tray->addElement($check_field_inform); - $check_field_user = new XoopsFormCheckBox(' ', 'field_user['.$field_id.']', $field->getVar('field_user')); - $check_field_user->addOption(1, _AM_TDMCREATE_FIELD_USER); - $parameters_tray->addElement($check_field_user); + $check_field_admin = new XoopsFormCheckBox(' ', 'field_admin['.$field_id.']', $field->getVar('field_admin')); + $check_field_admin->addOption(1, _AM_TDMCREATE_FIELD_ADMIN); + $parameters_tray->addElement($check_field_admin); - $check_field_block = new XoopsFormCheckBox('', 'field_block['.$field_id.']', $field->getVar('field_block')); - $check_field_block->addOption(1, _AM_TDMCREATE_FIELD_BLOCK); - $parameters_tray->addElement($check_field_block); - - $field_main = $field->getVar('field_main'); - if($field_main == 1) { - $check_field_main = new XoopsFormRadio('', 'field_main['.$field_id.']', $field_main); - } else { - $check_field_main = new XoopsFormRadio('', 'field_main['.$field_id.']'); - } - $check_field_main->addOption($field_main, _AM_TDMCREATE_FIELD_MAINFIELD ); - $parameters_tray->addElement($check_field_main); - - $check_field_search = new XoopsFormCheckBox(' ', 'field_search['.$field_id.']', $field->getVar('field_search')); - $check_field_search->addOption(1, _AM_TDMCREATE_FIELD_SEARCH); - $parameters_tray->addElement($check_field_search); + $check_field_user = new XoopsFormCheckBox(' ', 'field_user['.$field_id.']', $field->getVar('field_user')); + $check_field_user->addOption(1, _AM_TDMCREATE_FIELD_USER); + $parameters_tray->addElement($check_field_user); - $check_field_required = new XoopsFormCheckBox(' ', 'field_required['.$field_id.']', $field->getVar('field_required')); - $check_field_required->addOption(1, _AM_TDMCREATE_FIELD_REQUIRED); - $parameters_tray->addElement($check_field_required); - $form->addElement(new TDMCreateFormLabel('<td><div class="portlet"><div class="portlet-header">'._AM_TDMCREATE_FIELD_PARAMETERS_LIST.'</div><div class="portlet-content">'.$parameters_tray->render().'</div></div></td></tr>')); - } - $id++; - } - unset($id); - // Footer form - return $fields_form->getFooterForm($form); - } + $check_field_block = new XoopsFormCheckBox('', 'field_block['.$field_id.']', $field->getVar('field_block')); + $check_field_block->addOption(1, _AM_TDMCREATE_FIELD_BLOCK); + $parameters_tray->addElement($check_field_block); + + $field_main = $field->getVar('field_main'); + if($field_main == 1) { + $check_field_main = new XoopsFormRadio('', 'field_main['.$field_id.']', $field_main); + } else { + $check_field_main = new XoopsFormRadio('', 'field_main['.$field_id.']'); + } + $check_field_main->addOption($field_main, _AM_TDMCREATE_FIELD_MAINFIELD ); + $parameters_tray->addElement($check_field_main); + + $check_field_search = new XoopsFormCheckBox(' ', 'field_search['.$field_id.']', $field->getVar('field_search')); + $check_field_search->addOption(1, _AM_TDMCREATE_FIELD_SEARCH); + $parameters_tray->addElement($check_field_search); + + $check_field_required = new XoopsFormCheckBox(' ', 'field_required['.$field_id.']', $field->getVar('field_required')); + $check_field_required->addOption(1, _AM_TDMCREATE_FIELD_REQUIRED); + $parameters_tray->addElement($check_field_required); + $form->addElement(new TDMCreateFormLabel('<td><div class="portlet"><div class="portlet-header">'._AM_TDMCREATE_FIELD_PARAMETERS_LIST.'</div><div class="portlet-content">'.$parameters_tray->render().'</div></div></td></tr>')); + } + $id++; + } + } + // If you change number fields in tables, + // adding missing fields or delete unnecessary fields + // By goffy + for ($i = $id; $i <= $table_nbfields; $i++) { + $class = ($class == 'even') ? 'odd' : 'even'; + $this->getFormNewLine($form, $class, $i, $field_mid, $field_tid, $f_name, 0); + } + unset($id); + // Footer form + return $fields_form->getFooterForm($form); + } + /* * @private function getFooterForm * @param null Added: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/TDMCreateAbstract.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/TDMCreateAbstract.php (rev 0) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/TDMCreateAbstract.php 2014-11-23 09:41:18 UTC (rev 12867) @@ -0,0 +1,137 @@ +<?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: abstract.php 12258 2014-01-02 09:33:29Z timgno $ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +/** + * Abstract base class + */ +abstract class TDMCreateAbstract +{ + /** + * "module" attribute fot files + * + * @var mixed + */ + protected $module = null; + + /** + * "table" attribute fot files + * + * @var mixed + */ + protected $table = null; + + /** + * "tables" attribute fot files + * + * @var mixed + */ + protected $tables = null; + + /** + * "fields" attribute fot files + * + * @var mixed + */ + protected $fields = null; + + /** + * public function setFileName + * @param mixed $module + */ + public function setModule($module) { + if (is_object($module) && ($module instanceof TDMCreateModules)) { + $this->module = $module; + } + } + + /* + * @public function getModule + * @param null + */ + public function getModule() { + return $this->module; + } + + /** + * public function setTable + * @param mixed $table + */ + public function setTable($table) { + if (is_object($table) && ($table instanceof TDMCreateTables)) { + $this->table = $table; + } + } + + /* + * @public function getTable + * @param null + */ + public function getTable() { + return $this->table; + } + + /** + * public function setTables + * @param mixed $tables + */ + public function setTables($tables) { + if (is_array($tables)) { + $this->tables = $tables; + } + } + + /* + * @public function getTables + * @param null + */ + public function getTables() { + return $this->tables; + } + + /** + * @public function setFields + * @param mixed $fields + */ + public function setFields($fields) { + if (is_object($fields) && ($fields instanceof TDMCreateFields)) { + $this->fields = $fields; + } + } + + /* + * @public function getFields + * @param null + */ + public function getFields() { + return $this->fields; + } + + /** + * Generates output for files. + * + * This method is abstract and must be overwritten by the child classes. + * + * @abstract + */ + public function render() {} +} \ No newline at end of file Added: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/TDMCreateArchitecture.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/TDMCreateArchitecture.php (rev 0) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/TDMCreateArchitecture.php 2014-11-23 09:41:18 UTC (rev 12867) @@ -0,0 +1,482 @@ +<?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: architecture.php 12258 2014-01-02 09:33:29Z timgno $ + */ +defined('XOOPS_ROOT_PATH') or die('Restricted access'); +require_once 'TDMCreateStructure.php'; + +class TDMCreateArchitecture extends TDMCreateStructure +{ + /* + * @var mixed + */ + private $tdmcreate = null; + /* + * @var mixed + */ + private $structure = null; + /* + * @public function constructor class + * @param null + */ + public function __construct() { + $this->tdmcreate = TDMCreate::getInstance(); + $this->structure = TDMCreateStructure::getInstance(); + } + /* + * @static function &getInstance + * @param null + */ + public static function &getInstance() + { + static $instance = false; + if (!$instance) { + $instance = new self(); + } + return $instance; + } + /* + * @public function getPath + * @param string $path + */ + public function getPath($path) { + $this->path = $path; + } + /* + * @public function getUploadPath + * @param string $path + */ + public function getUploadPath($path) { + $this->uploadPath = $path; + } + /* + * @public function createBaseFoldersFiles + * @param string $module + */ + public function createBaseFoldersFiles( $module ) + { + // Module + $modId = $module->getVar('mod_id'); + $language = $GLOBALS['xoopsConfig']['language']; + // Id of tables + $criteriaTables = new CriteriaCompo(); + $criteriaTables->add(new Criteria('table_mid', $modId)); + $tables = $this->tdmcreate->getHandler('tables')->getObjects($criteriaTables); + unset($criteriaTables); + // + $table = null; + foreach (array_keys($tables) as $t) + { + $tableId = $tables[$t]->getVar('table_id'); + $tableName = $tables[$t]->getVar('table_name'); + $tableAdmin = $tables[$t]->getVar('table_admin'); + $tableUser = $tables[$t]->getVar('table_user'); + $tableBlocks = $tables[$t]->getVar('table_blocks'); + $table = $this->tdmcreate->getHandler('tables')->get($tableId); + } + // + $indexFile = $this->path.'/index.html'; + $docsFolder = $this->path.'/docs'; + $logosFolder = $this->path.'/assets/images/logos'; + $stlModuleDirname = $module->getVar('mod_dirname'); + $stlModuleAuthor = str_replace(' ', '', strtolower($module->getVar('mod_author'))); + // Creation of the Directory in repository + $targetDirectory = $this->uploadPath.'/repository/'. $stlModuleDirname; + $uploadImagesRepository = $this->uploadPath.'/images/repository'; + // 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'); + if ( $module->getVar('mod_admin') == 1) { + // Creation of "admin" folder and index.html file + $this->structure->makeDirAndCopyFile('admin', $indexFile, 'index.html'); + } + if ( $module->getVar('mod_blocks') == 1) { + // Creation of "blocks" folder and index.html file + $this->structure->makeDirAndCopyFile('blocks', $indexFile, 'index.html'); + } + // Creation of "class" folder and index.html file + $this->structure->makeDirAndCopyFile('class', $indexFile, 'index.html'); + // Creation of "assets" folder and index.html file + $this->structure->makeDirAndCopyFile('assets', $indexFile, 'index.html'); + // Creation of "css" folder and index.html file + $this->structure->makeDirAndCopyFile('assets/css', $indexFile, 'index.html'); + // Creation of "images" folder and index.html file + $this->structure->makeDirAndCopyFile('assets/images', $indexFile, 'index.html'); + //Copy the logo of the module + $modImage = str_replace(' ', '', strtolower($module->getVar('mod_image'))); + $this->structure->copyFile('assets/images', $uploadImagesRepository.'/'.$modImage, $modImage); + // Creation of 'images/icons' folder and index.html file - Added in Version 1.15 + $this->structure->makeDirAndCopyFile('assets/images/icons', $indexFile, 'index.html'); + // Creation of "images/icons/16" folder and index.html file + $this->structure->makeDirAndCopyFile('assets/images/icons/16', $indexFile, 'index.html'); + // Creation of "images/icons/32" folder and index.html file + $this->structure->makeDirAndCopyFile('assets/images/icons/32', $indexFile, 'index.html'); + // Copy of 'module_author_logo.gif' file in uploads dir + $logoGifFrom = $uploadImagesRepository.'/'.$stlModuleAuthor.'_logo.gif'; + if (!file_exists($logoGifFrom)) { + copy($logosFolder.'/'.$stlModuleAuthor.'_logo.gif', $logoGifFrom); + } + // Creation of 'module_author_logo.gif' file + $this->structure->copyFile('assets/images', $logoGifFrom, $stlModuleAuthor.'_logo.gif'); + // Creation of "images" folder and index.html file + $this->structure->makeDirAndCopyFile('assets/js', $indexFile, 'index.html'); + // Creation of 'docs' folder and index.html file + $this->structure->makeDirAndCopyFile('docs', $indexFile, 'index.html'); + // Creation of 'credits.txt' file + $this->structure->copyFile('docs', $docsFolder.'/credits.txt', 'credits.txt'); + // Creation of 'install.txt' file + $this->structure->copyFile('docs', $docsFolder.'/install.txt', 'install.txt'); + // Creation of 'lang_diff.txt' file + $this->structure->copyFile('docs', $docsFolder.'/lang_diff.txt', 'lang_diff.txt'); + // Creation of 'license.txt' file + $this->structure->copyFile('docs', $docsFolder.'/license.txt', 'license.txt'); + // Creation of 'readme.txt' file + $this->structure->copyFile('docs', $docsFolder.'/readme.txt', 'readme.txt'); + // Creation of "include" folder and index.html file + $this->structure->makeDirAndCopyFile('include', $indexFile, 'index.html'); + // Creation of "language" folder and index.html file + $this->structure->makeDirAndCopyFile('language', $indexFile, 'index.html'); + // Creation of 'default english' folder + if($language != 'english' ) { + // Creation of "language/local_language" folder and index.html file + $this->structure->makeDirAndCopyFile('language/'.$language, $indexFile, 'index.html'); + // Creation of "language/local_language/help" folder and index.html file + $this->structure->makeDirAndCopyFile('language/'.$language. '/help', $indexFile, 'index.html'); + } + // Creation of "english" folder and index.html file + $this->structure->makeDirAndCopyFile('language/english', $indexFile, 'index.html'); + // Creation of "language/english/help" folder and index.html file + $this->structure->makeDirAndCopyFile('language/english/help', $indexFile, 'index.html'); + if( $module->getVar('mod_admin') == 1 ) { + // Creation of "templates" folder and index.html file + $this->structure->makeDirAndCopyFile('templates', $indexFile, 'index.html'); + } + if( $module->getVar('mod_admin') == 1 ) { + // Creation of "templates/admin" folder and index.html file + $this->structure->makeDirAndCopyFile('templates/admin', $indexFile, 'index.html'); + } + if(is_object($table)) { + if( $table->getVar('table_blocks') == 1 ) { + // Creation of "templates/blocks" folder and index.html file + $this->structure->makeDirAndCopyFile('templates/blocks', $indexFile, 'index.html'); + } + if( $table->getVar('table_name') != null ) { + // Creation of "sql" folder and index.html file + $this->structure->makeDirAndCopyFile('sql', $indexFile, 'index.html'); + } + if( $table->getVar('table_notifications') == 1 ) { + // Creation of "language/english/mail_template" folder and index.html file + $this->structure->makeDirAndCopyFile('language/english/mail_template', $indexFile, 'index.html'); + if($language != 'english' ) { + // Creation of "language/local_language/mail_template" folder and index.html file + $this->structure->makeDirAndCopyFile('language/'.$language.'/mail_template', $indexFile, 'index.html'); + } + } + } + } + + /* + * @public function createFilesToBuilding + * @param string $module + */ + public function createFilesToBuilding( $module ) + { + // Module + $modId = $module->getVar('mod_id'); + $moduleDirname = $module->getVar('mod_dirname'); + $uploadTablesIcons32 = $this->uploadPath.'/images/tables'; + $framePathIcon32 = XOOPS_... [truncated message content] |
From: <txm...@us...> - 2014-11-30 21:30:16
|
Revision: 12880 http://sourceforge.net/p/xoops/svn/12880 Author: txmodxoops Date: 2014-11-30 21:30:00 +0000 (Sun, 30 Nov 2014) Log Message: ----------- Added new classes file for autoload fixed bugs Modified Paths: -------------- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fields.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/ClassFormElements.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/TemplatesAdminPages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/include/common.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/include/install.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/xoops_version.php Added Paths: ----------- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/TDMCreate.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/TDMCreateSession.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/UserFooter.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/UserHeader.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/UserIndex.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/UserNotificationUpdate.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/UserObjects.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/UserPages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/UserPrint.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/UserRss.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/UserSubmit.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/UserXoopsVersion.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/form/TDMCreateThemeForm.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/html/TDMCreateFormLabel.php Removed Paths: ------------- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/abstract.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/about.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/footer.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/header.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/index.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/menu.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/objects.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/pages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/permissions.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/architecture.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/blocks/blocks.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/classes.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/formelements.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/helper.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/css/styles.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/docs/changelog.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/docs/docs.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/file.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/htmlsmartycodes.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/comment_functions.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/comments.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/common.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/functions.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/install.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/jquery.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/include/update.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/index.html XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/admin.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/blocks.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/defines.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/help.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/language/mail.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/mysql.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/structure.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/tablefields.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/about.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/footer.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/header.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/index.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/pages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/permissions.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/blocks/blocks.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/footer.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/header.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/index.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/pages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/footer.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/header.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/index.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/notification_update.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/objects.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/pages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/print.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/rss.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/submit.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/user/xoopsversion.php Added: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/TDMCreate.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/TDMCreate.php (rev 0) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/TDMCreate.php 2014-11-30 21:30:00 UTC (rev 12880) @@ -0,0 +1,173 @@ +<?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 trabis <lus...@gm...> + * @version $Id: tdmcreate.php 12258 2014-04-12 23:45:12Z timgno $ + */ +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +class TDMCreate +{ + /** + * @var string + */ + private $dirname = null; + /** + * @var string + */ + private $module = null; + /** + * @var string + */ + private $handler = null; + /** + * @var string + */ + private $config = null; + /** + * @var string + */ + private $debug = null; + /** + * @var array + */ + private $debugArray = array(); + /* + * @protected function constructor class + * @param mixed $debug + */ + protected function __construct($debug) + { + $this->debug = $debug; + $this->dirname = basename(dirname(dirname(__FILE__))); + } + /* + * @static function &getInstance + * @param mixed $debug + */ + public static function &getInstance($debug = false) + { + static $instance = false; + if (!$instance) { + $instance = new self($debug); + } + return $instance; + } + /* + * @static function getModule + * @param null + */ + public function &getModule() + { + if ($this->module == null) { + $this->initModule(); + } + return $this->module; + } + /* + * @static function getConfig + * @param string $name + */ + public function getConfig($name = null) + { + if ($this->config == null) { + $this->initConfig(); + } + if (!$name) { + $this->addLog("Getting all config"); + return $this->config; + } + if (!isset($this->config[$name])) { + $this->addLog("ERROR :: CONFIG '{$name}' does not exist"); + return null; + } + $this->addLog("Getting config '{$name}' : " . $this->config[$name]); + return $this->config[$name]; + } + /* + * @static function setConfig + * @param string $name + * @param mixed $value + */ + public function setConfig($name = null, $value = null) + { + if ($this->config == null) { + $this->initConfig(); + } + $this->config[$name] = $value; + $this->addLog("Setting config '{$name}' : " . $this->config[$name]); + return $this->config[$name]; + } + /* + * @static function getHandler + * @param string $name + */ + public function &getHandler($name) + { + if (!isset($this->handler[$name . '_handler'])) { + $this->initHandler($name); + } + $this->addLog("Getting handler '{$name}'"); + return $this->handler[$name . '_handler']; + } + /* + * @static function initModule + * @param null + */ + public function initModule() + { + global $xoopsModule; + if (isset($xoopsModule) && is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $this->dirname) { + $this->module = $xoopsModule; + } else { + $hModule = xoops_gethandler('module'); + $this->module = $hModule->getByDirname($this->dirname); + } + $this->addLog('INIT MODULE'); + } + /* + * @static function initConfig + * @param null + */ + public function initConfig() + { + $this->addLog('INIT CONFIG'); + $hModConfig = xoops_gethandler('config'); + $this->config = $hModConfig->getConfigsByCat(0, $this->getModule()->getVar('mid')); + } + /* + * @static function initHandler + * @param string $name + */ + public function initHandler($name) + { + $this->addLog('INIT ' . $name . ' HANDLER'); + $this->handler[$name . '_handler'] = xoops_getModuleHandler($name, $this->dirname); + } + /* + * @static function addLog + * @param string $log + */ + public function addLog($log) + { + if ($this->debug) { + if (is_object($GLOBALS['xoopsLogger'])) { + $GLOBALS['xoopsLogger']->addExtra($this->module->name(), $log); + } + } + } +} \ No newline at end of file Added: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/TDMCreateSession.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/TDMCreateSession.php (rev 0) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/TDMCreateSession.php 2014-11-30 21:30:00 UTC (rev 12880) @@ -0,0 +1,107 @@ +<?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 class + * + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package TDMCreate + * @since 1.0 + * @author trabis <lus...@gm...> + * @author Harry Fuecks (PHP Anthology Volume II) + * @version $Id: 1.91 session.php 12453 2014-03-28 18:34:46Z timgno $ + */ +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +class TDMCreateSession +{ + /** + * Session constructor<br /> + * Starts the session with session_start() + * <strong>Note:</strong> that if the session has already started, + * session_start() does nothing + */ + protected function __construct() + { + if(!isset($_SESSION)) { + session_start(); + } + } + + /* + * @static function &getInstance + * @param null + */ + public static function &getInstance() + { + static $_sess = false; + if (!isset($_sess)) { + $_sess = new self(); + } + return $_sess; + } + + /** + * Sets a session variable + * + * @param string $name name of variable + * @param mixed $value value of variable + * + * @return void + * @access public + */ + public function setSession($name, $value) + { + $_SESSION[$name] = $value; + } + + /** + * Fetches a session variable + * + * @param string $name name of variable + * + * @return mixed value of session variable + * @access public + */ + public function getSession($name) + { + if (isset($_SESSION[$name])) { + return $_SESSION[$name]; + } else { + return false; + } + } + + /** + * Deletes a session variable + * + * @param string $name name of variable + * + * @return void + * @access public + */ + public function deleteSession($name) + { + unset($_SESSION[$name]); + } + + /** + * Destroys the whole session + * + * @return void + * @access public + */ + public function destroySession() + { + $_SESSION = array(); + session_destroy(); + } +} \ No newline at end of file Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fields.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fields.php 2014-11-27 22:11:13 UTC (rev 12879) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fields.php 2014-11-30 21:30:00 UTC (rev 12880) @@ -19,8 +19,8 @@ * @version $Id: 1.91 fields.php 12258 2014-01-02 09:33:29Z timgno $ */ defined('XOOPS_ROOT_PATH') or die('Restricted access'); -require_once 'html/simplelabel.php'; -require_once 'form/themeform.php'; +require_once 'html/TDMCreateFormLabel.php'; +require_once 'form/TDMCreateThemeForm.php'; /* * @Class TDMCreateFields * @extends XoopsObject Deleted: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/abstract.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/abstract.php 2014-11-27 22:11:13 UTC (rev 12879) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/abstract.php 2014-11-30 21:30:00 UTC (rev 12880) @@ -1,137 +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: abstract.php 12258 2014-01-02 09:33:29Z timgno $ - */ - -defined('XOOPS_ROOT_PATH') or die('Restricted access'); - -/** - * Abstract base class - */ -abstract class TDMCreateAbstract -{ - /** - * "module" attribute fot files - * - * @var mixed - */ - protected $module = null; - - /** - * "table" attribute fot files - * - * @var mixed - */ - protected $table = null; - - /** - * "tables" attribute fot files - * - * @var mixed - */ - protected $tables = null; - - /** - * "fields" attribute fot files - * - * @var mixed - */ - protected $fields = null; - - /** - * public function setFileName - * @param mixed $module - */ - public function setModule($module) { - if (is_object($module) && ($module instanceof TDMCreateModules)) { - $this->module = $module; - } - } - - /* - * @public function getModule - * @param null - */ - public function getModule() { - return $this->module; - } - - /** - * public function setTable - * @param mixed $table - */ - public function setTable($table) { - if (is_object($table) && ($table instanceof TDMCreateTables)) { - $this->table = $table; - } - } - - /* - * @public function getTable - * @param null - */ - public function getTable() { - return $this->table; - } - - /** - * public function setTables - * @param mixed $tables - */ - public function setTables($tables) { - if (is_array($tables)) { - $this->tables = $tables; - } - } - - /* - * @public function getTables - * @param null - */ - public function getTables() { - return $this->tables; - } - - /** - * @public function setFields - * @param mixed $fields - */ - public function setFields($fields) { - if (is_object($fields) && ($fields instanceof TDMCreateFields)) { - $this->fields = $fields; - } - } - - /* - * @public function getFields - * @param null - */ - public function getFields() { - return $this->fields; - } - - /** - * Generates output for files. - * - * This method is abstract and must be overwritten by the child classes. - * - * @abstract - */ - public function render() {} -} \ No newline at end of file Deleted: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/about.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/about.php 2014-11-27 22:11:13 UTC (rev 12879) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/about.php 2014-11-30 21:30:00 UTC (rev 12880) @@ -1,73 +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: 1.91 admin_about.php 12258 2014-01-02 09:33:29Z timgno $ - */ -defined('XOOPS_ROOT_PATH') or die('Restricted access'); - -class AdminAbout extends TDMCreateFile -{ - /* - * @public function constructor - * @param null - */ - public function __construct() { - $this->tdmcfile = TDMCreateFile::getInstance(); - } - /* - * @static function &getInstance - * @param null - */ - public static function &getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - return $instance; - } - /* - * @public function write - * @param string $module - * @param string $filename - */ - public function write($module, $filename) { - $this->setModule($module); - $this->setFileName($filename); - } - /* - * @public function render - * @param null - */ - public function render() { - $module = $this->getModule(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $moduleDonations = $module->getVar('mod_donations'); - $content = $this->getHeaderFilesComments($module, $filename); - $content .= <<<EOT -include 'header.php'; -\$template_main = '{$moduleDirname}_admin_about.tpl'; -\$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('about.php')); -\$GLOBALS['xoopsTpl']->assign('about', \$adminMenu->renderAbout('{$moduleDonations}', false)); -include 'footer.php'; -EOT; - $this->tdmcfile->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - return $this->tdmcfile->renderFile(); - } -} \ No newline at end of file Deleted: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/footer.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/footer.php 2014-11-27 22:11:13 UTC (rev 12879) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/footer.php 2014-11-30 21:30:00 UTC (rev 12880) @@ -1,73 +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: 1.91 admin_footer.php 12258 2014-01-02 09:33:29Z timgno $ - */ -defined('XOOPS_ROOT_PATH') or die('Restricted access'); - -class AdminFooter extends TDMCreateFile -{ - /* - * @public function constructor - * @param null - */ - public function __construct() { - $this->tdmcfile = TDMCreateFile::getInstance(); - } - /* - * @static function &getInstance - * @param string $module - * @param string $filename - */ - public static function &getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - return $instance; - } - /* - * @public function write - * @param string $module - * @param string $filename - */ - public function write($module, $filename) { - $this->setModule($module); - $this->setFileName($filename); - } - /* - * @public function render - * @param null - */ - public function render() { - $module = $this->getModule(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $content = $this->getHeaderFilesComments($module, $filename); - $content .= <<<EOT -if ( isset(\$template_main) ) { - \$GLOBALS['xoopsTpl']->display("db:{\$template_main}"); -} -xoops_cp_footer(); -?> -EOT; - $this->tdmcfile->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - return $this->tdmcfile->renderFile(); - } -} \ No newline at end of file Deleted: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/header.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/header.php 2014-11-27 22:11:13 UTC (rev 12879) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/header.php 2014-11-30 21:30:00 UTC (rev 12880) @@ -1,126 +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: admin_header.php 12258 2014-01-02 09:33:29Z timgno $ - */ -defined('XOOPS_ROOT_PATH') or die('Restricted access'); - -class AdminHeader extends TDMCreateFile -{ - /* - * @public function constructor - * @param null - */ - public function __construct() { - $this->tdmcfile = TDMCreateFile::getInstance(); - } - /* - * @static function &getInstance - * @param null - */ - public static function &getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - return $instance; - } - /* - * @public function write - * @param string $module - * @param mixed $table - * @param array $tables - * @param string $filename - */ - public function write($module, $table, $tables, $filename) { - $this->setModule($module); - $this->setTable($table); - $this->setTables($tables); - $this->setFileName($filename); - } - /* - * @public function render - * @param null - */ - public function render() { - $module = $this->getModule(); - $table = $this->getTable(); - $tables = $this->getTables(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $ucfModuleDirname = ucfirst($moduleDirname); - $language = $this->getLanguage('AM'); - $content = $this->getHeaderFilesComments($module, $filename); - $content .= <<<EOT -\nrequire_once dirname(dirname(dirname(dirname(__FILE__)))). '/include/cp_header.php'; -\$thisPath = dirname(dirname(__FILE__)); -include_once \$thisPath.'/include/common.php'; -\$sysPathIcon16 = '../' . \$xoopsModule->getInfo('sysicons16'); -\$sysPathIcon32 = '../' . \$xoopsModule->getInfo('sysicons32'); -\$pathModuleAdmin = \$GLOBALS['xoopsModule']->getInfo('dirmoduleadmin'); -// -\$modPathIcon16 = \$xoopsModule->getInfo('modicons16'); -\$modPathIcon32 = \$xoopsModule->getInfo('modicons32');\n -EOT; - if (is_object($table)) { - if ( $table->getVar('table_name') != '' ) { - $content .= <<<EOT -// Get instance of module -\${$moduleDirname} = {$ucfModuleDirname}Helper::getInstance();\n -EOT; - } - foreach (array_keys($tables) as $t) - { - $tableName = $tables[$t]->getVar('table_name'); - $content .= <<<EOT -// {$tableName} -\${$tableName}Handler =& \${$moduleDirname}->getHandler('{$tableName}');\n -EOT; - } - } - $content .=<<<EOT -// -\$myts =& MyTextSanitizer::getInstance(); -if (!isset(\$xoopsTpl) || !is_object(\$xoopsTpl)) { - include_once(XOOPS_ROOT_PATH."/class/template.php"); - \$xoopsTpl = new XoopsTpl(); -} -// System icons path -\$xoopsTpl->assign('sysPathIcon16', \$sysPathIcon16); -\$xoopsTpl->assign('sysPathIcon32', \$sysPathIcon32); -// Local icons path -\$xoopsTpl->assign('modPathIcon16', \$modPathIcon16); -\$xoopsTpl->assign('modPathIcon32', \$modPathIcon32); - -//Load languages -xoops_loadLanguage('admin'); -xoops_loadLanguage('modinfo'); -// Local admin menu class -if ( file_exists(\$GLOBALS['xoops']->path(\$pathModuleAdmin.'/moduleadmin.php'))){ - include_once \$GLOBALS['xoops']->path(\$pathModuleAdmin.'/moduleadmin.php'); -}else{ - redirect_header("../../../admin.php", 5, _AM_MODULEADMIN_MISSING, false); -} -xoops_cp_header(); -\$adminMenu = new ModuleAdmin(); -EOT; - $this->tdmcfile->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - return $this->tdmcfile->renderFile(); - } -} \ No newline at end of file Deleted: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/index.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/index.php 2014-11-27 22:11:13 UTC (rev 12879) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/index.php 2014-11-30 21:30:00 UTC (rev 12880) @@ -1,114 +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: admin_index.php 12258 2014-01-02 09:33:29Z timgno $ - */ -defined('XOOPS_ROOT_PATH') or die('Restricted access'); - -class AdminIndex extends TDMCreateFile -{ - /* - * @public function constructor - * @param null - */ - public function __construct() { - $this->tdmcfile = TDMCreateFile::getInstance(); - } - /* - * @static function &getInstance - * @param null - */ - public static function &getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - return $instance; - } - /* - * @public function write - * @param string $module - * @param mixed $tables - * @param string $filename - */ - public function write($module, $tables, $filename) { - $this->setModule($module); - $this->setTables($tables); - $this->setFileName($filename); - } - /* - * @public function render - * @param null - */ - public function render() { - $module = $this->getModule(); - $tables = $this->getTables(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $language = $this->getLanguage($moduleDirname, 'AM'); - $language_thereare = $this->getLanguage($moduleDirname, 'AM', 'THEREARE_'); - $content = $this->getHeaderFilesComments($module, $filename); - $content .= <<<EOT -include_once 'header.php'; -// Count elements\n -EOT; - $tableName = null; - if(is_array($tables)) { - foreach (array_keys($tables) as $i) - { - $tableName = $tables[$i]->getVar('table_name'); - $content .= <<<EOT -\$count_{$tableName} = \${$tableName}Handler->getCount();\n -EOT; - } - } - $content .= <<<EOT -// Template Index -\$template_main = '{$moduleDirname}_admin_index.tpl';\n -EOT; - if(is_array($tables)) { - $content .= <<<EOT -// InfoBox Statistics -\$adminMenu->addInfoBox({$language}STATISTICS); -// Info elements\n -EOT; - foreach (array_keys($tables) as $i) - { - $tableName = $tables[$i]->getVar('table_name'); - $stuTableName = $language_thereare.strtoupper($tableName); - $content .= <<<EOT -\$adminMenu->addInfoBoxLine({$language}STATISTICS, '<label>'.{$stuTableName}.'</label>', \$count_{$tableName});\n -EOT; - } - } - if($tableName == null) { - $content .= <<<EOT -\$adminMenu->addInfoBoxLine({$language}STATISTICS, '<label>No statistics</label>', 0);\n -EOT; - } - $content .= <<<EOT -// Render Index -echo \$adminMenu->addNavigation('index.php'); -echo \$adminMenu->renderIndex(); -include_once 'footer.php'; -EOT; - $this->tdmcfile->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - return $this->tdmcfile->renderFile(); - } -} \ No newline at end of file Deleted: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/menu.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/menu.php 2014-11-27 22:11:13 UTC (rev 12879) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/menu.php 2014-11-30 21:30:00 UTC (rev 12880) @@ -1,165 +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: admin_menu.php 12258 2014-01-02 09:33:29Z timgno $ - */ -defined('XOOPS_ROOT_PATH') or die('Restricted access'); - -class AdminMenu extends TDMCreateFile -{ - /* - * @public function constructor - * @param null - */ - public function __construct() { - parent::__construct(); - $this->tdmcfile = TDMCreateFile::getInstance(); - } - /* - * @static function &getInstance - * @param null - */ - public static function &getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - return $instance; - } - /* - * @public function write - * @param string $module - * @param object $table - * @param array $tables - * @param string $filename - */ - public function write($module, $table, $tables, $filename) { - $this->setModule($module); - $this->setTable($table); - $this->setTables($tables); - $this->setFileName($filename); - } - /* - * @private function getAdminMenuHeader - * @param null - */ - private function getAdminMenuHeader() { - $ret = <<<EOT -\$dirname = basename( dirname( dirname( __FILE__ ) ) ) ; -\$module_handler =& xoops_gethandler('module'); -\$xoopsModule =& XoopsModule::getByDirname(\$dirname); -\$moduleInfo =& \$module_handler->get(\$xoopsModule->getVar('mid')); -\$sysPathIcon32 = \$moduleInfo->getInfo('sysicons32');\n -EOT; - return $ret; - } - /* - * @private function getAdminMenuDashboard - * @param string $language - * @param integer $menu - */ - private function getAdminMenuDashboard($language, $menu) { - $ret = <<<EOT -\$i = 1; -\$adminmenu[\$i]['title'] = {$language}{$menu}; -\$adminmenu[\$i]['link'] = 'admin/index.php'; -\$adminmenu[\$i]['icon'] = \$sysPathIcon32.'/dashboard.png'; -\$i++;\n -EOT; - return $ret; - } - /* - * @private function getAdminMenuImagesPath - * @param array $tables - * @param integer $t - */ - private function getAdminMenuImagesPath($tables, $t) { - $fields = $this->getTableFields($tables[$t]->getVar('table_id')); - foreach (array_keys($fields) as $f) - { - $fieldElement = $fields[$f]->getVar('field_element'); - switch( $fieldElement ) { - case 11: - $ret = <<<EOT -\$adminmenu[\$i]['icon'] = 'assets/images/icons/32/{$tables[$t]->getVar('table_image')}';\n -EOT; - break; - default: - $ret = <<<EOT -\$adminmenu[\$i]['icon'] = \$sysPathIcon32.'/{$tables[$t]->getVar('table_image')}';\n -EOT; - break; - } - } - return $ret; - } - /* - * @public function render - * @param null - */ - public function render() { - $module = $this->getModule(); - $table = $this->getTable(); - $tables = $this->getTables(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $language = $this->getLanguage($moduleDirname, 'MI', 'ADMENU'); - $menu = 1; - $content = $this->getHeaderFilesComments($module, $filename); - $content .= $this->getAdminMenuHeader(); - $content .= $this->getAdminMenuDashboard($language, $menu); - foreach (array_keys($tables) as $t) - { - $tablePermissions = $tables[$t]->getVar('table_permissions'); - if ( $tables[$t]->getVar('table_admin') == 1 ) - { - $menu++; - $content .= <<<EOT -\$adminmenu[\$i]['title'] = {$language}{$menu}; -\$adminmenu[\$i]['link'] = 'admin/{$tables[$t]->getVar('table_name')}.php'; -\$adminmenu[\$i]['icon'] = 'assets/images/icons/32/{$tables[$t]->getVar('table_image')}';\n -EOT; - //$content .= $this->getAdminMenuImagesPath($tables, $t); - $content .= <<<EOT -\$i++;\n -EOT; - } - } - if (is_object($table) && $table->getVar('table_permissions') == 1) { - $menu++; - $content .= <<<EOT -\$adminmenu[\$i]['title'] = {$language}{$menu}; -\$adminmenu[\$i]['link'] = 'admin/permissions.php'; -\$adminmenu[\$i]['icon'] = \$sysPathIcon32.'/permissions.png'; -\$i++;\n -EOT; - } - $menu++; - $content .= <<<EOT -\$adminmenu[\$i]['title'] = {$language}{$menu}; -\$adminmenu[\$i]['link'] = 'admin/about.php'; -\$adminmenu[\$i]['icon'] = \$sysPathIcon32.'/about.png'; -unset( \$i ); -EOT; - unset( $menu ); - - $this->tdmcfile->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - return $this->tdmcfile->renderFile(); - } -} \ No newline at end of file Deleted: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/objects.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/objects.php 2014-11-27 22:11:13 UTC (rev 12879) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/objects.php 2014-11-30 21:30:00 UTC (rev 12880) @@ -1,246 +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: admin_objects.php 12258 2014-01-02 09:33:29Z timgno $ - */ -defined('XOOPS_ROOT_PATH') or die('Restricted access'); - -class AdminObjects -{ - /* - * @static function &getInstance - * @param null - */ - public static function &getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - return $instance; - } - /* - * @public function getSimpleSetVar - * @param string $tableName - * @param string $fieldName - */ - public function getSimpleSetVar($tableName, $fieldName) { - $ret = <<<EOT - // Set Var {$fieldName} - \${$tableName}Obj->setVar('{$fieldName}', \$_POST['{$fieldName}']);\n -EOT; - return $ret; - } - /* - * @public function getTextDateSelectSetVar - * @param string $tableName - * @param string $fieldName - */ - public function getTextDateSelectSetVar($tableName, $fieldName) { - $ret = <<<EOT - // Set Var {$fieldName} - \${$tableName}Obj->setVar('{$fieldName}', strtotime(\$_POST['{$fieldName}']));\n -EOT; - return $ret; - } - /* - * @public function getCheckBoxOrRadioYNSetVar - * @param string $tableName - * @param string $fieldName - */ - public function getCheckBoxOrRadioYNSetVar($tableName, $fieldName) { - $ret = <<<EOT - // Set Var {$fieldName} - \${$tableName}Obj->setVar('{$fieldName}', ((\$_REQUEST['{$fieldName}'] == 1) ? '1' : '0'));\n -EOT; - return $ret; - } - /* - * @public function getImageListSetVar - * @param string $moduleDirname - * @param string $tableName - * @param string $fieldName - */ - public function getImageListSetVar($moduleDirname, $tableName, $fieldName) { - $ret = <<<EOT - // Set Var {$fieldName} - include_once XOOPS_ROOT_PATH.'/class/uploader.php'; - \$uploaddir = XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32'; - \$uploader = new XoopsMediaUploader(\$uploaddir, \${$moduleDirname}->getConfig('mimetypes'), - \${$moduleDirname}->getConfig('maxsize'), null, null); - if (\$uploader->fetchMedia(\$_POST['xoops_upload_file'][0])) { - //\$uploader->setPrefix('{$fieldName}_'); - //\$uploader->fetchMedia(\$_POST['xoops_upload_file'][0]); - if (!\$uploader->upload()) { - \$errors = \$uploader->getErrors(); - redirect_header('javascript:history.go(-1)', 3, \$errors); - } else { - \${$tableName}Obj->setVar('{$fieldName}', \$uploader->getSavedFileName()); - } - } else { - \${$tableName}Obj->setVar('{$fieldName}', \$_POST['{$fieldName}']); - }\n -EOT; - return $ret; - } - /* - * @public function getUploadImageSetVar - * @param string $moduleDirname - * @param string $tableName - * @param string $fieldName - */ - public function getUploadImageSetVar($moduleDirname, $tableName, $fieldName) { - $stuModuleDirname = strtoupper($moduleDirname); - $ret = <<<EOT - // Set Var {$fieldName} - include_once XOOPS_ROOT_PATH.'/class/uploader.php'; - \$uploaddir = {$stuModuleDirname}_UPLOAD_PATH.'/images/{$tableName}'; - \$uploader = new XoopsMediaUploader(\$uploaddir, \${$moduleDirname}->getConfig('mimetypes'), - \${$moduleDirname}->getConfig('maxsize'), null, null); - if (\$uploader->fetchMedia(\$_POST['xoops_upload_file'][0])) { - //\$uploader->setPrefix('{$fieldName}_'); - //\$uploader->fetchMedia(\$_POST['xoops_upload_file'][0]); - if (!\$uploader->upload()) { - \$errors = \$uploader->getErrors(); - redirect_header('javascript:history.go(-1)', 3, \$errors); - } else { - \${$tableName}Obj->setVar('{$fieldName}', \$uploader->getSavedFileName()); - } - } else { - \${$tableName}Obj->setVar('{$fieldName}', \$_POST['{$fieldName}']); - }\n -EOT; - return $ret; - } - /* - * @public function getUploadFileSetVar - * @param string $moduleDirname - * @param string $tableName - * @param string $fieldName - */ - public function getUploadFileSetVar($moduleDirname, $tableName, $fieldName) { - $stuModuleDirname = strtoupper($moduleDirname); - $ret = <<<EOT - // Set Var {$fieldName} - include_once XOOPS_ROOT_PATH.'/class/uploader.php'; - \$uploaddir = {$stuModuleDirname}_UPLOAD_PATH.'/files/{$tableName}'; - \$uploader = new XoopsMediaUploader(\$uploaddir, \${$moduleDirname}->getConfig('mimetypes'), - \${$moduleDirname}->getConfig('maxsize'), null, null); - if (\$uploader->fetchMedia(\$_POST['xoops_upload_file'][0])) { - //\$uploader->setPrefix('{$fieldName}_') ; - //\$uploader->fetchMedia(\$_POST['xoops_upload_file'][0]); - if (!\$uploader->upload()) { - \$errors = \$uploader->getErrors(); - redirect_header('javascript:history.go(-1)', 3, \$errors); - } else { - \${$tableName}Obj->setVar('{$fieldName}', \$uploader->getSavedFileName()); - } - }\n -EOT; - return $ret; - } - /* - * @public function getSimpleGetVar - * @param string $lpFieldName - * @param string $rpFieldName - * @param string $tableName - * @param string $fieldName - */ - public function getSimpleGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { - $ret = <<<EOT -\t\t\t\t// Get Var {$fieldName} -\t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = \${$tableName}_arr[\$i]->getVar('{$fieldName}');\n -EOT; - return $ret; - } - /* - * @public function getTopicGetVar - * @param string $lpFieldName - * @param string $rpFieldName - * @param string $tableName - * @param string $tableNameTopic - * @param string $fieldNameParent - * @param string $fieldNameTopic - */ - public function getTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableNameTopic, $fieldNameParent, $fieldNameTopic) { - $ret = <<<EOT -\t\t\t\t// Get Var {$fieldNameParent} -\t\t\t\t\${$rpFieldName} =& \${$tableNameTopic}Handler->get(\${$tableName}_arr[\$i]->getVar('{$fieldNameParent}')); -\t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = \${$rpFieldName}->getVar('{$fieldNameTopic}');\n -EOT; - return $ret; - } - /* - * @public function getUploadImageGetVar - * @param string $lpFieldName - * @param string $rpFieldName - * @param string $tableName - * @param string $fieldName - */ - public function getUploadImageGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { - $ret = <<<EOT -\t\t\t\t// Get Var {$fieldName} -\t\t\t\t\${$fieldName} = \${$tableName}_arr[\$i]->getVar('{$fieldName}'); -\t\t\t\t\$upload_image = \${$fieldName} ? \${$fieldName} : 'blank.gif'; -\t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = \$upload_image;\n -EOT; - return $ret; - } - /* - * @public function getTextAreaGetVar - * @param string $lpFieldName - * @param string $rpFieldName - * @param string $tableName - * @param string $fieldName - */ - public function getTextAreaGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { - $ret = <<<EOT -\t\t\t\t// Get Var {$fieldName} -\t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = strip_tags(\${$tableName}_arr[\$i]->getVar('{$fieldName}'));\n -EOT; - return $ret; - } - /* - * @public function getSelectUserGetVar - * @param string $lpFieldName - * @param string $rpFieldName - * @param string $tableName - * @param string $fieldName - */ - public function getSelectUserGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { - $ret = <<<EOT -\t\t\t\t// Get Var {$fieldName} -\t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = XoopsUser::getUnameFromId(\${$tableName}_arr[\$i]->getVar('{$fieldName}'), 's');\n -EOT; - return $ret; - } - /* - * @public function getTextDateSelectGetVar - * @param string $lpFieldName - * @param string $rpFieldName - * @param string $tableName - * @param string $fieldName - */ - public function getTextDateSelectGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) { - $ret = <<<EOT -\t\t\t\t// Get Var {$fieldName} -\t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = formatTimeStamp(\${$tableName}_arr[\$i]->getVar('{$fieldName}'), 's');\n -EOT; - return $ret; - } -} \ No newline at end of file Deleted: 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-11-27 22:11:13 UTC (rev 12879) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/pages.php 2014-11-30 21:30:00 UTC (rev 12880) @@ -1,380 +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: pages.php 12258 2014-01-02 09:33:29Z timgno $ - */ -defined('XOOPS_ROOT_PATH') or die('Restricted access'); -require_once 'objects.php'; -class AdminPages extends TDMCreateFile -{ - /* - * @var string - */ - private $adminobjects = null; - /* - * @public function constructor - * @param null - */ - public function __construct() { - parent::__construct(); - $this->adminobjects = AdminObjects::getInstance(); - $this->tdmcfile = TDMCreateFile::getInstance(); - } - /* - * @static function &getInstance - * @param null - */ - public static function &getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - return $instance; - } - /* - * @public function write - * @param string $module - * @param string $table - */ - public function write($module, $table) { - $this->setModule($module); - $this->setTable($table); - } - /* - * @public function getAdminPagesHeader - * @param string $moduleDirname - * @param string $tableName - */ - public function getAdminPagesHeader($moduleDirname, $table, $fpif) { - - $ret = <<<EOT -include_once 'header.php'; -//It recovered the value of argument op in URL$ -\$op = XoopsRequest::getString('op', 'list'); -// Request {$fpif} -\${$fpif} = XoopsRequest::getInt('{$fpif}'); -// Switch options -switch (\$op) -{\n -EOT; - return $ret; - } - - /* - * @public function getAdminPagesList - * @param string $moduleDirname - * @param string $table - * @param string $tableFieldname - * @param string $language - * @param string $fields - * @param string $fpif - * @param string $fpmf - */ - public function getAdminPagesList($moduleDirname, $table, $tableFieldname, $language, $fields, $fpif, $fpmf) { - $stuModuleDirname = strtoupper($moduleDirname); - $tableName = $table->getVar('table_name'); - $tableAutoincrement = $table->getVar('table_autoincrement'); - $stuTableName = strtoupper($tableName); - $stuTableFieldname = strtoupper($tableFieldname); - $ret = <<<EOT - case 'list': - default: - \$start = XoopsRequest::getInt('start', 0); - \$limit = XoopsRequest::getInt('limit', \${$moduleDirname}->getConfig('adminpager')); - \$template_main = '{$moduleDirname}_admin_{$tableName}.tpl'; - \$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('{$tableName}.php')); - \$adminMenu->addItemButton({$language}ADD_{$stuTableFieldname}, '{$tableName}.php?op=new', 'add'); - \$GLOBALS['xoopsTpl']->assign('buttons', \$adminMenu->renderButton()); - \$criteria = new CriteriaCompo(); - \$criteria->setSort('{$fpif} ASC, {$fpmf}'); - \$criteria->setOrder('ASC'); - \${$tableName}_rows = \${$tableName}Handler->getCount(\$criteria); - \${$tableName}_arr = \${$tableName}Handler->getAll(\$criteria); - unset(\$criteria); - \$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_url', {$stuModuleDirname}_URL); - \$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_upload_url', {$stuModuleDirname}_UPLOAD_URL); - // Table view - if (\${$tableName}_rows > 0) - { - foreach (array_keys(\${$tableName}_arr) as \$i) - {\n -EOT; - foreach(array_keys($fields) as $f) - { - $fieldName = $fields[$f]->getVar('field_name'); - $fieldParent = $fields[$f]->getVar('field_parent'); - // Verify if table_fieldname is not empty - $lpFieldName = !empty($tableFieldname) ? substr($fieldName, 0, strpos($fieldName, '_')) : $tableName; - $rpFieldName = $this->tdmcfile->getRightString($fieldName); - // - $fieldElement = $fields[$f]->getVar('field_element'); - if( ($fields[$f]->getVar('field_admin') == 1) || ($tableAutoincrement == 1) ) { - switch($fieldElement) { - case 3: - case 4: - $ret .= $this->adminobjects->getTextAreaGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); - break; - case 8: - $ret .= $this->adminobjects->getSelectUserGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); - break; - case 11: - $ret .= $this->adminobjects->getUploadImageGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); - break; - case 13: - $ret .= $this->adminobjects->getTextDateSelectGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); - break; - default: - if( ($fieldParent == 1) && !$table->getVar('table_category') ) { - if($fieldElement > 13) { - $fieldElements = $this->tdmcreate->getHandler('fieldelements')->get($fieldElement); - $fieldElementTid = $fieldElements->getVar('fieldelement_tid'); - $fieldElementName = $fieldElements->getVar('fieldelement_name'); - $rpFieldElementName = strtolower(str_replace('Table : ', '', $fieldElementName)); - } - // - $fieldNameParent = $fieldName; - // - $criteriaFieldsTopic = new CriteriaCompo(); - $criteriaFieldsTopic->add(new Criteria('field_tid', $fieldElementTid)); - $fieldsTopic = $this->tdmcreate->getHandler('fields')->getObjects($criteriaFieldsTopic); - unset($criteriaFieldsTopic); - foreach(array_keys($fieldsTopic) as $ft) - { - if( $fieldsTopic[$ft]->getVar('field_main') == 1 ) { - $fieldNameTopic = $fieldsTopic[$ft]->getVar('field_name'); - } - } - $ret .= $this->adminobjects->getTopicGetVar($lpFieldName, $rpFieldName, $tableName, $rpFieldElementName, $fieldNameParent, $fieldNameTopic); - } else { - $ret .= $this->adminobjects->getSimpleGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName); - } - break; - } - } - } - $ret .= <<<EOT - \$GLOBALS['xoopsTpl']->append('{$tableName}_list', \${$lpFieldName}); - unset(\${$lpFieldName}); - }\n -EOT; - $ret .= <<<EOT - if ( \${$tableName}_rows > \$limit ) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - \$pagenav = new XoopsPageNav(\${$tableName}_rows, \$limit, \$start, 'start', 'op=list&limit=' . \$limit); - \$GLOBALS['xoopsTpl']->assign('pagenav', \$pagenav->renderNav(4)); - } - } else { - \$GLOBALS['xoopsTpl']->assign('error', {$language}THEREARENT_{$stuTableName}); - } - break;\n -EOT; - return $ret; - } - - /* - * @public function getAdminPagesNew - * @param string $moduleDirname - * @param string $tableName - * @param string $language - */ - public function getAdminPagesNew($moduleDirname, $tableName, $language) { - $stuTableName = strtoupper($tableName); - $ret = <<<EOT - case 'new': - \$template_main = '{$moduleDirname}_admin_{$tableName}.tpl'; - \$adminMenu->addItemButton({$language}{$stuTableName}_LIST, '{$tableName}.php', 'list'); - \$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('{$tableName}.php')); - \$GLOBALS['xoopsTpl']->assign('buttons', \$adminMenu->renderButton()); - // Get Form - \${$tableName}Obj =& \${$tableName}Handler->create(); - \$form = \${$tableName}Obj->getForm(); - \$GLOBALS['xoopsTpl']->assign('form', \$form->render()); - break;\n -EOT; - return $ret; - } - - /* - * @public function getAdminPagesSave - * @param string $moduleDirname - * @param string $tableName - * @param string $language - * @param string $fields - * @param string $fpif - * @param string $fpmf - */ - public function getAdminPagesSave($moduleDirname, $tableName, $language, $fields, $fpif, $fpmf) - { - $ret = <<<EOT - case 'save': - if ( !\$GLOBALS['xoopsSecurity']->check() ) { - redirect_header('{$tableName}.php', 3, implode(',', \$GLOBALS['xoopsSecurity']->getErrors())); - } - if (isset(\${$fpif})) { - \${$tableName}Obj =& \${$tableName}Handler->get(\${$fpif}); - } else { - \${$tableName}Obj =& \${$tableName}Handler->create(); - } - // Set Vars\n -EOT; - foreach (array_keys($fields) as $f) - { - $fieldName = $fields[$f]->getVar('field_name'); - $fieldElement = $fields[$f]->getVar('field_element'); - if($f > 0) { // If we want to hide field id - switch($fieldElement) { - case 5: - case 6: - $ret .= $this->adminobjects->getCheckBoxOrRadioYNSetVar($tableName, $fieldName); - break; - case 10: - $ret .= $this->adminobjects->getImageListSetVar($moduleDirname, $tableName, $fieldName); - break; - case 11: - $ret .= $this->adminobjects->getUploadImageSetVar($moduleDirname, $tableName, $fieldName); - break; - case 12: - $ret .= $this->adminobjects->getUploadFileSetVar($moduleDirname, $tableName, $fieldName); - break; - case 13: - $ret .= $this->adminobjects->getTextDateSelectSetVar($tableName, $fieldName); - break; - default: - $ret .= $this->adminobjects->getSimpleSetVar($tableName, $fieldName); - break; - } - } - } - - $ret .= <<<EOT - // Insert Data - if (\${$tableName}Handler->insert(\${$tableName}Obj)) { - redirect_header('{$tableName}.php?op=list', 2, {$language}FORMOK); - } - // Get Form - \$GLOBALS['xoopsTpl']->assign('error', \${$tableName}Obj->getHtmlErrors()); - \$form =& \${$tableName}Obj->getForm(); - \$GLOBALS['xoopsTpl']->assign('form', \$form->render()); - break;\n -EOT; - return $ret; - } - - /* - * @public function getAdminPagesEdit - * @param string $moduleDirname - * @param string $tableName - * @param string $tableFieldname - * @param string $language - * @param string $fpif - */ - public function getAdminPagesEdit($moduleDirname, $tableName, $tableFieldname, $language, $fpif) { - $stuTableName = strtoupper($tableName); - $stuTableFieldname = strtoupper($tableFieldname); - $ret = <<<EOT - case 'edit': - \$template_main = '{$moduleDirname}_admin_{$tableName}.tpl'; - \$adminMenu->addItemButton({$language}ADD_{$stuTableFieldname}, '{$tableName}.php?op=new', 'add'); - \$adminMenu->addItemButton({$language}{$stuTableName}_LIST, '{$tableName}.php', 'list'); - \$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('{$tableName}.php')); - \$GLOBALS['xoopsTpl']->assign('buttons', \$adminMenu->renderButton()); - // Get Form - \${$tableName}Obj = \${$tableName}Handler->get(\${$fpif}); - \$form = \${$tableName}Obj->getForm(); - \$GLOBALS['xoopsTpl']->assign('form', \$form->render()); - break;\n -EOT; - return $ret; - } - - /* - * @public function getAdminPagesDelete - * @param string $tableName - * @param string $language - */ - public function getAdminPagesDelete($tableName, $language, $fpif, $fpmf) { - - $ret = <<<EOT - case 'delete': - \${$tableName}Obj =& \${$tableName}Handler->get(\${$fpif}); - if (isset(\$_REQUEST['ok']) && \$_REQUEST['ok'] == 1) { - if ( !\$GLOBALS['xoopsSecurity']->check() ) { - redirect_header('{$tableName}.php', 3, implode(', ', \$GLOBALS['xoopsSecurity']->getErrors())); - } - if (\${$tableName}Handler->delete(\${$tableName}Obj)) { - redirect... [truncated message content] |
From: <txm...@us...> - 2014-12-06 21:54:52
|
Revision: 12888 http://sourceforge.net/p/xoops/svn/12888 Author: txmodxoops Date: 2014-12-06 21:54:48 +0000 (Sat, 06 Dec 2014) Log Message: ----------- Updated - Fixed bugs Modified Paths: -------------- 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/class/building.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fields.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/TDMCreateArchitecture.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/TDMCreateFile.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/AdminPages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/ClassFormElements.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/TemplatesAdminPages.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/blocks/TemplatesBlocks.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/TemplatesUserPages.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/include/common.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/templates/admin/tdmcreate_fields.tpl Added Paths: ----------- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/TDMCreateHelper.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/TDMCreateHtmlSmartyCodes.php Removed Paths: ------------- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/request.php Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/fields.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/fields.php 2014-12-04 21:57:19 UTC (rev 12887) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/fields.php 2014-12-06 21:54:48 UTC (rev 12888) @@ -132,10 +132,10 @@ } else { $GLOBALS['xoopsTpl']->assign('error', _AM_TDMCREATE_THEREARENT_FIELDS); } - var_dump($fieldMid); + /*var_dump($fieldMid); var_dump($fieldTid); var_dump($fieldNumb); - var_dump($fieldName); + var_dump($fieldName);*/ break; case 'new': @@ -152,10 +152,10 @@ $form = $fieldsObj->getFormNew($fieldMid, $fieldTid, $fieldNumb, $fieldName); $GLOBALS['xoopsTpl']->assign('form', $form->render()); // Test -> Will be removed - var_dump($fieldMid); + /*var_dump($fieldMid); var_dump($fieldTid); var_dump($fieldNumb); - var_dump($fieldName); + var_dump($fieldName); */ break; case 'save': @@ -242,7 +242,7 @@ $form = $fieldsObj->getFormEdit($fieldMid, $fieldTid); $GLOBALS['xoopsTpl']->assign('form', $form->render()); // Test -> Will be removed - var_dump($fieldTid); + //var_dump($fieldTid); break; case 'drag': @@ -273,7 +273,23 @@ unset($i); } exit; - break; + break; + + case 'delete': + $tablesObj =& $tdmcreate->getHandler('tables')->get($fieldTid); + if (isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1) { + if ( !$GLOBALS['xoopsSecurity']->check() ) { + redirect_header('fields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + } + if ($tdmcreate->getHandler('tables')->delete($tablesObj)) { + redirect_header('fields.php', 3, _AM_TDMCREATE_FORMDELOK); + } else { + echo $tablesObj->getHtmlErrors(); + } + } else { + xoops_confirm(array('ok' => 1, 'field_tid' => $fieldTid, 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_TDMCREATE_FORMSUREDEL, $tablesObj->getVar('table_name'))); + } + break; case 'display': // Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/header.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/header.php 2014-12-04 21:57:19 UTC (rev 12887) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/header.php 2014-12-06 21:54:48 UTC (rev 12888) @@ -30,7 +30,7 @@ $modPathIcon32 = $GLOBALS['xoopsModule']->getInfo('modicons32'); $pathModuleAdmin = $GLOBALS['xoopsModule']->getInfo('dirmoduleadmin'); // TDMCreate Instance -$tdmcreate = TDMCreate::getInstance(); +$tdmcreate = TDMCreateHelper::getInstance(); // MyTextSanitizer $myts =& MyTextSanitizer::getInstance(); if (!isset($xoopsTpl) || !is_object($xoopsTpl)) { Added: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/TDMCreateHelper.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/TDMCreateHelper.php (rev 0) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/TDMCreateHelper.php 2014-12-06 21:54:48 UTC (rev 12888) @@ -0,0 +1,173 @@ +<?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 trabis <lus...@gm...> + * @version $Id: TDMCreateHelper.php 12258 2014-04-12 23:45:12Z timgno $ + */ +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +class TDMCreateHelper +{ + /** + * @var string + */ + private $dirname = null; + /** + * @var string + */ + private $module = null; + /** + * @var string + */ + private $handler = null; + /** + * @var string + */ + private $config = null; + /** + * @var string + */ + private $debug = null; + /** + * @var array + */ + private $debugArray = array(); + /* + * @protected function constructor class + * @param mixed $debug + */ + protected function __construct($debug) + { + $this->debug = $debug; + $this->dirname = basename(dirname(dirname(__FILE__))); + } + /* + * @static function &getInstance + * @param mixed $debug + */ + public static function &getInstance($debug = false) + { + static $instance = false; + if (!$instance) { + $instance = new self($debug); + } + return $instance; + } + /* + * @static function getModule + * @param null + */ + public function &getModule() + { + if ($this->module == null) { + $this->initModule(); + } + return $this->module; + } + /* + * @static function getConfig + * @param string $name + */ + public function getConfig($name = null) + { + if ($this->config == null) { + $this->initConfig(); + } + if (!$name) { + $this->addLog("Getting all config"); + return $this->config; + } + if (!isset($this->config[$name])) { + $this->addLog("ERROR :: CONFIG '{$name}' does not exist"); + return null; + } + $this->addLog("Getting config '{$name}' : " . $this->config[$name]); + return $this->config[$name]; + } + /* + * @static function setConfig + * @param string $name + * @param mixed $value + */ + public function setConfig($name = null, $value = null) + { + if ($this->config == null) { + $this->initConfig(); + } + $this->config[$name] = $value; + $this->addLog("Setting config '{$name}' : " . $this->config[$name]); + return $this->config[$name]; + } + /* + * @static function getHandler + * @param string $name + */ + public function &getHandler($name) + { + if (!isset($this->handler[$name . '_handler'])) { + $this->initHandler($name); + } + $this->addLog("Getting handler '{$name}'"); + return $this->handler[$name . '_handler']; + } + /* + * @static function initModule + * @param null + */ + public function initModule() + { + global $xoopsModule; + if (isset($xoopsModule) && is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $this->dirname) { + $this->module = $xoopsModule; + } else { + $hModule = xoops_gethandler('module'); + $this->module = $hModule->getByDirname($this->dirname); + } + $this->addLog('INIT MODULE'); + } + /* + * @static function initConfig + * @param null + */ + public function initConfig() + { + $this->addLog('INIT CONFIG'); + $hModConfig = xoops_gethandler('config'); + $this->config = $hModConfig->getConfigsByCat(0, $this->getModule()->getVar('mid')); + } + /* + * @static function initHandler + * @param string $name + */ + public function initHandler($name) + { + $this->addLog('INIT ' . $name . ' HANDLER'); + $this->handler[$name . '_handler'] = xoops_getModuleHandler($name, $this->dirname); + } + /* + * @static function addLog + * @param string $log + */ + public function addLog($log) + { + if ($this->debug) { + if (is_object($GLOBALS['xoopsLogger'])) { + $GLOBALS['xoopsLogger']->addExtra($this->module->name(), $log); + } + } + } +} \ No newline at end of file Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/building.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/building.php 2014-12-04 21:57:19 UTC (rev 12887) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/building.php 2014-12-06 21:54:48 UTC (rev 12888) @@ -36,7 +36,7 @@ public function __construct() { $this->XoopsObject(); - $this->tdmcreate = TDMCreate::getInstance(); + $this->tdmcreate = TDMCreateHelper::getInstance(); } /* Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fields.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fields.php 2014-12-04 21:57:19 UTC (rev 12887) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fields.php 2014-12-06 21:54:48 UTC (rev 12888) @@ -38,7 +38,7 @@ */ public function __construct() { - $this->tdmcreate = TDMCreate::getInstance(); + $this->tdmcreate = TDMCreateHelper::getInstance(); $this->initVar('field_id', XOBJ_DTYPE_INT); $this->initVar('field_mid', XOBJ_DTYPE_INT); $this->initVar('field_tid', XOBJ_DTYPE_INT); @@ -248,16 +248,10 @@ $check_field_block->addOption(1, _AM_TDMCREATE_FIELD_BLOCK); $parameters_tray->addElement($check_field_block); - if(($i == 1)) { - $field_main = 1; + $field_main = ( $i == 1 ) ? 1 : 0; $check_field_main = new XoopsFormRadio('', 'field_main['.$i.']', $field_main); - $check_field_main->addOption($field_main, _AM_TDMCREATE_FIELD_MAINFIELD ); - } else { - $field_main = 0; - $check_field_main = new XoopsFormRadio('', 'field_main['.$i.']'); - $check_field_main->addOption($field_main, _AM_TDMCREATE_FIELD_MAINFIELD ); - } - $parameters_tray->addElement($check_field_main); + $check_field_main->addOption($i, _AM_TDMCREATE_FIELD_MAINFIELD ); + $parameters_tray->addElement($check_field_main); $field_search = 0; $check_field_search = new XoopsFormCheckBox(' ', 'field_search['.$i.']', $field_search); @@ -379,15 +373,11 @@ $check_field_block = new XoopsFormCheckBox('', 'field_block['.$field_id.']', $field->getVar('field_block')); $check_field_block->addOption(1, _AM_TDMCREATE_FIELD_BLOCK); - $parameters_tray->addElement($check_field_block); - - $field_main = $field->getVar('field_main'); - if($field_main == 1) { - $check_field_main = new XoopsFormRadio('', 'field_main['.$field_id.']', $field_main); - } else { - $check_field_main = new XoopsFormRadio('', 'field_main['.$field_id.']'); - } - $check_field_main->addOption($field_main, _AM_TDMCREATE_FIELD_MAINFIELD ); + $parameters_tray->addElement($check_field_block); + + $field_main = $field->getVar('field_main'); + $check_field_main = new XoopsFormRadio('', 'field_main['.$field_id.']', $field_main); + $check_field_main->addOption($field_id, _AM_TDMCREATE_FIELD_MAINFIELD ); $parameters_tray->addElement($check_field_main); $check_field_search = new XoopsFormCheckBox(' ', 'field_search['.$field_id.']', $field->getVar('field_search')); Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/TDMCreateArchitecture.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/TDMCreateArchitecture.php 2014-12-04 21:57:19 UTC (rev 12887) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/TDMCreateArchitecture.php 2014-12-06 21:54:48 UTC (rev 12888) @@ -36,7 +36,7 @@ * @param null */ public function __construct() { - $this->tdmcreate = TDMCreate::getInstance(); + $this->tdmcreate = TDMCreateHelper::getInstance(); $this->structure = TDMCreateStructure::getInstance(); } /* Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/TDMCreateFile.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/TDMCreateFile.php 2014-12-04 21:57:19 UTC (rev 12887) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/TDMCreateFile.php 2014-12-06 21:54:48 UTC (rev 12888) @@ -88,7 +88,7 @@ */ public function __construct() { $this->xoopsFile = XoopsFile::getHandler(); - $this->tdmcreate = TDMCreate::getInstance(); + $this->tdmcreate = TDMCreateHelper::getInstance(); } /* Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/AdminPages.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/AdminPages.php 2014-12-04 21:57:19 UTC (rev 12887) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/admin/AdminPages.php 2014-12-06 21:54:48 UTC (rev 12888) @@ -124,7 +124,7 @@ $rpFieldName = $this->tdmcfile->getRightString($fieldName); // $fieldElement = $fields[$f]->getVar('field_element'); - if( ($fields[$f]->getVar('field_admin') == 1) || ($tableAutoincrement == 1) ) { + if( ($fields[$f]->getVar('field_admin') == 1) || ($tableAutoincrement == 1) && ($fields[$f]->getVar('field_inlist') == 1) ) { switch($fieldElement) { case 3: case 4: @@ -307,6 +307,8 @@ * @public function getAdminPagesDelete * @param string $tableName * @param string $language + * @param string $fpif + * @param string $fpmf */ public function getAdminPagesDelete($tableName, $language, $fpif, $fpmf) { @@ -331,6 +333,33 @@ } /* + * @public function getAdminPagesUpdate + * @param string $moduleDirname + * @param string $tableName + * @param string $language + * @param string $fpif + * @param string $fpmf + */ + public function getAdminPagesUpdate($moduleDirname, $tableName, $language, $fpif, $fpmf) { + + $upModuleName = strtoupper($moduleDirname); + $ret = <<<EOT + case 'update': + if (isset(\${$fpif})) { + \${$tableName}Obj =& \${$tableName}Handler->get(\${$fpif}); + } + \${$tableName}Obj->setVar("\${$tableName}_display", \$_POST["\${$tableName}_display"]); + + if (\${$tableName}Handler->insert(\${$tableName}Obj)) { + redirect_header("\${$tableName}.php", 3, _AM_{$upModuleName}_FORMOK); + } + echo \${$tableName}Obj->getHtmlErrors(); + break;\n +EOT; + return $ret; + } + + /* * @public function getAdminPagesFooter * @param null */ @@ -350,7 +379,7 @@ { $module = $this->getModule(); $table = $this->getTable(); - $moduleDirname = $module->getVar('mod_dirname'); + $moduleDirname = $module->getVar('mod_dirname'); $tableName = $table->getVar('table_name'); $tableFieldname = $table->getVar('table_fieldname'); $language = $this->getLanguage($moduleDirname, 'AM'); Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/ClassFormElements.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/ClassFormElements.php 2014-12-04 21:57:19 UTC (rev 12887) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/classes/ClassFormElements.php 2014-12-06 21:54:48 UTC (rev 12888) @@ -28,7 +28,7 @@ */ public function __construct() { parent::__construct(); - $this->tdmcreate = TDMCreate::getInstance(); + $this->tdmcreate = TDMCreateHelper::getInstance(); } /* * @static function &getInstance @@ -300,9 +300,23 @@ * @param string $fields * @param string $required */ - private function getXoopsFormTopic($language, $moduleDirname, $tableName, $field_id, $field_pid, $fieldName, $field_main, $required = 'false') + private function getXoopsFormTopic($language, $moduleDirname, $table, $fields, $required = 'false') { + $tableName = $table->getVar('table_name'); $ucfTableName = ucfirst($tableName); + foreach(array_keys($fields) as $f) + { + $fieldName = $fields[$f]->getVar('field_name'); + if(($f == 0) && ($table->getVar('table_autoincrement') == 1)) { + $fieldId = $fieldName; + } + if($fields[$f]->getVar('field_parent') == 1) { + $fieldPid = $fieldName; + } + if($fields[$f]->getVar('field_main') == 1) { + $fieldMain = $fieldName; + } + } $ret = <<<EOT // Form Topic {$ucfTableName} //\${$tableName}Handler = \$this->{$moduleDirname}->getHandler('{$tableName}'); @@ -310,9 +324,9 @@ \${$tableName} = \${$tableName}Handler->getObjects( \$criteria ); if(\${$tableName}) { include_once(XOOPS_ROOT_PATH . '/class/tree.php'); - \${$tableName}_tree = new XoopsObjectTree( \${$tableName}, '{$field_id}', '{$field_pid}' ); - \${$field_pid} = \${$tableName}_tree->makeSelBox( '{$field_pid}', '{$field_main}', '--', \$this->getVar('{$field_pid}', 'e' ), true ); - \$form->addElement( new XoopsFormLabel ( {$language}, \${$field_pid} ){$required} ); + \${$tableName}_tree = new XoopsObjectTree( \${$tableName}, '{$fieldId}', '{$fieldPid}' ); + \${$fieldPid} = \${$tableName}_tree->makeSelBox( '{$fieldPid}', '{$fieldMain}', '--', \$this->getVar('{$fieldPid}', 'e' ), true ); + \$form->addElement( new XoopsFormLabel ( {$language}, \${$fieldPid} ){$required} ); }\n EOT; return $ret; @@ -399,7 +413,7 @@ } if ($fieldElement > 13) { if($table->getVar('table_category') == 1) { - $ret .= $this->getXoopsFormTopic($language, $moduleDirname, $tableName, $fieldId, $fieldPid, $fieldName, $fieldMain, $required); + $ret .= $this->getXoopsFormTopic($language, $moduleDirname, $table, $fields, $required); } else { $ret .= $this->getXoopsFormTable($language, $moduleDirname, $tableName, $fieldName, $fieldElement, $required); } Added: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/TDMCreateHtmlSmartyCodes.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/TDMCreateHtmlSmartyCodes.php (rev 0) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/TDMCreateHtmlSmartyCodes.php 2014-12-06 21:54:48 UTC (rev 12888) @@ -0,0 +1,308 @@ +<?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: htmlsmartycodes.php 12258 2014-01-02 09:33:29Z timgno $ + */ +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +class TDMCreateHtmlSmartyCodes extends TDMCreateFile +{ + /* + * @public function constructor + * @param null + */ + public function __construct() { + parent::__construct(); + } + /* + * @static function &getInstance + * @param null + */ + public static function &getInstance() + { + static $instance = false; + if (!$instance) { + $instance = new self(); + } + return $instance; + } + /* + * @public function getHtmlDiv + * @param string $class + * @param string $content + */ + public function getHtmlDiv($class = 'bnone', $content = '') { + $ret = <<<EOT + <div class='{$class}'> + {$content} + </div> +EOT; + return $ret; + } + /* + * @public function getHtmlSpan + * @param string $class + * @param string $content + */ + public function getHtmlSpan($class = 'bnone', $content = '') { + $ret = <<<EOT + <span class='{$class}'> + {$content} + </span> +EOT; + return $ret; + } + /* + * @public function getHtmlParagraph + * @param string $class + * @param string $content + */ + public function getHtmlParagraph($class = 'bnone', $content = '') { + $ret = <<<EOT + <p class='{$class}'> + {$content} + </p> +EOT; + return $ret; + } + /* + * @public function getHtmlAnchor + * @param string $class + * @param string $url + * @param string $target + * @param string $content + */ + public function getHtmlAnchor($class = 'bnone', $url = 'http://', $target = '_top', $content = '') { + $ret = <<<EOT + <a class='{$class}' href='{$url}' target='{$target}'> + {$content} + </a> +EOT; + return $ret; + } + /* + * @public function getHtmlImage + * @param string $class + * @param string $src + * @param string $alt + */ + public function getHtmlImage($class = 'bnone', $src = 'blank.gif', $alt = 'blank.gif') { + $ret = <<<EOT + <img class='{$class}' src='{$src}' alt='{$alt}' /> +EOT; + return $ret; + } + /* + * @public function getHtmlTable + * @param string $class + * @param string $content + */ + public function getHtmlTable($class = 'bnone', $content = '') { + $ret = <<<EOT + <table class='{$class}'> + {$content} + </table> +EOT; + return $ret; + } + /* + * @public function getHtmlTableThead + * @param string $class + * @param string $content + */ + public function getHtmlTableThead($class = 'bnone', $content = '') { + $ret = <<<EOT + <thead class='{$class}'> + {$content} + </thead> +EOT; + return $ret; + } + /* + * @public function getHtmlTableTbody + * @param string $class + * @param string $content + */ + public function getHtmlTableTbody($class = 'bnone', $content = '') { + $ret = <<<EOT + <tbody class='{$class}'> + {$content} + </tbody> +EOT; + return $ret; + } + /* + * @public function getHtmlTableTfoot + * @param string $class + * @param string $content + */ + public function getHtmlTableTfoot($class = 'bnone', $content = '') { + $ret = <<<EOT + <tfoot class='{$class}'> + {$content} + </tfoot> +EOT; + return $ret; + } + /* + * @public function getHtmlTableHead + * @param string $class + * @param string $content + */ + public function getHtmlTableHead($class = 'bnone', $content = '') { + $ret = <<<EOT + <th class='{$class}'>{$content}</th> +EOT; + return $ret; + } + /* + * @public function getHtmlTableRow + * @param string $class + * @param string $content + */ + public function getHtmlTableRow($class = 'bnone', $content = '') { + $ret = <<<EOT + <tr class='{$class}'> + {$content} + </tr> +EOT; + return $ret; + } + /* + * @public function getHtmlTableData + * @param string $class + * @param string $content + */ + public function getHtmlTableData($class = 'bnone', $content = '') { + $ret = <<<EOT + <td class='{$class}'>{$content}</td> +EOT; + return $ret; + } + /* + * @public function getSmartyConst + * @param string $language + * @param mixed $fieldName + */ + public function getSmartyConst($language, $fieldName) { + $ret = <<<EOT + <{\$smarty.const.{$language}{$fieldName}}> +EOT; + return $ret; + } + /* + * @public function getSmartyTableFieldNameEmptyData + * @param string $tableName + * @param string $fieldName + */ + public function getSmartyTableFieldNameEmptyData($tableName = '', $fieldName = '') { + $ret = <<<EOT + <{\${$tableName}.{$fieldName}}> +EOT; + return $ret; + } + /* + * @public function getSmartyTableField + * @param string $tableFieldname + * @param string $fieldName + */ + public function getSmartyTableFieldData($tableFieldname = '', $fieldName = '') { + $ret = <<<EOT + <{\${$tableFieldname}.{$fieldName}}> +EOT; + return $ret; + } + /* + * @public function getSmartyIncludeFile + * @param string $name + */ + public function getSmartyIncludeFile($moduleDirname, $tableName = 'header') { + $ret = <<<EOT + <{include file='db:{$moduleDirname}_{$tableName}.html'}> +EOT; + return $ret; + } + /* + * @public function getSmartyConditions + * @param string $condition + * @param string $operator + * @param string $type + * @param string $content_if + * @param mixed $content_else + */ + public function getSmartyConditions($condition = '', $operator = '==', $type = '1', $content_if = '', $content_else = false) { + if(!$content_else) { + $ret = <<<EOT + <{if ${$condition} {$operator} {$type}'}> + {$content_if} + <{/if}> +EOT; + } else { + $ret = <<<EOT + <{if ${$condition} {$operator} {$type}'}> + {$content_if} + <{else}> + {$content_else} + <{/if}> +EOT; + } + return $ret; + } + /* + * @public function getSmartyForeach + * @param string $item + * @param string $from + * @param string $content + */ + public function getSmartyForeach($item = 'item', $from = 'from', $content = 'content') { + $ret = <<<EOT + <{foreach item={$item} from=${$from}}> + {$content} + <{/foreach}> +EOT; + return $ret; + } + /* + * @public function getSmartyForeachQuery + * @param string $item + * @param string $from + * @param string $content + */ + public function getSmartyForeachQuery($item = 'item', $from = 'from', $content = 'content') { + $ret = <<<EOT + <{foreachq item={$item} from=${$from}}> + {$content} + <{/foreachq}> +EOT; + return $ret; + } + /* + * @public function getSmartySection + * @param string $name + * @param string $loop + * @param string $content + */ + public function getSmartySection($name = 'name', $loop = 'loop', $content = 'content') { + $ret = <<<EOT + <{section name={$name} loop=${$loop}}> + {$content} + <{/section}> +EOT; + return $ret; + } +} \ No newline at end of file Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/TemplatesAdminPages.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/TemplatesAdminPages.php 2014-12-04 21:57:19 UTC (rev 12887) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/admin/TemplatesAdminPages.php 2014-12-06 21:54:48 UTC (rev 12888) @@ -113,7 +113,7 @@ switch( $fieldElement ) { case 9: $ret .= <<<EOT - <td class="center"><span style="background-color: <{\$list.{$rpFieldName}}>;"> </span></td>\n + <td class="center"><span style="background-color: #<{\$list.{$rpFieldName}}>;"> </span></td>\n EOT; break; case 10: @@ -176,7 +176,7 @@ switch( $fieldElement ) { case 9: $ret .= <<<EOT - <td class="center"><span style="background-color: <{\$list.{$fieldName}}>;">\t\t</span></td>\n + <td class="center"><span style="background-color: #<{\$list.{$fieldName}}>;">\t\t</span></td>\n EOT; break; case 10: Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/blocks/TemplatesBlocks.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/blocks/TemplatesBlocks.php 2014-12-04 21:57:19 UTC (rev 12887) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/blocks/TemplatesBlocks.php 2014-12-06 21:54:48 UTC (rev 12888) @@ -102,7 +102,7 @@ switch( $fieldElement ) { case 9: $ret .= <<<EOT - <td class="center"><span style="background-color: <{\$list.{$rpFieldName}}>;">\t\t</span></td>\n + <td class="center"><span style="background-color: #<{\$list.{$rpFieldName}}>;">\t\t</span></td>\n EOT; break; case 10: @@ -156,7 +156,7 @@ switch( $fieldElement ) { case 9: $ret .= <<<EOT - <td class="center"><span style="background-color: <{\$list.{$fieldName}}>;">\t\t</span></td>\n + <td class="center"><span style="background-color: #<{\$list.{$fieldName}}>;">\t\t</span></td>\n EOT; break; case 10: Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/TemplatesUserPages.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/TemplatesUserPages.php 2014-12-04 21:57:19 UTC (rev 12887) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/templates/user/TemplatesUserPages.php 2014-12-06 21:54:48 UTC (rev 12888) @@ -107,7 +107,7 @@ switch( $fieldElement ) { case 9: $ret .= <<<EOT - <td class="center"><span style="background-color: <{\$list.{$rpFieldName}}>;">\t\t</span></td>\n + <td class="center"><span style="background-color: #<{\$list.{$rpFieldName}}>;">\t\t</span></td>\n EOT; break; case 10: @@ -159,7 +159,7 @@ switch( $fieldElement ) { case 9: $ret .= <<<EOT - <td class="center"><span style="background-color: <{\$list.{$fieldName}}>;"></span></td>\n + <td class="center"><span style="background-color: #<{\$list.{$fieldName}}>;"></span></td>\n EOT; break; case 10: Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/modules.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/modules.php 2014-12-04 21:57:19 UTC (rev 12887) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/modules.php 2014-12-06 21:54:48 UTC (rev 12888) @@ -40,7 +40,7 @@ */ public function __construct() { - $this->tdmcreate = TDMCreate::getInstance(); + $this->tdmcreate = TDMCreateHelper::getInstance(); $this->initVar('mod_id',XOBJ_DTYPE_INT); $this->initVar('mod_name',XOBJ_DTYPE_TXTBOX, $this->tdmcreate->getConfig('name')); $this->initVar('mod_dirname',XOBJ_DTYPE_TXTBOX, $this->tdmcreate->getConfig('dirname')); Deleted: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/request.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/request.php 2014-12-04 21:57:19 UTC (rev 12887) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/request.php 2014-12-06 21:54:48 UTC (rev 12888) @@ -1,960 +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. - */ -/** - * Request class - * - * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. - * @license GNU/GPL, see LICENSE.php - * Joomla! is free software. This version may have been modified pursuant - * to the GNU General Public License, and as distributed it includes or - * is derivative of works licensed under the GNU General Public License or - * other free or open source software licenses. - * See COPYRIGHT.php for copyright notices and details. - * @package TDMCreate - * @since 1.0 - * @author trabis <lus...@gm...> - * @version $Id: request.php 10374 2012-12-12 23:39:48Z trabis $ - * @version $Id: request.php 12424 2014-04-18 22:11:14Z timgno $ - */ - -/** - * Set the available masks for cleaning variables - */ -define('TDMCREATE_REQUEST_NOTRIM', 1); -define('TDMCREATE_REQUEST_ALLOWRAW', 2); -define('TDMCREATE_REQUEST_ALLOWHTML', 4); - -/** - * TDMCreateRequest Class - * This class serves to provide a common interface to access - * request variables. This includes $_POST, $_GET, and naturally $_REQUEST. Variables - * can be passed through an input filter to avoid injection or returned raw. - */ -class TDMCreateRequest -{ - - /** - * Gets the request method - * - * @return string - */ - static function getOptions() - { - $method = strtoupper($_SERVER['REQUEST_METHOD']); - return $method; - } - - /** - * Fetches and returns a given variable. - * The default behaviour is fetching variables depending on the - * current request method: GET and HEAD will result in returning - * an entry from $_GET, POST and PUT will result in returning an - * entry from $_POST. - * You can force the source by setting the $hash parameter: - * post $_POST - * get $_GET - * files $_FILES - * cookie $_COOKIE - * env $_ENV - * server $_SERVER - * method via current $_SERVER['REQUEST_METHOD'] - * default $_REQUEST - * - * @static - * - * @param string $name Variable name - * @param string $default Default value if the variable does not exist - * @param string $hash Where the var should come from (POST, GET, FILES, COOKIE, METHOD) - * @param string $type Return type for the variable, for valid values see {@link JFilterInput::clean()} - * @param int $mask Filter mask for the variable - * - * @return mixed Requested variable - */ - static function getVar($name, $default = null, $hash = 'default', $type = 'none', $mask = 0) - { - // Ensure hash and type are uppercase - $hash = strtoupper($hash); - if ($hash === 'METHOD') { - $hash = strtoupper($_SERVER['REQUEST_METHOD']); - } - $type = strtoupper($type); - // Get the input hash - switch ($hash) { - case 'GET' : - $input = & $_GET; - break; - case 'POST' : - $input = & $_POST; - break; - case 'FILES' : - $input = & $_FILES; - break; - case 'COOKIE' : - $input = & $_COOKIE; - break; - case 'ENV' : - $input = & $_ENV; - break; - case 'SERVER' : - $input = & $_SERVER; - break; - default: - $input = & $_REQUEST; - $hash = 'REQUEST'; - break; - } - if (isset($input[$name]) && $input[$name] !== null) { - // Get the variable from the input hash and clean it - $var = TDMCreateRequest::_cleanVar($input[$name], $mask, $type); - // Handle magic quotes compatability - if (get_magic_quotes_gpc() && ($var != $default) && ($hash != 'FILES')) { - $var = TDMCreateRequest::_stripSlashesRecursive($var); - } - } else if ($default !== null) { - // Clean the default value - $var = TDMCreateRequest::_cleanVar($default, $mask, $type); - } else { - $var = $default; - } - return $var; - } - - /** - * Fetches and returns a given filtered variable. The integer - * filter will allow only digits to be returned. This is currently - * only a proxy function for getVar(). - * See getVar() for more in-depth documentation on the parameters. - * - * @static - * - * @param string $name Variable name - * @param int $default Default value if the variable does not exist - * @param string $hash Where the var should come from (POST, GET, FILES, COOKIE, METHOD) - * - * @return integer Requested variable - */ - static function getInt($name, $default = 0, $hash = 'default') - { - return TDMCreateRequest::getVar($name, $default, $hash, 'int'); - } - - /** - * Fetches and returns a given filtered variable. The float - * filter only allows digits and periods. This is currently - * only a proxy function for getVar(). - * See getVar() for more in-depth documentation on the parameters. - * - * @static - * - * @param string $name Variable name - * @param float $default Default value if the variable does not exist - * @param string $hash Where the var should come from (POST, GET, FILES, COOKIE, METHOD) - * - * @return float Requested variable - */ - static function getFloat($name, $default = 0.0, $hash = 'default') - { - return TDMCreateRequest::getVar($name, $default, $hash, 'float'); - } - - /** - * Fetches and returns a given filtered variable. The bool - * filter will only return true/false bool values. This is - * currently only a proxy function for getVar(). - * See getVar() for more in-depth documentation on the parameters. - * - * @static - * - * @param string $name Variable name - * @param bool $default Default value if the variable does not exist - * @param string $hash Where the var should come from (POST, GET, FILES, COOKIE, METHOD) - * - * @return bool Requested variable - */ - static function getBool($name, $default = false, $hash = 'default') - { - return TDMCreateRequest::getVar($name, $default, $hash, 'bool'); - } - - /** - * Fetches and returns a given filtered variable. The word - * filter only allows the characters [A-Za-z_]. This is currently - * only a proxy function for getVar(). - * See getVar() for more in-depth documentation on the parameters. - * - * @static - * - * @param string $name Variable name - * @param string $default Default value if the variable does not exist - * @param string $hash Where the var should come from (POST, GET, FILES, COOKIE, METHOD) - * - * @return string Requested variable - */ - static function getWord($name, $default = '', $hash = 'default') - { - return TDMCreateRequest::getVar($name, $default, $hash, 'word'); - } - - /** - * Fetches and returns a given filtered variable. The cmd - * filter only allows the characters [A-Za-z0-9.-_]. This is - * currently only a proxy function for getVar(). - * See getVar() for more in-depth documentation on the parameters. - * - * @static - * - * @param string $name Variable name - * @param string $default Default value if the variable does not exist - * @param string $hash Where the var should come from (POST, GET, FILES, COOKIE, METHOD) - * - * @return string Requested variable - */ - static function getCmd($name, $default = '', $hash = 'default') - { - return TDMCreateRequest::getVar($name, $default, $hash, 'cmd'); - } - - /** - * Fetches and returns a given filtered variable. The string - * filter deletes 'bad' HTML code, if not overridden by the mask. - * This is currently only a proxy function for getVar(). - * See getVar() for more in-depth documentation on the parameters. - * - * @static - * - * @param string $name Variable name - * @param string $default Default value if the variable does not exist - * @param string $hash Where the var should come from (POST, GET, FILES, COOKIE, METHOD) - * @param int $mask Filter mask for the variable - * - * @return string Requested variable - */ - static function getString($name, $default = '', $hash = 'default', $mask = 0) - { - // Cast to string, in case JREQUEST_ALLOWRAW was specified for mask - return (string)TDMCreateRequest::getVar($name, $default, $hash, 'string', $mask); - } - - static function getArray($name, $default = array(), $hash = 'default') - { - return TDMCreateRequest::getVar($name, $default, $hash, 'array'); - } - - static function getText($name, $default = '', $hash = 'default') - { - return (string)TDMCreateRequest::getVar($name, $default, $hash, 'string', TDMCREATE_REQUEST_ALLOWRAW); - } - - /** - * Set a variabe in on of the request variables - * - * @access public - * - * @param string $name Name - * @param string $value Value - * @param string $hash Hash - * @param boolean $overwrite Boolean - * - * @return string Previous value - */ - static function setVar($name, $value = null, $hash = 'method', $overwrite = true) - { - //If overwrite is true, makes sure the variable hasn't been set yet - if (!$overwrite && array_key_exists($name, $_REQUEST)) { - return $_REQUEST[$name]; - } - // Get the request hash value - $hash = strtoupper($hash); - if ($hash === 'METHOD') { - $hash = strtoupper($_SERVER['REQUEST_METHOD']); - } - $previous = array_key_exists($name, $_REQUEST) ? $_REQUEST[$name] : null; - switch ($hash) { - case 'GET' : - $_GET[$name] = $value; - $_REQUEST[$name] = $value; - break; - case 'POST' : - $_POST[$name] = $value; - $_REQUEST[$name] = $value; - break; - case 'COOKIE' : - $_COOKIE[$name] = $value; - $_REQUEST[$name] = $value; - break; - case 'FILES' : - $_FILES[$name] = $value; - break; - case 'ENV' : - $_ENV['name'] = $value; - break; - case 'SERVER' : - $_SERVER['name'] = $value; - break; - } - return $previous; - } - - /** - * Fetches and returns a request array. - * The default behaviour is fetching variables depending on the - * current request method: GET and HEAD will result in returning - * $_GET, POST and PUT will result in returning $_POST. - * You can force the source by setting the $hash parameter: - * post $_POST - * get $_GET - * files $_FILES - * cookie $_COOKIE - * env $_ENV - * server $_SERVER - * method via current $_SERVER['REQUEST_METHOD'] - * default $_REQUEST - * - * @static - * - * @param string $hash to get (POST, GET, FILES, METHOD) - * @param int $mask Filter mask for the variable - * - * @return mixed Request hash - */ - static function get($hash = 'default', $mask = 0) - { - $hash = strtoupper($hash); - if ($hash === 'METHOD') { - $hash = strtoupper($_SERVER['REQUEST_METHOD']); - } - switch ($hash) { - case 'GET' : - $input = $_GET; - break; - case 'POST' : - $input = $_POST; - break; - case 'FILES' : - $input = $_FILES; - break; - case 'COOKIE' : - $input = $_COOKIE; - break; - case 'ENV' : - $input = & $_ENV; - break; - case 'SERVER' : - $input = & $_SERVER; - break; - default: - $input = $_REQUEST; - break; - } - $result = TDMCreateRequest::_cleanVar($input, $mask); - // Handle magic quotes compatability - if (get_magic_quotes_gpc() && ($hash != 'FILES')) { - $result = TDMCreateRequest::_stripSlashesRecursive($result); - } - return $result; - } - - /** - * Sets a request variable - * - * @param array $array An associative array of key-value pairs - * @param string $hash The request variable to set (POST, GET, FILES, METHOD) - * @param boolean $overwrite If true and an existing key is found, the value is overwritten, otherwise it is ingored - */ - static function set($array, $hash = 'default', $overwrite = true) - { - foreach ($array as $key => $value) { - TDMCreateRequest::setVar($key, $value, $hash, $overwrite); - } - } - - /** - * Cleans the request from script injection. - * - * @static - * @return void - */ - static function clean() - { - TDMCreateRequest::_cleanArray($_FILES); - TDMCreateRequest::_cleanArray($_ENV); - TDMCreateRequest::_cleanArray($_GET); - TDMCreateRequest::_cleanArray($_POST); - TDMCreateRequest::_cleanArray($_COOKIE); - TDMCreateRequest::_cleanArray($_SERVER); - if (isset($_SESSION)) { - TDMCreateRequest::_cleanArray($_SESSION); - } - $REQUEST = $_REQUEST; - $GET = $_GET; - $POST = $_POST; - $COOKIE = $_COOKIE; - $FILES = $_FILES; - $ENV = $_ENV; - $SERVER = $_SERVER; - if (isset ($_SESSION)) { - $SESSION = $_SESSION; - } - foreach ($GLOBALS as $key => $value) { - if ($key != 'GLOBALS') { - unset($GLOBALS[$key]); - } - } - $_REQUEST = $REQUEST; - $_GET = $GET; - $_POST = $POST; - $_COOKIE = $COOKIE; - $_FILES = $FILES; - $_ENV = $ENV; - $_SERVER = $SERVER; - if (isset($SESSION)) { - $_SESSION = $SESSION; - } - } - - /** - * Adds an array to the GLOBALS array and checks that the GLOBALS variable is not being attacked - * - * @access protected - * - * @param array $array Array to clean - * @param boolean $globalise True if the array is to be added to the GLOBALS - */ - static function _cleanArray(&$array, $globalise = false) - { - static $banned = array('_files', '_env', '_get', '_post', '_cookie', '_server', '_session', 'globals'); - foreach ($array as $key => $value) { - // PHP GLOBALS injection bug - $failed = in_array(strtolower($key), $banned); - // PHP Zend_Hash_Del_Key_Or_Index bug - $failed |= is_numeric($key); - if ($failed) { - exit('Illegal variable <strong>' . implode('</strong> or <strong>', $banned) . '</strong> passed to script.'); - } - if ($globalise) { - $GLOBALS[$key] = $value; - } - } - } - - /** - * Clean up an input variable. - * - * @param mixed $var The input variable. - * @param int $mask Filter bit mask. 1=no trim: If this flag is cleared and the - * input is a string, the string will have leading and trailing whitespace - * trimmed. 2=allow_raw: If set, no more filtering is performed, higher bits - * are ignored. 4=allow_html: HTML is allowed, but passed through a safe - * HTML filter first. If set, no more filtering is performed. If no bits - * other than the 1 bit is set, a strict filter is applied. - * @param string $type The variable type {@see JFilterInput::clean()}. - * - * @return string - */ - static function _cleanVar($var, $mask = 0, $type = null) - { - // Static input filters for specific settings - static $noHtmlFilter = null; - static $safeHtmlFilter = null; - // If the no trim flag is not set, trim the variable - if (!($mask & 1) && is_string($var)) { - $var = trim($var); - } - // Now we handle input filtering - if ($mask & 2) { - // If the allow raw flag is set, do not modify the variable - } else if ($mask & 4) { - // If the allow html flag is set, apply a safe html filter to the variable - if (is_null($safeHtmlFilter)) { - $safeHtmlFilter = TDMCreateFilterInput::getInstance(null, null, 1, 1); - } - $var = $safeHtmlFilter->clean($var, $type); - } else { - // Since no allow flags were set, we will apply the most strict filter to the variable - if (is_null($noHtmlFilter)) { - $noHtmlFilter = TDMCreateFilterInput::getInstance( /* $tags, $attr, $tag_method, $attr_method, $xss_auto */); - } - $var = $noHtmlFilter->clean($var, $type); - } - return $var; - } - - /** - * Strips slashes recursively on an array - * - * @access protected - * - * @param array $value Array of (nested arrays of) strings - * - * @return array|string The input array with stripshlashes applied to it - */ - protected function _stripSlashesRecursive($value) - { - $value = is_array($value) ? array_map(array('TDMCreateRequest', '_stripSlashesRecursive'), $value) : stripslashes($value); - return $value; - } -} - -/** - * TDMCreateInput is a class for filtering input from any data source - * Forked from the php input filter library by: Daniel Morris <da...@ro...> - * Original Contributors: Gianpaolo Racca, Ghislain Picard, Marco Wandschneider, Chris Tobin and Andrew Eddie. - * - * @author Louis Landry <lou...@jo...> - */ -class TDMCreateFilterInput -{ - var $tagsArray; // default = empty array - var $attrArray; // default = empty array - var $tagsMethod; // default = 0 - var $attrMethod; // default = 0 - var $xssAuto; // default = 1 - var $tagBlacklist = array('applet', 'body', 'bgsound', 'base', 'basefont', 'embed', 'frame', 'frameset', 'head', 'html', 'id', 'iframe', 'ilayer', 'layer', 'link', 'meta', 'name', 'object', 'script', 'style', 'title', 'xml'); - var $attrBlacklist = array('action', 'background', 'codebase', 'dynsrc', 'lowsrc'); // also will strip ALL event handlers - /** - * Constructor for inputFilter class. Only first parameter is required. - * - * @access protected - * - * @param array $tagsArray list of user-defined tags - * @param array $attrArray list of user-defined attributes - * @param int $tagsMethod WhiteList method = 0, BlackList method = 1 - * @param int $attrMethod WhiteList method = 0, BlackList method = 1 - * @param int $xssAuto Only auto clean essentials = 0, Allow clean blacklisted tags/attr = 1 - */ - public function __construct($tagsArray = array(), $attrArray = array(), $tagsMethod = 0, $attrMethod = 0, $xssAuto = 1) - { - // Make sure user defined arrays are in lowercase - $tagsArray = array_map('strtolower', (array)$tagsArray); - $attrArray = array_map('strtolower', (array)$attrArray); - // Assign member variables - $this->tagsArray = $tagsArray; - $this->attrArray = $attrArray; - $this->tagsMethod = $tagsMethod; - $this->attrMethod = $attrMethod; - $this->xssAuto = $xssAuto; - } - - /** - * Returns a reference to an input filter object, only creating it if it doesn't already exist. - * This method must be invoked as: - * <pre> $filter = & TDMCreateFilterInput::getInstance();</pre> - * - * @static - * - * @param array $tagsArray list of user-defined tags - * @param array $attrArray list of user-defined attributes - * @param int $tagsMethod WhiteList method = 0, BlackList method = 1 - * @param int $attrMethod WhiteList method = 0, BlackList method = 1 - * @param int $xssAuto Only auto clean essentials = 0, Allow clean blacklisted tags/attr = 1 - * - * @return object The TDMCreateFilterInput object. - * @since 1.5 - */ - public function & getInstance($tagsArray = array(), $attrArray = array(), $tagsMethod = 0, $attrMethod = 0, $xssAuto = 1) - { - static $instances; - $sig = md5(serialize(array($tagsArray, $attrArray, $tagsMethod, $attrMethod, $xssAuto))); - if (!isset ($instances)) { - $instances = array(); - } - if (empty ($instances[$sig])) { - $instances[$sig] = new TDMCreateFilterInput($tagsArray, $attrArray, $tagsMethod, $attrMethod, $xssAuto); - } - return $instances[$sig]; - } - - /** - * Method to be called by another php script. Processes for XSS and - * specified bad code. - * - * @access public - * - * @param mixed $source Input string/array-of-string to be 'cleaned' - * @param string $type Return type for the variable (INT, FLOAT, BOOLEAN, WORD, ALNUM, CMD, BASE64, STRING, ARRAY, PATH, NONE) - * - * @return mixed 'Cleaned' version of input parameter - * @static - */ - public function clean($source, $type = 'string') - { - // Handle the type constraint - switch (strtoupper($type)) { - case 'INT' : - case 'INTEGER' : - // Only use the first integer value - preg_match('/-?[0-9]+/', (string)$source, $matches); - $result = @ (int)$matches[0]; - break; - case 'FLOAT' : - case 'DOUBLE' : - // Only use the first floating point value - preg_match('/-?[0-9]+(\.[0-9]+)?/', (string)$source, $matches); - $result = @ (float)$matches[0]; - break; - case 'BOOL' : - case 'BOOLEAN' : - $result = (bool)$source; - break; - case 'WORD' : - $result = (string)preg_replace('/[^A-Z_]/i', '', $source); - break; - case 'ALNUM' : - $result = (string)preg_replace('/[^A-Z0-9]/i', '', $source); - break; - case 'CMD' : - $result = (string)preg_replace('/[^A-Z0-9_\.-]/i', '', $source); - $result = ltrim($result, '.'); - break; - case 'BASE64' : - $result = (string)preg_replace('/[^A-Z0-9\/+=]/i', '', $source); - break; - case 'STRING' : - // Check for static usage and assign $filter the proper variable - if (isset($this) && is_a($this, 'TDMCreateFilterInput')) { - $filter =& $this; - } else { - $filter = TDMCreateFilterInput::getInstance(); - } - $result = (string)$filter->_remove($filter->_decode((string)$source)); - break; - case 'ARRAY' : - $result = (array)$source; - break; - case 'PATH' : - $pattern = '/^[A-Za-z0-9_-]+[A-Za-z0-9_\.-]*([\\\\\/][A-Za-z0-9_-]+[A-Za-z0-9_\.-]*)*$/'; - preg_match($pattern, (string)$source, $matches); - $result = @ (string)$matches[0]; - break; - case 'USERNAME' : - $result = (string)preg_replace('/[\x00-\x1F\x7F<>"\'%&]/', '', $source); - break; - default : - // Check for static usage and assign $filter the proper variable - if (is_object($this) && get_class($this) == 'TDMCreateFilterInput') { - $filter =& $this; - } else { - $filter = TDMCreateFilterInput::getInstance(); - } - // Are we dealing with an array? - if (is_array($source)) { - foreach ($source as $key => $value) { - // filter element for XSS and other 'bad' code etc. - if (is_string($value)) { - $source[$key] = $filter->_remove($filter->_decode($value)); - } - } - $result = $source; - } else { - // Or a string? - if (is_string($source) && !empty ($source)) { - // filter source for XSS and other 'bad' code etc. - $result = $filter->_remove($filter->_decode($source)); - } else { - // Not an array or string.. return the passed parameter - $result = $source; - } - } - break; - } - return $result; - } - - /** - * Function to determine if contents of an attribute is safe - * - * @static - * - * @param array $attrSubSet A 2 element array for attributes name,value - * - * @return boolean True if bad code is detected - */ - public function checkAttribute($attrSubSet) - { - $attrSubSet[0] = strtolower($attrSubSet[0]); - $attrSubSet[1] = strtolower($attrSubSet[1]); - return (((strpos($attrSubSet[1], 'expression') !== false) && ($attrSubSet[0]) == 'style') || (strpos($attrSubSet[1], 'javascript:') !== false) || (strpos($attrSubSet[1], 'behaviour:') !== false) || (strpos($attrSubSet[1], 'vbscript:') !== false) || (strpos($attrSubSet[1], 'mocha:') !== false) || (strpos($attrSubSet[1], 'livescript:') !== false)); - } - - /** - * Internal method to iteratively remove all unwanted tags and attributes - * - * @access protected - * - * @param string $source Input string to be 'cleaned' - * - * @return string 'Cleaned' version of input parameter - */ - protected function _remove($source) - { - $loopCounter = 0; - // Iteration provides nested tag protection - while ($source != $this->_cleanTags($source)) { - $source = $this->_cleanTags($source); - $loopCounter++; - } - retur... [truncated message content] |
From: <txm...@us...> - 2015-01-24 14:14:39
|
Revision: 12947 http://sourceforge.net/p/xoops/svn/12947 Author: txmodxoops Date: 2015-01-24 14:14:37 +0000 (Sat, 24 Jan 2015) Log Message: ----------- Updated - Fixed bugs Modified Paths: -------------- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/fields.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/assets/css/admin/style.css XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/assets/js/fields.js XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fields.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/IncludeFunctions.php XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/sql/mysql.sql XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/templates/admin/tdmcreate_fields.tpl XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/xoops_version.php Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/fields.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/fields.php 2015-01-24 14:10:57 UTC (rev 12946) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/admin/fields.php 2015-01-24 14:14:37 UTC (rev 12947) @@ -22,15 +22,11 @@ // Recovered value of arguments op in the URL $ $op = XoopsRequest::getString('op', 'list'); // Get fields Variables -/*$fieldMid = TDMCreate_CleanVars($_REQUEST, 'field_mid'); -$fieldTid = TDMCreate_CleanVars($_REQUEST, 'field_tid'); -$fieldNumb = TDMCreate_CleanVars($_REQUEST, 'field_numb'); -$fieldName = TDMCreate_CleanVars($_REQUEST, 'field_name', '', 'string');*/ $fieldMid = XoopsRequest::getInt('field_mid'); $fieldTid = XoopsRequest::getInt('field_tid'); $fieldNumb = XoopsRequest::getInt('field_numb'); $fieldName = XoopsRequest::getString('field_name'); /**/ -// +// switch op switch ($op) { case 'list': @@ -51,7 +47,6 @@ $GLOBALS['xoopsTpl']->assign('tdmc_upload_imgtab_url', TDMC_UPLOAD_IMGTAB_URL); $GLOBALS['xoopsTpl']->assign('modPathIcon16', $modPathIcon16); $GLOBALS['xoopsTpl']->assign('sysPathIcon32', $sysPathIcon32); - //var_dump($sysPathIcon32); // Redirect if there aren't modules $countModules = $tdmcreate->getHandler('modules')->getCount(); if ( $countModules == 0 ) { @@ -104,6 +99,7 @@ { $field['id'] = $fid; $field['lid'] = $lid; + $field['order'] = $fieldsAll[$fid]->getVar('field_order'); $field['name'] = str_replace('_', ' ', ucfirst($fieldsAll[$fid]->getVar('field_name'))); $field['parent'] = $fieldsAll[$fid]->getVar('field_parent'); $field['inlist'] = $fieldsAll[$fid]->getVar('field_inlist'); @@ -124,6 +120,7 @@ $GLOBALS['xoopsTpl']->append('tables_list', $table); unset($table); } + unset($fields); if ( $countTables > $limit ) { include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; $pagenav = new XoopsPageNav($countTables, $limit, $start, 'start', 'op=list&limit=' . $limit); @@ -131,11 +128,7 @@ } } else { $GLOBALS['xoopsTpl']->assign('error', _AM_TDMCREATE_THEREARENT_FIELDS); - } - /*var_dump($fieldMid); - var_dump($fieldTid); - var_dump($fieldNumb); - var_dump($fieldName);*/ + } break; case 'new': @@ -150,12 +143,7 @@ // Form Add $fieldsObj =& $tdmcreate->getHandler('fields')->create(); $form = $fieldsObj->getFormNew($fieldMid, $fieldTid, $fieldNumb, $fieldName); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - // Test -> Will be removed - /*var_dump($fieldMid); - var_dump($fieldTid); - var_dump($fieldNumb); - var_dump($fieldName); */ + $GLOBALS['xoopsTpl']->assign('form', $form->render()); break; case 'save': @@ -165,23 +153,22 @@ } $fieldId = XoopsRequest::getInt('field_id'); // Fields Handler - $fields = $tdmcreate->getHandler('fields'); + $fields = $tdmcreate->getHandler('fields'); + $orderId = 1; // Set Variables foreach($_POST['field_id'] as $key => $value) { - switch($value){ - case 'new': - $fieldsObj =& $fields->create(); - break; - default: - $fieldsObj =& $fields->get($value); - break; + if(isset($value)){ + $fieldsObj =& $fields->get($value); + } else { + $fieldsObj =& $fields->create(); } if (isset($fieldMid) && isset($fieldTid) && !empty($_POST['field_name'][$key])) { // Set Data $fieldsObj->setVar( 'field_mid', $fieldMid ); $fieldsObj->setVar( 'field_tid', $fieldTid ); $fieldsObj->setVar( 'field_numb', $fieldNumb ); + $fieldsObj->setVar( 'field_order', (isset($_POST['field_order'][$key]) ? $_POST['field_order'][$key] : $orderId) ); $fieldsObj->setVar( 'field_name', (isset($_POST['field_name'][$key]) ? $_POST['field_name'][$key] : '') ); $fieldsObj->setVar( 'field_type', (isset($_POST['field_type'][$key]) ? $_POST['field_type'][$key] : '') ); $fieldsObj->setVar( 'field_value', (isset($_POST['field_value'][$key]) ? $_POST['field_value'][$key] : '') ); @@ -202,7 +189,9 @@ // Insert Data $tdmcreate->getHandler('fields')->insert($fieldsObj); } + $orderId++; } + unset($orderId); // Get table name from field table id $tables =& $tdmcreate->getHandler('tables')->get($fieldTid); $table_name = $tables->getVar('table_name'); @@ -240,39 +229,19 @@ $fieldId = XoopsRequest::getInt('field_id'); $fieldsObj = $tdmcreate->getHandler('fields')->get( $fieldId ); $form = $fieldsObj->getFormEdit($fieldMid, $fieldTid); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - // Test -> Will be removed - //var_dump($fieldTid); + $GLOBALS['xoopsTpl']->assign('form', $form->render()); break; - - case 'drag': - $side = TDMCreate_CleanVars( $_POST, 'field_id', 0, 'int' ); - $fieldId = XoopsRequest::getInt('field_id'); - if ( $fieldId > 0 ) { - $fieldsObj = $tdmcreate->getHandler('fields')->get( $fieldId ); - $fieldsObj->setVar('field_id', $side); - if (!$tdmcreate->getHandler('fields')->insert( $fieldsObj )) { - redirect_header('fields.php', 5, _AM_TDMCREATE_FIELD_SIDE_ERROR); - } - } - break; - + case 'order': - if ( isset($_POST['field_id'] ) ) { - $i = 0; - foreach($_POST['field_id'] as $order) { - if( $order > 0 ) { - $fieldsObj = $tdmcreate->getHandler('fields')->get( $order ); - $fieldsObj->setVar('field_id', $i); - if (!$tdmcreate->getHandler('fields')->insert( $fieldsObj )) { - redirect_header('fields.php', 5, _AM_TDMCREATE_FIELD_ORDER_ERROR); - } - $i++; - } - } - unset($i); - } - exit; + foreach($_GET['fieldItem'] as $order => $id) { + if( $order > 0 ) { + $fieldsObj = $tdmcreate->getHandler('fields')->get( $id ); + $fieldsObj->setVar('field_order', $order); + if (!$tdmcreate->getHandler('fields')->insert( $fieldsObj )) { + redirect_header('fields.php', 5, _AM_TDMCREATE_FIELD_ORDER_ERROR); + } + } + } break; case 'delete': Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/assets/css/admin/style.css =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/assets/css/admin/style.css 2015-01-24 14:10:57 UTC (rev 12946) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/assets/css/admin/style.css 2015-01-24 14:14:37 UTC (rev 12947) @@ -116,4 +116,37 @@ border: 1px dotted black; margin: 0 0.1em 1em 0; height: 50px; +} + +#info { + display: block; + padding: 10px; + margin-bottom: 20px; + border: 1px solid #333; + background-color: #efefef; +} + +.field-list tr { margin: 0; padding: 0; /*list-style: none;*/ } + +.field-list tr td { display: block; } + +.field-list tr td { + padding: 5px 2px; + margin-bottom: 3px; + background-color: #efefef; + background-image: -moz-linear-gradient(top, #efefef, #e1e1e1); + background-image: -webkit-gradient(linear, left top,left bottom, from(#efefef), to(#e1e1e1)); + background-image: linear-gradient(top, #efefef, #e1e1e1); + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, StartColorStr=#efefef, EndColorStr=#e1e1e1); /* vale solo per IE */ + text-shadow:1px 1px 0 #fff; + color:#ff8400; +} + +.field-list tr td img.move { + margin-right: 20px; + cursor: move; + vertical-align: middle; +} +.field-list tr td strong { + vertical-align: middle; } \ No newline at end of file Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/assets/js/fields.js =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/assets/js/fields.js 2015-01-24 14:10:57 UTC (rev 12946) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/assets/js/fields.js 2015-01-24 14:14:37 UTC (rev 12947) @@ -1,5 +1,5 @@ // Jquery function for side fields -$(document).ready( function() { +/*$(document).ready( function() { // Controls Drag & Drop $('tbody tr.sortable td:nth-child(1) img').sortable({ update: function(event, ui) { @@ -29,4 +29,14 @@ icon.closest( ".portlet" ).find( ".portlet-content" ).toggle(); }); } -); +);*/ +// Quando la pagina è caricata definisci l'ordine attuale e gli elementi da riordinare +$(document).ready(function() { + $('.field-list').sortable({ //definisco il contenitore di elementi da riordinare + handle : '.move', //definisco con la classe .move quali sono gli elementi trascinabili + update : function () { //aggiorno l'ordine ed eseguo una callback + var order = $('.field-list').sortable('serialize'); // salvo una variabile che contiene l'array con il nuovo ordine degli elementi + $("#info").load("modules/tdmcreate/admin/fields.php?"+order); + } + }); +}); Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fields.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fields.php 2015-01-24 14:10:57 UTC (rev 12946) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/fields.php 2015-01-24 14:14:37 UTC (rev 12947) @@ -20,6 +20,7 @@ */ defined('XOOPS_ROOT_PATH') or die('Restricted access'); require_once 'html/TDMCreateFormLabel.php'; +require_once 'form/TDMCreateFormRadio.php'; require_once 'form/TDMCreateThemeForm.php'; /* * @Class TDMCreateFields @@ -42,7 +43,8 @@ $this->initVar('field_id', XOBJ_DTYPE_INT); $this->initVar('field_mid', XOBJ_DTYPE_INT); $this->initVar('field_tid', XOBJ_DTYPE_INT); - $this->initVar('field_numb', XOBJ_DTYPE_INT); + $this->initVar('field_numb', XOBJ_DTYPE_INT); + $this->initVar('field_order', XOBJ_DTYPE_INT); $this->initVar('field_name', XOBJ_DTYPE_TXTBOX); $this->initVar('field_type', XOBJ_DTYPE_TXTBOX); $this->initVar('field_value', XOBJ_DTYPE_TXTBOX); @@ -146,13 +148,14 @@ $class = ($class == 'even') ? 'odd' : 'even'; // Replaced creation of new line by new function - goffy $this->getFormNewLine($form, $class, $i, $field_mid, $field_tid, $f_name, $table_autoincrement); + //var_dump($i); } // Footer form return $fields_form->getFooterForm($form); } /* - * @public function getFormNewLine + * @private function getFormNewLine * * @param mixed $form * @param mixed $class @@ -164,9 +167,9 @@ * * @author timgno - modified in getFormNewLine by goffy */ - public function getFormNewLine($form, $class, $i, $field_mid, $field_tid, $f_name, $table_autoincrement) + private function getFormNewLine($form, $class, $i, $field_mid, $field_tid, $f_name, $table_autoincrement) { - $form->addElement(new XoopsFormHidden('field_id['.$i.']', 'new')); + $form->addElement(new XoopsFormHidden('field_id['.$i.']', 0)); $form->addElement(new XoopsFormHidden('field_mid', $field_mid)); $form->addElement(new XoopsFormHidden('field_tid', $field_tid)); @@ -246,11 +249,11 @@ $field_block = 0; $check_field_block = new XoopsFormCheckBox('', 'field_block['.$i.']', $field_block); $check_field_block->addOption(1, _AM_TDMCREATE_FIELD_BLOCK); - $parameters_tray->addElement($check_field_block); - - $field_main = ( $i == 1 ) ? 1 : 0; - $check_field_main = new XoopsFormRadio('', 'field_main['.$i.']', $field_main); - $check_field_main->addOption($i, _AM_TDMCREATE_FIELD_MAINFIELD ); + $parameters_tray->addElement($check_field_block); + + $main = ($table_autoincrement == 1) ? 2 : 1; + $check_field_main = new TDMCreateFormRadio('', 'field_main['.$i.']', $main); + $check_field_main->addOption($i, _AM_TDMCREATE_FIELD_MAINFIELD ); $parameters_tray->addElement($check_field_main); $field_search = 0; @@ -294,8 +297,9 @@ unset($criteria); $id = 1; foreach($fields as $field) { - $class = ($class == 'even') ? 'odd' : 'even'; - $field_id = $field->getVar('field_id'); + $main = $id; + $class = ($class == 'even') ? 'odd' : 'even'; + $field_id = intval($field->getVar('field_id')); if ($id>$table_nbfields) { //delete additional fields, if number of fields is reduced - goffy $fieldsObj =& $this->tdmcreate->getHandler('fields')->get( $field_id ); $this->tdmcreate->getHandler('fields')->delete($fieldsObj, true); @@ -309,28 +313,28 @@ // Index ID $form->addElement(new TDMCreateFormLabel('<td class="center">'.$id.'</td>')); // Field Name - $field_name = new XoopsFormText(_AM_TDMCREATE_FIELD_NAME, 'field_name['.$field_id.']', 15, 255, $field->getVar('field_name')); + $field_name = new XoopsFormText(_AM_TDMCREATE_FIELD_NAME, 'field_name['.$id.']', 15, 255, $field->getVar('field_name')); $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_name->render().'</td>')); // Field Type - $fieldtype_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_TYPE, 'field_type['.$field_id.']', $field->getVar('field_type')); + $fieldtype_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_TYPE, 'field_type['.$id.']', $field->getVar('field_type')); $fieldtype_select->addOptionArray($this->tdmcreate->getHandler('fieldtype')->getList()); $form->addElement(new TDMCreateFormLabel('<td class="center">'.$fieldtype_select->render().'</td>')); // Field Value - $field_value = new XoopsFormText(_AM_TDMCREATE_FIELD_VALUE, 'field_value['.$field_id.']', 5, 20, $field->getVar('field_value')); + $field_value = new XoopsFormText(_AM_TDMCREATE_FIELD_VALUE, 'field_value['.$id.']', 5, 20, $field->getVar('field_value')); $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_value->render().'</td>')); // Field Attributes - $field_attributes_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_TYPE, 'field_attribute['.$field_id.']', $field->getVar('field_attribute')); + $field_attributes_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_TYPE, 'field_attribute['.$id.']', $field->getVar('field_attribute')); $field_attributes_select->addOptionArray($this->tdmcreate->getHandler('fieldattributes')->getList()); $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_attributes_select->render().'</td>')); // Field Null - $field_null_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_NULL, 'field_null['.$field_id.']', $field->getVar('field_null')); + $field_null_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_NULL, 'field_null['.$id.']', $field->getVar('field_null')); $field_null_select->addOptionArray($this->tdmcreate->getHandler('fieldnull')->getList()); $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_null_select->render().'</td>')); // Field Default - $field_default = new XoopsFormText(_AM_TDMCREATE_FIELD_DEFAULT, 'field_default['.$field_id.']', 15, 25, $field->getVar('field_default')); + $field_default = new XoopsFormText(_AM_TDMCREATE_FIELD_DEFAULT, 'field_default['.$id.']', 15, 25, $field->getVar('field_default')); $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_default->render().'</td>')); // Field Key - $field_key_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_KEY, 'field_key['.$field_id.']', $field->getVar('field_key')); + $field_key_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_KEY, 'field_key['.$id.']', $field->getVar('field_key')); $field_key_select->addOptionArray($this->tdmcreate->getHandler('fieldkey')->getList()); $form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_key_select->render().'</td>')); // Field Void @@ -345,59 +349,63 @@ $criteria_element->add(new Criteria('fieldelement_tid', 0)); $criteria_table = new CriteriaCompo(); $criteria_table->add(new Criteria('fieldelement_mid', $field_mid)); - $field_elements_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_ELEMENT_NAME, 'field_element['.$field_id.']', $field->getVar('field_element')); + $field_elements_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_ELEMENT_NAME, 'field_element['.$id.']', $field->getVar('field_element')); $field_elements_select->addOptionArray($this->tdmcreate->getHandler('fieldelements')->getList($criteria_element)); $field_elements_select->addOptionArray($this->tdmcreate->getHandler('fieldelements')->getList($criteria_table)); unset($criteria_element); unset($criteria_table); $parameters_tray->addElement($field_elements_select); - $check_field_parent = new XoopsFormCheckBox(' ', 'field_parent['.$field_id.']', $field->getVar('field_parent')); + $check_field_parent = new XoopsFormCheckBox(' ', 'field_parent['.$id.']', $field->getVar('field_parent')); $check_field_parent->addOption(1, _AM_TDMCREATE_FIELD_PARENT ); $parameters_tray->addElement($check_field_parent); - $check_field_inlist = new XoopsFormCheckBox(' ', 'field_inlist['.$field_id.']', $field->getVar('field_inlist')); + $check_field_inlist = new XoopsFormCheckBox(' ', 'field_inlist['.$id.']', $field->getVar('field_inlist')); $check_field_inlist->addOption(1, _AM_TDMCREATE_FIELD_INLIST); $parameters_tray->addElement($check_field_inlist); - $check_field_inform = new XoopsFormCheckBox(' ', 'field_inform['.$field_id.']', $field->getVar('field_inform')); + $check_field_inform = new XoopsFormCheckBox(' ', 'field_inform['.$id.']', $field->getVar('field_inform')); $check_field_inform->addOption(1, _AM_TDMCREATE_FIELD_INFORM); $parameters_tray->addElement($check_field_inform); - $check_field_admin = new XoopsFormCheckBox(' ', 'field_admin['.$field_id.']', $field->getVar('field_admin')); + $check_field_admin = new XoopsFormCheckBox(' ', 'field_admin['.$id.']', $field->getVar('field_admin')); $check_field_admin->addOption(1, _AM_TDMCREATE_FIELD_ADMIN); $parameters_tray->addElement($check_field_admin); - $check_field_user = new XoopsFormCheckBox(' ', 'field_user['.$field_id.']', $field->getVar('field_user')); + $check_field_user = new XoopsFormCheckBox(' ', 'field_user['.$id.']', $field->getVar('field_user')); $check_field_user->addOption(1, _AM_TDMCREATE_FIELD_USER); $parameters_tray->addElement($check_field_user); - $check_field_block = new XoopsFormCheckBox('', 'field_block['.$field_id.']', $field->getVar('field_block')); + $check_field_block = new XoopsFormCheckBox('', 'field_block['.$id.']', $field->getVar('field_block')); $check_field_block->addOption(1, _AM_TDMCREATE_FIELD_BLOCK); $parameters_tray->addElement($check_field_block); - $field_main = $field->getVar('field_main'); - $check_field_main = new XoopsFormRadio('', 'field_main['.$field_id.']', $field_main); - $check_field_main->addOption($field_id, _AM_TDMCREATE_FIELD_MAINFIELD ); - $parameters_tray->addElement($check_field_main); + $field_main[$field_id] = $field->getVar('field_main'); + $main_field = ($field_main[$field_id] == 1) ? $id : 1; + $check_field_main = new TDMCreateFormRadio('', 'field_main', $main_field); + $check_field_main->addOption($main, _AM_TDMCREATE_FIELD_MAINFIELD ); + $parameters_tray->addElement($check_field_main); - $check_field_search = new XoopsFormCheckBox(' ', 'field_search['.$field_id.']', $field->getVar('field_search')); + $check_field_search = new XoopsFormCheckBox(' ', 'field_search['.$id.']', $field->getVar('field_search')); $check_field_search->addOption(1, _AM_TDMCREATE_FIELD_SEARCH); $parameters_tray->addElement($check_field_search); - $check_field_required = new XoopsFormCheckBox(' ', 'field_required['.$field_id.']', $field->getVar('field_required')); + $check_field_required = new XoopsFormCheckBox(' ', 'field_required['.$id.']', $field->getVar('field_required')); $check_field_required->addOption(1, _AM_TDMCREATE_FIELD_REQUIRED); $parameters_tray->addElement($check_field_required); $form->addElement(new TDMCreateFormLabel('<td><div class="portlet"><div class="portlet-header">'._AM_TDMCREATE_FIELD_PARAMETERS_LIST.'</div><div class="portlet-content">'.$parameters_tray->render().'</div></div></td></tr>')); } $id++; } + var_dump($main); + var_dump($id); + //var_dump($field_id); } // If you change number fields in tables, // adding missing fields or delete unnecessary fields // By goffy for ($i = $id; $i <= $table_nbfields; $i++) { $class = ($class == 'even') ? 'odd' : 'even'; - $this->getFormNewLine($form, $class, $i, $field_mid, $field_tid, $f_name, 0); + $this->getFormNewLine($form, $class, $i, $field_mid, $field_tid, $f_name, $table_autoincrement); } unset($id); // Footer form Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/IncludeFunctions.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/IncludeFunctions.php 2015-01-24 14:10:57 UTC (rev 12946) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/class/files/include/IncludeFunctions.php 2015-01-24 14:14:37 UTC (rev 12947) @@ -136,12 +136,143 @@ } else { // Compatibility for old Xoops versions \$xoopsTpl->assign('xoops_meta_description', strip_tags(\$content)); } +}\n +EOT; + return $ret; + } + + /* + * @public function getRewriteUrl + * @param string $moduleDirname + * @param string $tableName + */ + public function getRewriteUrl($moduleDirname, $tableName) { + $ucfModuleDirname = ucfirst($moduleDirname); + $ret = <<<EOT +\n/** + * Rewrite all url + * + * @String $module module name + * @String $array array + * @return $type string replacement for any blank case + */ +function {$moduleDirname}_RewriteUrl(\$module, \$array, \$type = 'content') +{ + \$comment = ''; + \${$moduleDirname} = {$ucfModuleDirname}Helper::getInstance(); + \${$tableName} = \${$moduleDirname}->getHandler('{$tableName}'); + \$lenght_id = \${$moduleDirname}->getConfig('lenght_id'); + \$rewrite_url = \${$moduleDirname}->getConfig('rewrite_url'); + + if (\$lenght_id != 0) { + \$id = \$array['content_id']; + while (strlen($id) < \$lenght_id) + \$id = "0" . $id; + } else { + \$id = \$array['content_id']; + } + + if (isset(\$array['topic_alias']) && \$array['topic_alias']) { + \$topic_name = \$array['topic_alias']; + } else { + \$topic_name = {$moduleDirname}_Filter(xoops_getModuleOption('static_name', \$module)); + } + + switch (\$rewrite_url) { + + case 'none': + if(\$topic_name) { + \$topic_name = 'topic=' . \$topic_name . '&'; + } + \$rewrite_base = '/modules/'; + \$page = 'page=' . \$array['content_alias']; + return XOOPS_URL . \$rewrite_base . \$module . '/' . \$type . '.php?' . \$topic_name . 'id=' . \$id . '&' . \$page . \$comment; + break; + + case 'rewrite': + if(\$topic_name) { + \$topic_name = \$topic_name . '/'; + } + \$rewrite_base = xoops_getModuleOption('rewrite_mode', \$module); + \$rewrite_ext = xoops_getModuleOption('rewrite_ext', \$module); + \$module_name = ''; + if(xoops_getModuleOption('rewrite_name', \$module)) { + \$module_name = xoops_getModuleOption('rewrite_name', \$module) . '/'; + } + \$page = \$array['content_alias']; + \$type = \$type . '/'; + \$id = \$id . '/'; + if (\$type == 'content/') \$type = ''; + + if (\$type == 'comment-edit/' || \$type == 'comment-reply/' || \$type == 'comment-delete/') { + return XOOPS_URL . \$rewrite_base . \$module_name . \$type . \$id . '/'; + } + + return XOOPS_URL . \$rewrite_base . \$module_name . \$type . \$topic_name . \$id . \$page . \$rewrite_ext; + break; + + case 'short': + if(\$topic_name) { + \$topic_name = \$topic_name . '/'; + } + \$rewrite_base = xoops_getModuleOption('rewrite_mode', \$module); + \$rewrite_ext = xoops_getModuleOption('rewrite_ext', \$module); + \$module_name = ''; + if(xoops_getModuleOption('rewrite_name', \$module)) { + \$module_name = xoops_getModuleOption('rewrite_name', \$module) . '/'; + } + \$page = \$array['content_alias']; + \$type = \$type . '/'; + if (\$type == 'content/') \$type = ''; + + if (\$type == 'comment-edit/' || \$type == 'comment-reply/' || \$type == 'comment-delete/') { + return XOOPS_URL . \$rewrite_base . \$module_name . \$type . \$id . '/'; + } + + return XOOPS_URL . \$rewrite_base . \$module_name . \$type . \$topic_name . \$page . \$rewrite_ext; + break; + } } EOT; return $ret; } /* + * @public function getRewriteFilter + * @param string $moduleDirname + * @param string $tableName + */ + public function getRewriteFilter($moduleDirname, $tableName) { + $ucfModuleDirname = ucfirst($moduleDirname); + $ret = <<<EOT +\n/** + * Replace all escape, character, ... for display a correct url + * + * @String $url string to transform + * @String $type string replacement for any blank case + * @return $url + */ +function {$moduleDirname}_Filter(\$url, \$type = '', \$module = '{$moduleDirname}') { + + // Get regular expression from module setting. default setting is : `[^a-z0-9]`i + \${$moduleDirname} = {$ucfModuleDirname}Helper::getInstance(); + \${$tableName} = \${$moduleDirname}->getHandler('{$tableName}'); + \$regular_expression = \${$moduleDirname}->getConfig('regular_expression'); + + \$url = strip_tags(\$url); + \$url = preg_replace("`\[.*\]`U", "", \$url); + \$url = preg_replace('`&(amp;)?#?[a-z0-9]+;`i', '-', \$url); + \$url = htmlentities($url, ENT_COMPAT, 'utf-8'); + \$url = preg_replace("`&([a-z])(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig);`i", "\\1", \$url); + \$url = preg_replace(array($regular_expression, "`[-]+`"), "-", \$url); + \$url = (\$url == "") ? \$type : strtolower(trim(\$url, '-')); + return \$url; +} +EOT; + return $ret; + } + + /* * @public function render * @param null */ Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/sql/mysql.sql =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/sql/mysql.sql 2015-01-24 14:10:57 UTC (rev 12946) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/sql/mysql.sql 2015-01-24 14:14:37 UTC (rev 12947) @@ -91,6 +91,7 @@ `field_mid` INT(5) UNSIGNED NOT NULL DEFAULT '0', `field_tid` INT(5) UNSIGNED NOT NULL DEFAULT '0', `field_numb` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `field_order` INT(10) UNSIGNED NOT NULL DEFAULT '0', `field_name` VARCHAR(255) NOT NULL DEFAULT '', `field_type` VARCHAR(100) NOT NULL DEFAULT '', `field_value` CHAR(4) NOT NULL DEFAULT '', Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/templates/admin/tdmcreate_fields.tpl =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/templates/admin/tdmcreate_fields.tpl 2015-01-24 14:10:57 UTC (rev 12946) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/templates/admin/tdmcreate_fields.tpl 2015-01-24 14:14:37 UTC (rev 12947) @@ -54,37 +54,10 @@ <img src="<{xoModuleIcons16 delete.png}>" alt="<{$smarty.const._DELETE}>" /> </a> </td> - </tr> - <{foreach item=field from=$table.fields}> - <{if $field.id > 0}> - <tr class="<{cycle values='even,odd'}> sortable toggleChild"> - <td class='center'>[<{$field.lid}>] <img class="move" src="<{$modPathIcon16}>/drag.png" alt="<{$field.name}>" /></td> - <td class='center'><{$field.name}></td> - <td class='center'><img src="<{$modPathIcon16}>/tables.png" alt="Empty" /></td> - <td class='center'><img src="<{$modPathIcon16}>/tables.png" alt="Empty" /></td> - <td class='center'><img id="loading_img_parent<{$field.id}>" src="<{$modPathIcon16}>/spinner.gif" style="display:none;" title="<{$smarty.const._AM_SYSTEM_LOADING}>" alt="<{$smarty.const._AM_SYSTEM_LOADING}>" /><img style="cursor:pointer;" class="tooltip" id="img_parent<{$field.id}>" onclick="tdmcreate_setStatus( { op: 'display', field_id: <{$field.id}>, field_parent: <{if $field.parent}>0<{else}>1<{/if}> }, 'img_parent<{$field.id}>', 'fields.php' )" src="<{xoModuleIcons16}><{$field.parent}>.png" alt="<{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}>" title="<{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}>" /> - </td> - <td class='center'><img id="loading_img_inlist<{$field.id}>" src="<{$modPathIcon16}>/spinner.gif" style="display:none;" title="<{$smarty.const._AM_SYSTEM_LOADING}>" alt="<{$smarty.const._AM_SYSTEM_LOADING}>" /><img style="cursor:pointer;" class="tooltip" id="img_inlist<{$field.id}>" onclick="tdmcreate_setStatus( { op: 'display', field_id: <{$field.id}>, field_inlist: <{if $field.inlist}>0<{else}>1<{/if}> }, 'img_inlist<{$field.id}>', 'fields.php' )" src="<{xoModuleIcons16}><{$field.inlist}>.png" alt="<{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}>" title="<{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}>" /> - </td> - <td class='center'><img id="loading_img_inform<{$field.id}>" src="<{$modPathIcon16}>/spinner.gif" style="display:none;" title="<{$smarty.const._AM_SYSTEM_LOADING}>" alt="<{$smarty.const._AM_SYSTEM_LOADING}>" /><img style="cursor:pointer;" class="tooltip" id="img_inform<{$field.id}>" onclick="tdmcreate_setStatus( { op: 'display', field_id: <{$field.id}>, field_inform: <{if $field.inform}>0<{else}>1<{/if}> }, 'img_inform<{$field.id}>', 'fields.php' )" src="<{xoModuleIcons16}><{$field.inform}>.png" alt="<{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}>" title="<{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}>" /> - </td> - <td class='center'><img id="loading_img_admin<{$field.id}>" src="<{$modPathIcon16}>/spinner.gif" style="display:none;" title="<{$smarty.const._AM_SYSTEM_LOADING}>" alt="<{$smarty.const._AM_SYSTEM_LOADING}>" /><img style="cursor:pointer;" class="tooltip" id="img_admin<{$field.id}>" onclick="tdmcreate_setStatus( { op: 'display', field_id: <{$field.id}>, field_admin: <{if $field.admin}>0<{else}>1<{/if}> }, 'img_admin<{$field.id}>', 'fields.php' )" src="<{xoModuleIcons16}><{$field.admin}>.png" alt="<{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}>" title="<{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}>" /> - </td> - <td class='center'><img id="loading_img_user<{$field.id}>" src="<{$modPathIcon16}>/spinner.gif" style="display:none;" title="<{$smarty.const._AM_SYSTEM_LOADING}>" alt="<{$smarty.const._AM_SYSTEM_LOADING}>" /><img style="cursor:pointer;" class="tooltip" id="img_user<{$field.id}>" onclick="tdmcreate_setStatus( { op: 'display', field_id: <{$field.id}>, field_user: <{if $field.user}>0<{else}>1<{/if}> }, 'img_user<{$field.id}>', 'fields.php' )" src="<{xoModuleIcons16}><{$field.user}>.png" alt="<{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}>" title="<{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}>" /> - </td> - <td class='center'><img id="loading_img_block<{$field.id}>" src="<{$modPathIcon16}>/spinner.gif" style="display:none;" title="<{$smarty.const._AM_SYSTEM_LOADING}>" alt="<{$smarty.const._AM_SYSTEM_LOADING}>" /><img style="cursor:pointer;" class="tooltip" id="img_block<{$field.id}>" onclick="tdmcreate_setStatus( { op: 'display', field_id: <{$field.id}>, field_block: <{if $field.block}>0<{else}>1<{/if}> }, 'img_block<{$field.id}>', 'fields.php' )" src="<{xoModuleIcons16}><{$field.block}>.png" alt="<{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}>" title="<{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}>" /> - </td> - <td class='center'><img id="loading_img_main<{$field.id}>" src="<{$modPathIcon16}>/spinner.gif" style="display:none;" title="<{$smarty.const._AM_SYSTEM_LOADING}>" alt="<{$smarty.const._AM_SYSTEM_LOADING}>" /><img style="cursor:pointer;" class="tooltip" id="img_main<{$field.id}>" onclick="tdmcreate_setStatus( { op: 'display', field_id: <{$field.id}>, field_main: <{if $field.main}>0<{else}>1<{/if}> }, 'img_main<{$field.id}>', 'fields.php' )" src="<{xoModuleIcons16}><{$field.main}>.png" alt="<{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}>" title="<{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}>" /> - </td> - <td class='center'><img id="loading_img_search<{$field.id}>" src="<{$modPathIcon16}>/spinner.gif" style="display:none;" title="<{$smarty.const._AM_SYSTEM_LOADING}>" alt="<{$smarty.const._AM_SYSTEM_LOADING}>" /><img style="cursor:pointer;" class="tooltip" id="img_search<{$field.id}>" onclick="tdmcreate_setStatus( { op: 'display', field_id: <{$field.id}>, field_search: <{if $field.search}>0<{else}>1<{/if}> }, 'img_search<{$field.id}>', 'fields.php' )" src="<{xoModuleIcons16}><{$field.search}>.png" alt="<{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}>" title="<{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}>" /> - </td> - <td class='center'> - <img id="loading_img_required<{$field.id}>" src="<{$modPathIcon16}>/spinner.gif" style="display:none;" title="<{$smarty.const._AM_SYSTEM_LOADING}>" alt="<{$smarty.const._AM_SYSTEM_LOADING}>" /><img style="cursor:pointer;" class="tooltip" id="img_required<{$field.id}>" onclick="tdmcreate_setStatus( { op: 'display', field_id: <{$field.id}>, field_required: <{if $field.required}>0<{else}>1<{/if}> }, 'img_required<{$field.id}>', 'fields.php' )" src="<{xoModuleIcons16}><{$field.required}>.png" alt="<{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}>" title="<{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}>" /> - </td> - <td class='center'><img src="<{$modPathIcon16}>/left_right.png" alt="Empty" /></td> - </tr> - <{/if}> - <{/foreach}> + </tr> + <tr class="toggleChild"> + <td id="sortable" colspan="14" class='center'><{includeq file="db:tdmcreate_fields_item.tpl" table=$table}></td> + </tr> <{/foreach}> </tbody> </table><br /><br /> Modified: XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/xoops_version.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/xoops_version.php 2015-01-24 14:10:57 UTC (rev 12946) +++ XoopsModules/TDMCreate/branches/timgno/1.91/tdmcreate/xoops_version.php 2015-01-24 14:14:37 UTC (rev 12947) @@ -71,6 +71,7 @@ $modversion['templates'][] = array( 'file' => 'tdmcreate_about.tpl', 'description' => '', 'type' => 'admin' ); $modversion['templates'][] = array( 'file' => 'tdmcreate_building.tpl', 'description' => '', 'type' => 'admin' ); $modversion['templates'][] = array( 'file' => 'tdmcreate_fields.tpl', 'description' => '', 'type' => 'admin' ); +$modversion['templates'][] = array( 'file' => 'tdmcreate_fields_item.tpl', 'description' => '', 'type' => 'admin' ); $modversion['templates'][] = array( 'file' => 'tdmcreate_footer.tpl', 'description' => '', 'type' => 'admin' ); $modversion['templates'][] = array( 'file' => 'tdmcreate_header.tpl', 'description' => '', 'type' => 'admin' ); $modversion['templates'][] = array( 'file' => 'tdmcreate_index.tpl', 'description' => '', 'type' => 'admin' ); |