|
From: <txm...@us...> - 2014-07-03 22:42:58
|
Revision: 12672
http://sourceforge.net/p/xoops/svn/12672
Author: txmodxoops
Date: 2014-07-03 22:42:40 +0000 (Thu, 03 Jul 2014)
Log Message:
-----------
- Fixed bugs
- Updated
- Solved issue for directory images
- Added field element ImageList
- Refactoring variables to PSR system
- Still work to do
Modified Paths:
--------------
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/fields.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/tables.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/about.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/footer.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/header.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/index.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/menu.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/objects.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/pages.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/permissions.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/architecture.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/blocks/blocks.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/classes/classes.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/classes/formelements.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/css/styles.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/docs/changelog.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/docs/docs.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/file.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include/comment_functions.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include/common.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include/functions.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include/install.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include/jquery.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include/notifications.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include/search.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/include/update.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language/admin.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language/blocks.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language/help.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language/mail.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language/main.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language/modinfo.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/sql/mysql.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/structure.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/tablefields.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/templates/admin/about.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/templates/admin/footer.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/templates/admin/header.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/templates/admin/index.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/templates/admin/pages.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/templates/admin/permissions.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/templates/blocks/blocks.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/templates/user/footer.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/templates/user/header.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/templates/user/index.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/templates/user/pages.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user/footer.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user/header.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user/index.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user/notification_update.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user/objects.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user/pages.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user/print.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user/rss.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user/submit.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user/xoopsversion.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/language/english/admin.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/sql/mysql.sql
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/templates/admin/tdmcreate_fields.tpl
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/fields.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/fields.php 2014-07-02 19:27:17 UTC (rev 12671)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/fields.php 2014-07-03 22:42:40 UTC (rev 12672)
@@ -80,11 +80,12 @@
$table['mid'] = $tables_arr[$tid]->getVar('table_mid');
$table['name'] = ucfirst($tables_arr[$tid]->getVar('table_name'));
$table['image'] = $tables_arr[$tid]->getVar('table_image');
- $table['nbfields'] = $tables_arr[$tid]->getVar('table_nbfields');
+ $table['nbfields'] = $tables_arr[$tid]->getVar('table_nbfields');
+ $table['autoincrement'] = $tables_arr[$tid]->getVar('table_autoincrement');
$table['blocks'] = $tables_arr[$tid]->getVar('table_blocks');
$table['admin'] = $tables_arr[$tid]->getVar('table_admin');
$table['user'] = $tables_arr[$tid]->getVar('table_user');
- $table['search'] = $tables_arr[$tid]->getVar('table_search');
+ $table['search'] = $tables_arr[$tid]->getVar('table_search');
// Get the list of fields
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('field_tid', $tid));
@@ -97,9 +98,9 @@
$fields = array();
$lid = 1;
if ( $nb_fields > 0 )
- {
+ {
foreach (array_keys($fields_arr) as $fid)
- {
+ {
$field['id'] = $fid;
$field['lid'] = $lid;
$field['name'] = str_replace('_', ' ', ucfirst($fields_arr[$fid]->getVar('field_name')));
@@ -114,7 +115,7 @@
$field['required'] = $fields_arr[$fid]->getVar('field_required');
$fields[] = $field;
unset($field);
- $lid++;
+ $lid++;
}
}
unset($lid);
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/tables.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/tables.php 2014-07-02 19:27:17 UTC (rev 12671)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/tables.php 2014-07-03 22:42:40 UTC (rev 12672)
@@ -188,7 +188,8 @@
} else {
$tablesObj->setVar('table_image', $_POST['table_image']);
}
- $tablesObj->setVars(array('table_blocks' => (($_REQUEST['table_blocks'] == 1) ? '1' : '0'),
+ $tablesObj->setVars(array('table_autoincrement' => (($_REQUEST['table_autoincrement'] == 1) ? '1' : '0'),
+ 'table_blocks' => (($_REQUEST['table_blocks'] == 1) ? '1' : '0'),
'table_admin' => (($_REQUEST['table_admin'] == 1) ? '1' : '0'),
'table_user' => (($_REQUEST['table_user'] == 1) ? '1' : '0'),
'table_submenu' => (($_REQUEST['table_submenu'] == 1) ? '1' : '0'),
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/about.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/about.php 2014-07-02 19:27:17 UTC (rev 12671)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/about.php 2014-07-03 22:42:40 UTC (rev 12672)
@@ -57,17 +57,17 @@
public function render() {
$module = $this->getModule();
$filename = $this->getFileName();
- $module_dirname = $module->getVar('mod_dirname');
- $module_donations = $module->getVar('mod_donations');
+ $moduleDirname = $module->getVar('mod_dirname');
+ $moduleDonations = $module->getVar('mod_donations');
$content = $this->getHeaderFilesComments($module, $filename);
$content .= <<<EOT
include 'header.php';
-\$template_main = '{$module_dirname}_admin_about.tpl';
+\$template_main = '{$moduleDirname}_admin_about.tpl';
\$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('about.php'));
-\$GLOBALS['xoopsTpl']->assign('about', \$adminMenu->renderAbout('{$module_donations}', false));
+\$GLOBALS['xoopsTpl']->assign('about', \$adminMenu->renderAbout('{$moduleDonations}', false));
include 'footer.php';
EOT;
- $this->tdmcfile->create($module_dirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
+ $this->tdmcfile->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
return $this->tdmcfile->renderFile();
}
}
\ No newline at end of file
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/footer.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/footer.php 2014-07-02 19:27:17 UTC (rev 12671)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/footer.php 2014-07-03 22:42:40 UTC (rev 12672)
@@ -58,7 +58,7 @@
public function render() {
$module = $this->getModule();
$filename = $this->getFileName();
- $module_dirname = $module->getVar('mod_dirname');
+ $moduleDirname = $module->getVar('mod_dirname');
$content = $this->getHeaderFilesComments($module, $filename);
$content .= <<<EOT
if ( isset(\$template_main) ) {
@@ -67,7 +67,7 @@
xoops_cp_footer();
?>
EOT;
- $this->tdmcfile->create($module_dirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
+ $this->tdmcfile->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
return $this->tdmcfile->renderFile();
}
}
\ No newline at end of file
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-02 19:27:17 UTC (rev 12671)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/header.php 2014-07-03 22:42:40 UTC (rev 12672)
@@ -62,8 +62,8 @@
$table = $this->getTable();
$tables = $this->getTables();
$filename = $this->getFileName();
- $module_dirname = $module->getVar('mod_dirname');
- $ucfmod_name = ucfirst($module_dirname);
+ $moduleDirname = $module->getVar('mod_dirname');
+ $ucfmod_name = ucfirst($moduleDirname);
$language = $this->getLanguage('AM');
$content = $this->getHeaderFilesComments($module, $filename);
$content .= <<<EOT
@@ -76,7 +76,7 @@
if ( $table->getVar('table_name') != '' ) {
$content .= <<<EOT
// Get instance of module
-\${$module_dirname} = {$ucfmod_name}Helper::getInstance();\n
+\${$moduleDirname} = {$ucfmod_name}Helper::getInstance();\n
EOT;
}
$content .= <<<EOT
@@ -91,9 +91,9 @@
EOT;
foreach (array_keys($tables) as $i)
{
- $table_name = $tables[$i]->getVar('table_name');
+ $tableName = $tables[$i]->getVar('table_name');
$content .= <<<EOT
-\${$table_name}Handler =& \${$module_dirname}->getHandler('{$table_name}');\n
+\${$tableName}Handler =& \${$moduleDirname}->getHandler('{$tableName}');\n
EOT;
}
$content .=<<<EOT
@@ -122,7 +122,7 @@
xoops_cp_header();
\$adminMenu = new ModuleAdmin();
EOT;
- $this->tdmcfile->create($module_dirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
+ $this->tdmcfile->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
return $this->tdmcfile->renderFile();
}
}
\ No newline at end of file
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-02 19:27:17 UTC (rev 12671)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/index.php 2014-07-03 22:42:40 UTC (rev 12672)
@@ -60,34 +60,34 @@
$module = $this->getModule();
$tables = $this->getTables();
$filename = $this->getFileName();
- $module_dirname = $module->getVar('mod_dirname');
- $language = $this->getLanguage($module_dirname, 'AM');
- $language_thereare = $this->getLanguage($module_dirname, 'AM', 'THEREARE_');
+ $moduleDirname = $module->getVar('mod_dirname');
+ $language = $this->getLanguage($moduleDirname, 'AM');
+ $language_thereare = $this->getLanguage($moduleDirname, 'AM', 'THEREARE_');
$content = $this->getHeaderFilesComments($module, $filename);
$content .= <<<EOT
include_once 'header.php';\n
EOT;
foreach (array_keys($tables) as $i)
{
- $table_name = $tables[$i]->getVar('table_name');
+ $tableName = $tables[$i]->getVar('table_name');
$content .= <<<EOT
-//count "{$table_name}"
-\$count_{$table_name} = \${$table_name}Handler->getCount();\n
+//count "{$tableName}"
+\$count_{$tableName} = \${$tableName}Handler->getCount();\n
EOT;
}
$content .= <<<EOT
// Template Index
-\$template_main = '{$module_dirname}_admin_index.tpl';
+\$template_main = '{$moduleDirname}_admin_index.tpl';
// InfoBox Statistics
\$adminMenu->addInfoBox({$language}STATISTICS);
// InfoBox\n
EOT;
foreach (array_keys($tables) as $i)
{
- $table_name = $tables[$i]->getVar('table_name');
- $ta_stutable_name = $language_thereare.strtoupper($table_name);
+ $tableName = $tables[$i]->getVar('table_name');
+ $ta_stutable_name = $language_thereare.strtoupper($tableName);
$content .= <<<EOT
-\$adminMenu->addInfoBoxLine({$language}STATISTICS, '<label>'.{$ta_stutable_name}.'</label>', \$count_{$table_name});\n
+\$adminMenu->addInfoBoxLine({$language}STATISTICS, '<label>'.{$ta_stutable_name}.'</label>', \$count_{$tableName});\n
EOT;
}
$content .= <<<EOT
@@ -96,7 +96,7 @@
echo \$adminMenu->renderIndex();
include_once 'footer.php';
EOT;
- $this->tdmcfile->create($module_dirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
+ $this->tdmcfile->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
return $this->tdmcfile->renderFile();
}
}
\ No newline at end of file
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-02 19:27:17 UTC (rev 12671)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/menu.php 2014-07-03 22:42:40 UTC (rev 12672)
@@ -60,8 +60,8 @@
$module = $this->getModule();
$tables = $this->getTables();
$filename = $this->getFileName();
- $module_dirname = $module->getVar('mod_dirname');
- $language = $this->getLanguage($module_dirname, 'MI', 'ADMENU');
+ $moduleDirname = $module->getVar('mod_dirname');
+ $language = $this->getLanguage($moduleDirname, 'MI', 'ADMENU');
$menu = 1;
$content = $this->getHeaderFilesComments($module, $filename);
$content .= <<<EOT
@@ -77,23 +77,37 @@
\$adminmenu[\$i]['icon'] = \$sysPathIcon32.'/dashboard.png';
\$i++;\n
EOT;
- foreach (array_keys($tables) as $i)
+ foreach (array_keys($tables) as $t)
{
- $table_permissions = $tables[$i]->getVar('table_permissions');
- if ( $tables[$i]->getVar('table_admin') == 1 )
+ $tablePermissions = $tables[$t]->getVar('table_permissions');
+ if ( $tables[$t]->getVar('table_admin') == 1 )
{
- $menu++;
+ $menu++;
$content .= <<<EOT
\$adminmenu[\$i]['title'] = {$language}{$menu};
-\$adminmenu[\$i]['link'] = 'admin/{$tables[$i]->getVar('table_name')}.php';
-\$adminmenu[\$i]['icon'] = \$sysPathIcon32.'/{$tables[$i]->getVar('table_image')}';
+\$adminmenu[\$i]['link'] = 'admin/{$tables[$t]->getVar('table_name')}.php';
+\$adminmenu[\$i]['icon'] = \$sysPathIcon32.'/{$tables[$t]->getVar('table_image')}';
// Local path
-//\$adminmenu[\$i]['icon'] = 'assets/images/icons/32/{$tables[$i]->getVar('table_image')}';
+EOT;
+ $fields = $this->getTableFields($tables[$t]->getVar('table_id'));
+ foreach (array_keys($fields) as $f)
+ {
+ $fieldElement = $fields[$f]->getVar('field_element');
+ if( $fieldElement == 9 ) {
+ $content .= <<<EOT
+//\$adminmenu[\$i]['icon'] = \$sysPathIcon32.'/{$tables[$t]->getVar('table_image')}';
\$i++;\n
EOT;
+ } elseif( $fieldElement == 10 ) {
+ $content .= <<<EOT
+//\$adminmenu[\$i]['icon'] = 'assets/images/icons/32/{$tables[$t]->getVar('table_image')}';
+\$i++;\n
+EOT;
+ }
+ }
}
}
- if( $table_permissions == 1 ) {
+ if( $tablePermissions == 1 ) {
$menu++;
$content .= <<<EOT
\$adminmenu[\$i]['title'] = {$language}{$menu};
@@ -111,7 +125,7 @@
EOT;
unset( $menu );
- $this->tdmcfile->create($module_dirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
+ $this->tdmcfile->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
return $this->tdmcfile->renderFile();
}
}
\ No newline at end of file
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-02 19:27:17 UTC (rev 12671)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/objects.php 2014-07-03 22:42:40 UTC (rev 12672)
@@ -36,86 +36,116 @@
}
/*
* @public function getSimpleSetVar
- * @param string $table_name
- * @param string $field_name
+ * @param string $tableName
+ * @param string $fieldName
*/
- public function getSimpleSetVar($table_name, $field_name) {
+ public function getSimpleSetVar($tableName, $fieldName) {
$ret = <<<EOT
- \${$table_name}Obj->setVar('{$field_name}', \$_POST['{$field_name}']);\n
+ \${$tableName}Obj->setVar('{$fieldName}', \$_POST['{$fieldName}']);\n
EOT;
return $ret;
}
/*
* @public function getTextDateSelect
- * @param string $table_name
- * @param string $field_name
+ * @param string $tableName
+ * @param string $fieldName
*/
- public function getTextDateSelect($table_name, $field_name) {
+ public function getTextDateSelect($tableName, $fieldName) {
$ret = <<<EOT
- \${$table_name}Obj->setVar('{$field_name}', strtotime(\$_POST['{$field_name}']));\n
+ \${$tableName}Obj->setVar('{$fieldName}', strtotime(\$_POST['{$fieldName}']));\n
EOT;
return $ret;
}
/*
* @public function getCheckBoxOrRadioYN
- * @param string $table_name
- * @param string $field_name
+ * @param string $tableName
+ * @param string $fieldName
*/
- public function getCheckBoxOrRadioYN($table_name, $field_name) {
+ public function getCheckBoxOrRadioYN($tableName, $fieldName) {
$ret = <<<EOT
- \${$table_name}Obj->setVar('{$field_name}', ((\$_REQUEST['{$field_name}'] == 1) ? '1' : '0'));\n
+ \${$tableName}Obj->setVar('{$fieldName}', ((\$_REQUEST['{$fieldName}'] == 1) ? '1' : '0'));\n
EOT;
return $ret;
}
/*
+ * @public function getImageList
+ * @param string $moduleDirname
+ * @param string $tableName
+ * @param string $fieldName
+ */
+ public function getImageList($moduleDirname, $tableName, $fieldName) {
+ $ret = <<<EOT
+ // Set Var Image
+ include_once XOOPS_ROOT_PATH.'/class/uploader.php';
+ \$uploaddir = XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32';
+ \$uploader = new XoopsMediaUploader(\$uploaddir, \${$moduleDirname}->getConfig('mimetypes'),
+ \${$moduleDirname}->getConfig('maxsize'), null, null);
+ if (\$uploader->fetchMedia(\$_POST['xoops_upload_file'][0])) {
+ //\$uploader->setPrefix('{$fieldName}_');
+ //\$uploader->fetchMedia(\$_POST['xoops_upload_file'][0]);
+ if (!\$uploader->upload()) {
+ \$errors = \$uploader->getErrors();
+ redirect_header('javascript:history.go(-1)', 3, \$errors);
+ } else {
+ \${$tableName}Obj->setVar('{$fieldName}', \$uploader->getSavedFileName());
+ }
+ } else {
+ \${$tableName}Obj->setVar('{$fieldName}', \$_POST['{$fieldName}']);
+ }\n
+EOT;
+ return $ret;
+ }
+ /*
* @public function getUploadImage
- * @param string $module_dirname
- * @param string $table_name
- * @param string $field_name
+ * @param string $moduleDirname
+ * @param string $tableName
+ * @param string $fieldName
*/
- public function getUploadImage($module_dirname, $table_name, $field_name) {
+ public function getUploadImage($moduleDirname, $tableName, $fieldName) {
+ $stuModuleDirname = strtolower($moduleDirname);
$ret = <<<EOT
// Set Var Image
include_once XOOPS_ROOT_PATH.'/class/uploader.php';
- \$uploaddir = XOOPS_UPLOAD_PATH.'/{$module_dirname}/images/{$table_name}/';
- \$uploader = new XoopsMediaUploader(\$uploaddir, \${$module_dirname}->getConfig('mimetypes'),
- \${$module_dirname}->getConfig('maxsize'), null, null);
+ \$uploaddir = {$stuModuleDirname}_UPLOAD_PATH.'/images/{$tableName}';
+ \$uploader = new XoopsMediaUploader(\$uploaddir, \${$moduleDirname}->getConfig('mimetypes'),
+ \${$moduleDirname}->getConfig('maxsize'), null, null);
if (\$uploader->fetchMedia(\$_POST['xoops_upload_file'][0])) {
- \$uploader->setPrefix('{$field_name}_');
- \$uploader->fetchMedia(\$_POST['xoops_upload_file'][0]);
+ //\$uploader->setPrefix('{$fieldName}_');
+ //\$uploader->fetchMedia(\$_POST['xoops_upload_file'][0]);
if (!\$uploader->upload()) {
\$errors = \$uploader->getErrors();
redirect_header('javascript:history.go(-1)', 3, \$errors);
} else {
- \${$table_name}Obj->setVar('{$field_name}', \$uploader->getSavedFileName());
+ \${$tableName}Obj->setVar('{$fieldName}', \$uploader->getSavedFileName());
}
} else {
- \${$table_name}Obj->setVar('{$field_name}', \$_POST['{$field_name}']);
+ \${$tableName}Obj->setVar('{$fieldName}', \$_POST['{$fieldName}']);
}\n
EOT;
return $ret;
}
/*
* @public function getUploadFile
- * @param string $module_dirname
- * @param string $table_name
- * @param string $field_name
+ * @param string $moduleDirname
+ * @param string $tableName
+ * @param string $fieldName
*/
- public function getUploadFile($module_dirname, $table_name, $field_name) {
+ public function getUploadFile($moduleDirname, $tableName, $fieldName) {
+ $stuModuleDirname = strtolower($moduleDirname);
$ret = <<<EOT
// Set Var File
include_once XOOPS_ROOT_PATH.'/class/uploader.php';
- \$uploaddir = XOOPS_UPLOAD_PATH.'/{$module_dirname}/files/{$table_name}/';
- \$uploader = new XoopsMediaUploader(\$uploaddir, \${$module_dirname}->getConfig('mimetypes'),
- \${$module_dirname}->getConfig('maxsize'), null, null);
+ \$uploaddir = {$stuModuleDirname}_UPLOAD_PATH.'/files/{$tableName}';
+ \$uploader = new XoopsMediaUploader(\$uploaddir, \${$moduleDirname}->getConfig('mimetypes'),
+ \${$moduleDirname}->getConfig('maxsize'), null, null);
if (\$uploader->fetchMedia(\$_POST['xoops_upload_file'][0])) {
- \$uploader->setPrefix('{$field_name}_') ;
- \$uploader->fetchMedia(\$_POST['xoops_upload_file'][0]);
+ //\$uploader->setPrefix('{$fieldName}_') ;
+ //\$uploader->fetchMedia(\$_POST['xoops_upload_file'][0]);
if (!\$uploader->upload()) {
\$errors = \$uploader->getErrors();
redirect_header('javascript:history.go(-1)', 3, \$errors);
} else {
- \${$table_name}Obj->setVar('{$field_name}', \$uploader->getSavedFileName());
+ \${$tableName}Obj->setVar('{$fieldName}', \$uploader->getSavedFileName());
}
}\n
EOT;
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-02 19:27:17 UTC (rev 12671)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/pages.php 2014-07-03 22:42:40 UTC (rev 12672)
@@ -58,17 +58,16 @@
}
/*
* @public function getAdminPagesHeader
- * @param string $module_dirname
- * @param string $table_name
+ * @param string $moduleDirname
+ * @param string $tableName
*/
- public function getAdminPagesHeader($module_dirname, $table_name) {
+ public function getAdminPagesHeader($moduleDirname, $tableName) {
$ret = <<<EOT
\ninclude_once 'header.php';
//It recovered the value of argument op in URL$
-\$op = {$module_dirname}_CleanVars(\$_REQUEST, 'op', 'list', 'string');
-// Navigation
-echo \$adminMenu->addNavigation('{$table_name}.php');
+\$op = {$moduleDirname}_CleanVars(\$_REQUEST, 'op', 'list', 'string');
+//
switch (\$op)
{\n
EOT;
@@ -77,72 +76,73 @@
/*
* @public function getAdminPagesList
- * @param string $module_dirname
- * @param string $table_name
- * @param string $table_fieldname
+ * @param string $moduleDirname
+ * @param string $tableName
+ * @param string $tableFieldname
* @param string $language
* @param string $fields
* @param string $fpif
* @param string $fpmf
*/
- public function getAdminPagesList($module_dirname, $table_name, $table_fieldname, $language, $fields, $fpif, $fpmf) {
- $stu_module_dirname = strtoupper($module_dirname);
- $stu_table_name = strtoupper($table_name);
- $stu_table_fieldname = strtoupper($table_fieldname);
+ 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);
$ret = <<<EOT
case 'list':
default:
- \$limit = \${$module_dirname}->getConfig('adminpager');
- \$start = {$module_dirname}_CleanVars(\$_REQUEST, 'start', 0);
- \$adminMenu->addItemButton({$language}ADD_{$stu_table_fieldname}, '{$table_name}.php?op=new', 'add');
- \$template_main = '{$module_dirname}_admin_{$table_name}.tpl';
- echo \$adminMenu->renderButton();
+ \$limit = \${$moduleDirname}->getConfig('adminpager');
+ \$start = {$moduleDirname}_CleanVars(\$_REQUEST, 'start', 0);
+ \$adminMenu->addItemButton({$language}ADD_{$stu_table_fieldname}, '{$tableName}.php?op=new', 'add');
+ \$template_main = '{$moduleDirname}_admin_{$tableName}.tpl';
+ \$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('{$tableName}.php'));
+ \$GLOBALS['xoopsTpl']->assign('buttons', \$adminMenu->renderButton());
\$criteria = new CriteriaCompo();
\$criteria->setSort('{$fpif} ASC, {$fpmf}');
\$criteria->setOrder('ASC');
- \${$table_name}_rows = \${$table_name}Handler->getCount(\$criteria);
- \${$table_name}_arr = \${$table_name}Handler->getAll(\$criteria);
+ \${$tableName}_rows = \${$tableName}Handler->getCount(\$criteria);
+ \${$tableName}_arr = \${$tableName}Handler->getAll(\$criteria);
unset(\$criteria);
- \$GLOBALS['xoopsTpl']->assign('{$module_dirname}_url', {$stu_module_dirname}_URL);
- \$GLOBALS['xoopsTpl']->assign('{$module_dirname}_upload_url', {$stu_module_dirname}_UPLOAD_URL);
+ \$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_url', {$stu_module_dirname}_URL);
+ \$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_upload_url', {$stu_module_dirname}_UPLOAD_URL);
// Table view
- if (\${$table_name}_rows > 0)
+ if (\${$tableName}_rows > 0)
{
- foreach (array_keys(\${$table_name}_arr) as \$i)
+ foreach (array_keys(\${$tableName}_arr) as \$i)
{\n
EOT;
foreach(array_keys($fields) as $f)
{
- $field_name = $fields[$f]->getVar('field_name');
- $rp_field_name = $field_name;
+ $fieldName = $fields[$f]->getVar('field_name');
+ $rp_field_name = $fieldName;
// Verify if table_fieldname is not empty
- if(!empty($table_fieldname)) {
- if(strpos($field_name, '_')) {
- $str = strpos($field_name, '_');
+ if(!empty($tableFieldname)) {
+ if(strpos($fieldName, '_')) {
+ $str = strpos($fieldName, '_');
if($str !== false){
- $rp_field_name = substr($field_name, $str + 1, strlen($field_name));
+ $rp_field_name = substr($fieldName, $str + 1, strlen($fieldName));
}
}
- $lp_field_name = substr($field_name, 0, strpos($field_name, '_'));
+ $lp_field_name = substr($fieldName, 0, strpos($fieldName, '_'));
$ret .= <<<EOT
- \${$lp_field_name}['{$rp_field_name}'] = \${$table_name}_arr[\$i]->getVar('{$field_name}');\n
+ \${$lp_field_name}['{$rp_field_name}'] = \${$tableName}_arr[\$i]->getVar('{$fieldName}');\n
EOT;
} else {
- $lp_field_name = $table_name;
+ $lp_field_name = $tableName;
$ret .= <<<EOT
- \${$lp_field_name}['{$rp_field_name}'] = \${$table_name}_arr[\$i]->getVar('{$field_name}');\n
+ \${$lp_field_name}['{$rp_field_name}'] = \${$tableName}_arr[\$i]->getVar('{$fieldName}');\n
EOT;
}
}
$ret .= <<<EOT
- \$GLOBALS['xoopsTpl']->append('{$table_name}_list', \${$lp_field_name});
+ \$GLOBALS['xoopsTpl']->append('{$tableName}_list', \${$lp_field_name});
unset(\${$lp_field_name});
}\n
EOT;
$ret .= <<<EOT
- if ( \${$table_name}_rows > \$limit ) {
+ if ( \${$tableName}_rows > \$limit ) {
include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
- \$pagenav = new XoopsPageNav(\${$table_name}_rows, \$limit, \$start, 'start', 'op=list&limit=' . \$limit);
+ \$pagenav = new XoopsPageNav(\${$tableName}_rows, \$limit, \$start, 'start', 'op=list&limit=' . \$limit);
\$GLOBALS['xoopsTpl']->assign('pagenav', \$pagenav->renderNav(4));
}
} else {
@@ -155,20 +155,21 @@
/*
* @public function getAdminPagesNew
- * @param string $module_dirname
- * @param string $table_name
+ * @param string $moduleDirname
+ * @param string $tableName
* @param string $language
*/
- public function getAdminPagesNew($module_dirname, $table_name, $language) {
- $stu_table_name = strtoupper($table_name);
+ public function getAdminPagesNew($moduleDirname, $tableName, $language) {
+ $stu_table_name = strtoupper($tableName);
$ret = <<<EOT
case 'new':
- \$template_main = '{$module_dirname}_admin_{$table_name}.tpl';
- \$adminMenu->addItemButton({$language}{$stu_table_name}_LIST, '{$table_name}.php', 'list');
- echo \$adminMenu->renderButton();
+ \$template_main = '{$moduleDirname}_admin_{$tableName}.tpl';
+ \$adminMenu->addItemButton({$language}{$stu_table_name}_LIST, '{$tableName}.php', 'list');
+ \$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('{$tableName}.php'));
+ \$GLOBALS['xoopsTpl']->assign('buttons', \$adminMenu->renderButton());
// Get Form
- \${$table_name}Obj =& \${$table_name}Handler->create();
- \$form = \${$table_name}Obj->getForm();
+ \${$tableName}Obj =& \${$tableName}Handler->create();
+ \$form = \${$tableName}Obj->getForm();
\$form->display();
break;\n
EOT;
@@ -177,48 +178,51 @@
/*
* @public function getAdminPagesSave
- * @param string $module_dirname
- * @param string $table_name
+ * @param string $moduleDirname
+ * @param string $tableName
* @param string $language
* @param string $fields
* @param string $fpif
* @param string $fpmf
*/
- public function getAdminPagesSave($module_dirname, $table_name, $language, $fields, $fpif, $fpmf)
+ public function getAdminPagesSave($moduleDirname, $tableName, $language, $fields, $fpif, $fpmf)
{
$ret = <<<EOT
case 'save':
if ( !\$GLOBALS['xoopsSecurity']->check() ) {
- redirect_header('{$table_name}.php', 3, implode(',', \$GLOBALS['xoopsSecurity']->getErrors()));
+ redirect_header('{$tableName}.php', 3, implode(',', \$GLOBALS['xoopsSecurity']->getErrors()));
}
if (isset(\$_REQUEST['{$fpif}'])) {
- \${$table_name}Obj =& \${$table_name}Handler->get(\$_REQUEST['{$fpif}']);
+ \${$tableName}Obj =& \${$tableName}Handler->get(\$_REQUEST['{$fpif}']);
} else {
- \${$table_name}Obj =& \${$table_name}Handler->create();
+ \${$tableName}Obj =& \${$tableName}Handler->create();
}
// Set Vars\n
EOT;
foreach (array_keys($fields) as $f)
{
- $field_name = $fields[$f]->getVar('field_name');
- $field_element = $fields[$f]->getVar('field_element');
+ $fieldName = $fields[$f]->getVar('field_name');
+ $fieldElement = $fields[$f]->getVar('field_element');
if($f > 0) { // If we want to hide field id
- switch($field_element) {
+ switch($fieldElement) {
case 4:
case 5:
- $ret .= $this->adminobjects->getCheckBoxOrRadioYN($table_name, $field_name);
+ $ret .= $this->adminobjects->getCheckBoxOrRadioYN($tableName, $fieldName);
break;
case 9:
- $ret .= $this->adminobjects->getUploadImage($module_dirname, $table_name, $field_name);
+ $ret .= $this->adminobjects->getImageList($moduleDirname, $tableName, $fieldName);
break;
case 10:
- $ret .= $this->adminobjects->getUploadFile($module_dirname, $table_name, $field_name);
+ $ret .= $this->adminobjects->getUploadImage($moduleDirname, $tableName, $fieldName);
break;
case 11:
- $ret .= $this->adminobjects->getTextDateSelect($table_name, $field_name);
+ $ret .= $this->adminobjects->getUploadFile($moduleDirname, $tableName, $fieldName);
break;
+ case 12:
+ $ret .= $this->adminobjects->getTextDateSelect($tableName, $fieldName);
+ break;
default:
- $ret .= $this->adminobjects->getSimpleSetVar($table_name, $field_name);
+ $ret .= $this->adminobjects->getSimpleSetVar($tableName, $fieldName);
break;
}
}
@@ -226,12 +230,12 @@
$ret .= <<<EOT
// Insert Data
- if (\${$table_name}Handler->insert(\${$table_name}Obj)) {
- redirect_header('{$table_name}.php?op=list', 2, {$language}FORMOK);
+ if (\${$tableName}Handler->insert(\${$tableName}Obj)) {
+ redirect_header('{$tableName}.php?op=list', 2, {$language}FORMOK);
}
// Get Form
- echo \${$table_name}Obj->getHtmlErrors();
- \$form =& \${$table_name}Obj->getForm();
+ echo \${$tableName}Obj->getHtmlErrors();
+ \$form =& \${$tableName}Obj->getForm();
\$form->display();
break;\n
EOT;
@@ -240,24 +244,25 @@
/*
* @public function getAdminPagesEdit
- * @param string $module_dirname
- * @param string $table_name
- * @param string $table_fieldname
+ * @param string $moduleDirname
+ * @param string $tableName
+ * @param string $tableFieldname
* @param string $language
* @param string $fpif
*/
- public function getAdminPagesEdit($module_dirname, $table_name, $table_fieldname, $language, $fpif) {
- $stu_table_name = strtoupper($table_name);
- $stu_table_fieldname = strtoupper($table_fieldname);
+ public function getAdminPagesEdit($moduleDirname, $tableName, $tableFieldname, $language, $fpif) {
+ $stu_table_name = strtoupper($tableName);
+ $stu_table_fieldname = strtoupper($tableFieldname);
$ret = <<<EOT
case 'edit':
- \$template_main = '{$module_dirname}_admin_{$table_name}.tpl';
- \$adminMenu->addItemButton({$language}ADD_{$stu_table_fieldname}, '{$table_name}.php?op=new', 'add');
- \$adminMenu->addItemButton({$language}{$stu_table_name}_LIST, '{$table_name}.php', 'list');
- echo \$adminMenu->renderButton();
+ \$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');
+ \$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('{$tableName}.php'));
+ \$GLOBALS['xoopsTpl']->assign('buttons', \$adminMenu->renderButton());
// Get Form
- \${$table_name}Obj = \${$table_name}Handler->get(\$_REQUEST['{$fpif}']);
- \$form = \${$table_name}Obj->getForm();
+ \${$tableName}Obj = \${$tableName}Handler->get(\$_REQUEST['{$fpif}']);
+ \$form = \${$tableName}Obj->getForm();
\$form->display();
break;\n
EOT;
@@ -266,25 +271,25 @@
/*
* @public function getAdminPagesDelete
- * @param string $table_name
+ * @param string $tableName
* @param string $language
*/
- public function getAdminPagesDelete($table_name, $language, $fpif, $fpmf) {
+ public function getAdminPagesDelete($tableName, $language, $fpif, $fpmf) {
$ret = <<<EOT
case 'delete':
- \${$table_name}Obj =& \${$table_name}Handler->get(\$_REQUEST['{$fpif}']);
+ \${$tableName}Obj =& \${$tableName}Handler->get(\$_REQUEST['{$fpif}']);
if (isset(\$_REQUEST['ok']) && \$_REQUEST['ok'] == 1) {
if ( !\$GLOBALS['xoopsSecurity']->check() ) {
- redirect_header('{$table_name}.php', 3, implode(', ', \$GLOBALS['xoopsSecurity']->getErrors()));
+ redirect_header('{$tableName}.php', 3, implode(', ', \$GLOBALS['xoopsSecurity']->getErrors()));
}
- if (\${$table_name}Handler->delete(\${$table_name}Obj)) {
- redirect_header('{$table_name}.php', 3, {$language}FORMDELOK);
+ if (\${$tableName}Handler->delete(\${$tableName}Obj)) {
+ redirect_header('{$tableName}.php', 3, {$language}FORMDELOK);
} else {
- echo \${$table_name}Obj->getHtmlErrors();
+ echo \${$tableName}Obj->getHtmlErrors();
}
} else {
- xoops_confirm(array('ok' => 1, '{$fpif}' => \$_REQUEST['{$fpif}'], 'op' => 'delete'), \$_SERVER['REQUEST_URI'], sprintf({$language}FORMSUREDEL, \${$table_name}Obj->getVar('{$fpmf}')));
+ xoops_confirm(array('ok' => 1, '{$fpif}' => \$_REQUEST['{$fpif}'], 'op' => 'delete'), \$_SERVER['REQUEST_URI'], sprintf({$language}FORMSUREDEL, \${$tableName}Obj->getVar('{$fpmf}')));
}
break;\n
EOT;
@@ -311,31 +316,31 @@
{
$module = $this->getModule();
$table = $this->getTable();
- $module_dirname = $module->getVar('mod_dirname');
- $table_name = $table->getVar('table_name');
- $table_fieldname = $table->getVar('table_fieldname');
- $language = $this->getLanguage($module_dirname, 'AM');
+ $moduleDirname = $module->getVar('mod_dirname');
+ $tableName = $table->getVar('table_name');
+ $tableFieldname = $table->getVar('table_fieldname');
+ $language = $this->getLanguage($moduleDirname, 'AM');
$fields = $this->getTableFields($table->getVar('table_id'));
foreach(array_keys($fields) as $f)
{
- $field_name = $fields[$f]->getVar('field_name');
+ $fieldName = $fields[$f]->getVar('field_name');
if($f == 0) {
- $fpif = $field_name;
+ $fpif = $fieldName;
}
if($fields[$f]->getVar('field_main') == 1) {
- $fpmf = $field_name;
+ $fpmf = $fieldName;
}
}
$content = $this->getHeaderFilesComments($module, $filename);
- $content .= $this->getAdminPagesHeader($module_dirname, $table_name);
- $content .= $this->getAdminPagesList($module_dirname, $table_name, $table_fieldname, $language, $fields, $fpif, $fpmf);
- $content .= $this->getAdminPagesNew($module_dirname, $table_name, $language);
- $content .= $this->getAdminPagesSave($module_dirname, $table_name, $language, $fields, $fpif, $fpmf);
- $content .= $this->getAdminPagesEdit($module_dirname, $table_name, $table_fieldname, $language, $fpif);
- $content .= $this->getAdminPagesDelete($table_name, $language, $fpif, $fpmf);
+ $content .= $this->getAdminPagesHeader($moduleDirname, $tableName);
+ $content .= $this->getAdminPagesList($moduleDirname, $tableName, $tableFieldname, $language, $fields, $fpif, $fpmf);
+ $content .= $this->getAdminPagesNew($moduleDirname, $tableName, $language);
+ $content .= $this->getAdminPagesSave($moduleDirname, $tableName, $language, $fields, $fpif, $fpmf);
+ $content .= $this->getAdminPagesEdit($moduleDirname, $tableName, $tableFieldname, $language, $fpif);
+ $content .= $this->getAdminPagesDelete($tableName, $language, $fpif, $fpmf);
$content .= $this->getAdminPagesFooter();
//
- $this->tdmcfile->create($module_dirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
+ $this->tdmcfile->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
return $this->tdmcfile->renderFile();
}
}
\ No newline at end of file
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/permissions.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/permissions.php 2014-07-02 19:27:17 UTC (rev 12671)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/permissions.php 2014-07-03 22:42:40 UTC (rev 12672)
@@ -55,10 +55,10 @@
}
/*
* @private function getPermissionsCodeHeader
- * @param string $module_dirname
+ * @param string $moduleDirname
* @param string $language
*/
- private function getPermissionsCodeHeader($module_dirname, $language)
+ private function getPermissionsCodeHeader($moduleDirname, $language)
{
$ret = <<<PRM
\ninclude_once 'header.php';
@@ -73,10 +73,10 @@
if (count ( array_intersect ( \$group, \$groups ) ) <= 0) {
redirect_header ( 'index.php', 3, _NOPERM );
}*/
-\$template_main = '{$module_dirname}_admin_permissions.tpl';
+\$template_main = '{$moduleDirname}_admin_permissions.tpl';
echo \$adminMenu->addNavigation('permissions.php');
-\$permission = {$module_dirname}_CleanVars(\$_REQUEST, 'permission', 1, 'int');
+\$permission = {$moduleDirname}_CleanVars(\$_REQUEST, 'permission', 1, 'int');
\$selected = array('', '', '', '');
\$selected[\$permission-1] = ' selected';
xoops_load('XoopsFormLoader');
@@ -95,10 +95,10 @@
/*
* @private function getPermissionsCodeSwitch
- * @param string $module_dirname
+ * @param string $moduleDirname
* @param string $language
*/
- private function getPermissionsCodeSwitch($module_dirname, $language)
+ private function getPermissionsCodeSwitch($moduleDirname, $language)
{
$ret = <<<PRM
\$module_id = \$xoopsModule->getVar('mid');
@@ -106,7 +106,7 @@
{
case 1:
\$formTitle = {$language}GLOBAL;
- \$permName = '{$module_dirname}_ac';
+ \$permName = '{$moduleDirname}_ac';
\$permDesc = {$language}GLOBAL_DESC;
\$globalPerms = array( '4' => {$language}GLOBAL_4,
'8' => {$language}GLOBAL_8,
@@ -114,17 +114,17 @@
break;
case 2:
\$formTitle = {$language}APPROVE;
- \$permName = '{$module_dirname}_access';
+ \$permName = '{$moduleDirname}_access';
\$permDesc = {$language}APPROVE_DESC;
break;
case 3:
\$formTitle = {$language}SUBMIT;
- \$permName = '{$module_dirname}_submit';
+ \$permName = '{$moduleDirname}_submit';
\$permDesc = {$language}SUBMIT_DESC;
break;
case 4:
\$formTitle = {$language}VIEW;
- \$permName = '{$module_dirname}_view';
+ \$permName = '{$moduleDirname}_view';
\$permDesc = {$language}VIEW_DESC;
break;
}\n
@@ -134,21 +134,21 @@
/*
* @private function getPermissionsCodeBody
- * @param string $module_dirname
- * @param string $table_name
+ * @param string $moduleDirname
+ * @param string $tableName
* @param string $language
*/
- private function getPermissionsCodeBody($module_dirname, $language)
+ private function getPermissionsCodeBody($moduleDirname, $language)
{
$tables = $this->getTables();
foreach(array_keys($tables) as $t)
{
- $table_id = $tables[$t]->getVar('table_id');
+ $tableId = $tables[$t]->getVar('table_id');
if($tables[$t]->getVar('table_permissions') == 1) {
- $table_name = $tables[$t]->getVar('table_name');
+ $tableName = $tables[$t]->getVar('table_name');
}
}
- $fields = $this->getTableFields($table_id);
+ $fields = $this->getTableFields($tableId);
foreach(array_keys($fields) as $f)
{
if($f == 0) {
@@ -170,18 +170,18 @@
\$criteria = new CriteriaCompo();
\$criteria->setSort('{$fpmf}');
\$criteria->setOrder('ASC');
- \${$table_name}_count = \${$table_name}Handler->getCount(\$criteria);
- \${$table_name}_arr = \${$table_name}Handler->getObjects(\$criteria);
+ \${$tableName}_count = \${$tableName}Handler->getCount(\$criteria);
+ \${$tableName}_arr = \${$tableName}Handler->getObjects(\$criteria);
unset(\$criteria);
- foreach (array_keys(\${$table_name}_arr) as \$i) {
- \$permform->addItem(\${$table_name}_arr[\$i]->getVar('{$fpif}'), \${$table_name}_arr[\$i]->getVar('{$fpmf}'));
+ foreach (array_keys(\${$tableName}_arr) as \$i) {
+ \$permform->addItem(\${$tableName}_arr[\$i]->getVar('{$fpif}'), \${$tableName}_arr[\$i]->getVar('{$fpmf}'));
}
- // Check if {$table_name} exist before rendering the form and redirect, if there aren't {$table_name}
- if (\${$table_name}_count > 0) {
+ // Check if {$tableName} exist before rendering the form and redirect, if there aren't {$tableName}
+ if (\${$tableName}_count > 0) {
echo \$permform->render();
echo '<br /><br />';
} else {
- redirect_header ( '{$table_name}.php?op=new', 3, {$language}NOPERMSSET );
+ redirect_header ( '{$tableName}.php?op=new', 3, {$language}NOPERMSSET );
exit ();
}\n
PRM;
@@ -208,15 +208,15 @@
public function render() {
$module = $this->getModule();
$filename = $this->getFileName();
- $module_dirname = strtolower($module->getVar('mod_dirname'));
- $language = $this->getLanguage($module_dirname, 'AM');
+ $moduleDirname = $module->getVar('mod_dirname');
+ $language = $this->getLanguage($moduleDirname, 'AM');
$content = $this->getHeaderFilesComments($module, $filename);
- $content .= $this->getPermissionsCodeHeader($module_dirname, $language);
- $content .= $this->getPermissionsCodeSwitch($module_dirname, $language);
- $content .= $this->getPermissionsCodeBody($module_dirname, $language);
+ $content .= $this->getPermissionsCodeHeader($moduleDirname, $language);
+ $content .= $this->getPermissionsCodeSwitch($moduleDirname, $language);
+ $content .= $this->getPermissionsCodeBody($moduleDirname, $language);
$content .= $this->getPermissionsCodeFooter();
//
- $this->tdmcfile->create($module_dirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
+ $this->tdmcfile->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
return $this->tdmcfile->renderFile();
}
}
\ No newline at end of file
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-02 19:27:17 UTC (rev 12671)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/architecture.php 2014-07-03 22:42:40 UTC (rev 12672)
@@ -21,7 +21,7 @@
defined('XOOPS_ROOT_PATH') or die('Restricted access');
require_once 'structure.php';
/*include_once TDMC_PATH . '/include/functions.php';
-spl_autoload_register('TDMCreate_autoload');*/
+spl_autoload_register('tdmcreateAutoload');*/
class TDMCreateArchitecture extends TDMCreateStructure
{
@@ -40,7 +40,7 @@
/*
* @var mixed
*/
- private $upload_path = null;
+ private $uploadPath = null;
/*
* @public function constructor class
* @param null
@@ -73,7 +73,7 @@
* @param string $path
*/
public function getUploadPath($path) {
- $this->upload_path = $path;
+ $this->uploadPath = $path;
}
/*
* @public function createBaseFoldersFiles
@@ -82,32 +82,32 @@
public function createBaseFoldersFiles( $module )
{
// Module
- $mod_id = $module->getVar('mod_id');
+ $modId = $module->getVar('mod_id');
// Id of tables
- $criteria_tables = new CriteriaCompo();
- $criteria_tables->add(new Criteria('table_mid', $mod_id));
- $tables = $this->tdmcreate->getHandler('tables')->getObjects($criteria_tables);
- unset($criteria_tables);
+ $criteriaTables = new CriteriaCompo();
+ $criteriaTables->add(new Criteria('table_mid', $modId));
+ $tables = $this->tdmcreate->getHandler('tables')->getObjects($criteriaTables);
+ unset($criteriaTables);
//
$table = null;
foreach (array_keys($tables) as $t)
{
- $table_id = $tables[$t]->getVar('table_id');
- $table_name = $tables[$t]->getVar('table_name');
- $table_admin = $tables[$t]->getVar('table_admin');
- $table_user = $tables[$t]->getVar('table_user');
- $table_blocks = $tables[$t]->getVar('table_blocks');
- $table = $this->tdmcreate->getHandler('tables')->get($table_id);
+ $tableId = $tables[$t]->getVar('table_id');
+ $tableName = $tables[$t]->getVar('table_name');
+ $tableAdmin = $tables[$t]->getVar('table_admin');
+ $tableUser = $tables[$t]->getVar('table_user');
+ $tableBlocks = $tables[$t]->getVar('table_blocks');
+ $table = $this->tdmcreate->getHandler('tables')->get($tableId);
}
//
$indexFile = $this->path.'/index.html';
- $docs_folder = $this->path.'/docs';
- $logos_folder = $this->path.'/assets/images/logos';
- $stl_module_name = $module->getVar('mod_dirname');
- $stl_module_author = str_replace(' ', '', strtolower($module->getVar('mod_author')));
+ $docsFolder = $this->path.'/docs';
+ $logosFolder = $this->path.'/assets/images/logos';
+ $stlModuleDirname = $module->getVar('mod_dirname');
+ $stlModuleAuthor = str_replace(' ', '', strtolower($module->getVar('mod_author')));
// Creation of the Directory in repository
- $targetDirectory = $this->upload_path.'/repository/'. $stl_module_name;
- $upload_images_folder = $this->upload_path.'/images/repository';
+ $targetDirectory = $this->uploadPath.'/repository/'. $stlModuleDirname;
+ $uploadImagesFolder = $this->uploadPath.'/images/repository';
// Creation of "module" folder
$this->structure->getPath($targetDirectory);
@@ -134,8 +134,8 @@
// Creation of "images" folder and index.html file
$this->structure->makeDirAndCopyFile('assets/images', $indexFile, 'index.html');
//Copy the logo of the module
- $mod_image = str_replace(' ', '', strtolower($module->getVar('mod_image')));
- $this->structure->copyFile('assets/images', $upload_images_folder.'/'.$mod_image, $mod_image);
+ $modImage = str_replace(' ', '', strtolower($module->getVar('mod_image')));
+ $this->structure->copyFile('assets/images', $uploadImagesFolder.'/'.$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
@@ -143,26 +143,26 @@
// 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
- $logo_gif_from = $upload_images_folder.'/'.$stl_module_author.'_logo.gif';
- if (!file_exists($logo_gif_from)) {
- copy($logos_folder.'/'.$stl_module_author.'_logo.gif', $logo_gif_from);
+ $logoGifFrom = $uploadImagesFolder.'/'.$stlModuleAuthor.'_logo.gif';
+ if (!file_exists($logoGifFrom)) {
+ copy($logosFolder.'/'.$stlModuleAuthor.'_logo.gif', $logoGifFrom);
}
// Creation of 'module_author_logo.gif' file
- $this->structure->copyFile('assets/images', $logo_gif_from, $stl_module_author.'_logo.gif');
+ $this->structure->copyFile('assets/images', $logoGifFrom, $stlModuleAuthor.'_logo.gif');
// Creation of "images" folder and index.html file
$this->structure->makeDirAndCopyFile('assets/js', $indexFile, 'index.html');
// Creation of 'docs' folder and index.html file
$this->structure->makeDirAndCopyFile('docs', $indexFile, 'index.html');
// Creation of 'credits.txt' file
- $this->structure->copyFile('docs', $docs_folder.'/credits.txt', 'credits.txt');
+ $this->structure->copyFile('docs', $docsFolder.'/credits.txt', 'credits.txt');
// Creation of 'install.txt' file
- $this->structure->copyFile('docs', $docs_folder.'/install.txt', 'install.txt');
+ $this->structure->copyFile('docs', $docsFolder.'/install.txt', 'install.txt');
// Creation of 'lang_diff.txt' file
- $this->structure->copyFile('docs', $docs_folder.'/lang_diff.txt', 'lang_diff.txt');
+ $this->structure->copyFile('docs', $docsFolder.'/lang_diff.txt', 'lang_diff.txt');
// Creation of 'license.txt' file
- $this->structure->copyFile('docs', $docs_folder.'/license.txt', 'license.txt');
+ $this->structure->copyFile('docs', $docsFolder.'/license.txt', 'license.txt');
// Creation of 'readme.txt' file
- $this->structure->copyFile('docs', $docs_folder.'/readme.txt', 'readme.txt');
+ $this->structure->copyFile('docs', $docsFolder.'/readme.txt', 'readme.txt');
// Creation of "include" folder and index.html file
$this->structure->makeDirAndCopyFile('include', $indexFile, 'index.html');
// Creation of "language" folder and index.html file
@@ -196,87 +196,82 @@
}
/*
- * @public function createBuildingFiles
+ * @public function createFilesToBuilding
* @param string $module
*/
public function createFilesToBuilding( $module )
{
// Module
- $mod_id = $module->getVar('mod_id');
- $mod_dirname = $module->getVar('mod_dirname');
- $uploadTablesIcons32 = $this->upload_path.'/images/tables';
+ $modId = $module->getVar('mod_id');
+ $moduleDirname = $module->getVar('mod_dirname');
+ $uploadTablesIcons32 = $this->uploadPath.'/images/tables';
// Id of tables
- $criteria_tables = new CriteriaCompo();
- $criteria_tables->add(new Criteria('table_mid', $mod_id));
- $tables = $this->tdmcreate->getHandler('tables')->getObjects($criteria_tables);
- unset($criteria_tables);
+ $criteriaTables = new CriteriaCompo();
+ $criteriaTables->add(new Criteria('table_mid', $modId));
+ $tables = $this->tdmcreate->getHandler('tables')->getObjects($criteriaTables);
+ unset($criteriaTables);
$ret = array();
//
$table = null;
foreach (array_keys($tables) as $t)
{
- $table_mid = $tables[$t]->getVar('table_mid');
- $table_id = $tables[$t]->getVar('table_id');
- $table_name = $tables[$t]->getVar('table_name');
- $table_image = $tables[$t]->getVar('table_image');
- $table_admin = $tables[$t]->getVar('table_admin');
- $table_user = $tables[$t]->getVar('table_user');
- $table_blocks = $tables[$t]->getVar('table_blocks');
- $table_search = $tables[$t]->getVar('table_search');
- $table_comments = $tables[$t]->getVar('table_comments');
- $table_notifications = $tables[$t]->getVar('table_notifications');
- $table_permissions = $tables[$t]->getVar('table_permissions');
+ $tableMid = $tables[$t]->getVar('table_mid');
+ $tableId = $tables[$t]->getVar('table_id');
+ $tableName = $tables[$t]->getVar('table_name');
+ $tableImage = $tables[$t]->getVar('table_image');
+ $tableAdmin = $tables[$t]->getVar('table_admin');
+ $tableUser = $tables[$t]->getVar('table_user');
+ $tableBlocks = $tables[$t]->getVar('table_blocks');
+ $tableSearch = $tables[$t]->getVar('table_search');
+ $tableComments = $tables[$t]->getVar('table_comments');
+ $tableNotifications = $tables[$t]->getVar('table_notifications');
+ $tablePermissions = $tables[$t]->getVar('table_permissions');
// Get Table Object
- $table = $this->tdmcreate->getHandler('tables')->get($table_id);
+ $table = $this->tdmcreate->getHandler('tables')->get($tableId);
// Copy of tables images file
- if( file_exists($upload_table_image = $uploadTablesIcons32.'/'.$table_image)) {
- $this->structure->copyFile('assets/images/icons/32', $upload_table_image, $table_image);
+ if( file_exists($uploadTableImage = $uploadTablesIcons32.'/'.$tableImage)) {
+ $this->structure->copyFile('assets/images/icons/32', $uploadTableImage, $tableImage);
}
// Creation of admin files
- if ( $table_admin == 1) {
+ if ( $tableAdmin == 1) {
// Admin Pages File
$adminPages = AdminPages::getInstance();
$adminPages->write($module, $table);
- $ret[] = $adminPages->renderFile($table_name.'.php');
+ $ret[] = $adminPages->renderFile($tableName.'.php');
// Admin Templates File
$adminTemplatesPages = TemplatesAdminPages::getInstance();
$adminTemplatesPages->write($module, $table);
- $ret[] = $adminTemplatesPages->renderFile($mod_dirname.'_admin_'.$table_name.'.tpl');
+ $ret[] = $adminTemplatesPages->renderFile($moduleDirname.'_admin_'.$tableName.'.tpl');
}
// Creation of blocks
- if ( $table_blocks == 1) {
+ if ( $tableBlocks == 1) {
// Blocks Files
$blocksFiles = BlocksFiles::getInstance();
$blocksFiles->write($module, $table);
- $ret[] = $blocksFiles->renderFile($table_name.'.php');
+ $ret[] = $blocksFiles->renderFile($tableName.'.php');
// Templates Blocks Files
- $templatesFiles = TemplatesBlocks::getInstance();
- $templatesFiles->write($module, $table);
- $ret[] = $templatesFiles->renderFile($mod_dirname.'_block_'.$table_name.'.tpl');
- }
- // Blocks Templates File
- /*$blocksTemplates = BlocksTemplates::getInstance();
- $blocksTemplates->write($module, $table);
- $ret[] = $blocksTemplates->renderFile($table_name.'.tpl');*/
+ $templatesBlocks = TemplatesBlocks::getInstance();
+ $templatesBlocks->write($module, $table);
+ $ret[] = $templatesBlocks->renderFile($moduleDirname.'_block_'.$tableName.'.tpl');
+ }
// Creation of classes
- if ( $table_admin == 1 || $table_user == 1) {
+ if ( $tableAdmin == 1 || $tableUser == 1) {
// Class Files
$classFiles = ClassFiles::getInstance();
$classFiles->write($module, $table, $tables);
- $ret[] = $classFiles->renderFile($table_name.'.php');
+ $ret[] = $classFiles->renderFile($tableName.'.php');
}
// Creation of user files
- if ( $table_user == 1) {
+ if ( $tableUser == 1) {
// User Pages File
$userPages = UserPages::getInstance();
$userPages->write($module, $table);
- $ret[] = $userPages->renderFile($table_name.'.php');
+ $ret[] = $userPages->renderFile($tableName.'.php');
// User Templates File
$userTemplatesPages = TemplatesUserPages::getInstance();
$userTemplatesPages->write($module, $table);
- $ret[] = $userTemplatesPages->renderFile($mod_dirname.'_'.$table_name.'.tpl');
- }
- /*var_dump($table_name); */
+ $ret[] = $userTemplatesPages->renderFile($moduleDirname.'_'.$tableName.'.tpl');
+ }
}
// Language Modinfo File
$languageModinfo = LanguageModinfo::getInstance();
@@ -313,7 +308,7 @@
$ret[] = $adminPermissions->render();
// Templates Admin Permissions File
$adminTemplatesPermissions = TemplatesAdminPermissions::getInstance();
- $adminTemplatesPermissions->write($module, $mod_dirname.'_admin_permissions.tpl');
+ $adminTemplatesPermissions->write...
[truncated message content] |