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