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] |