|
From: <txm...@us...> - 2014-06-16 23:34:11
|
Revision: 12614
http://sourceforge.net/p/xoops/svn/12614
Author: txmodxoops
Date: 2014-06-16 23:34:06 +0000 (Mon, 16 Jun 2014)
Log Message:
-----------
- Updated
- Work in progress
Modified Paths:
--------------
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/fields.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/footer.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/architecture.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/classes/classes.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/docs/changelog.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language/admin.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language/blocks.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language/main.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user/xoopsversion.php
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/fields.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/fields.php 2014-06-16 14:33:04 UTC (rev 12613)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/fields.php 2014-06-16 23:34:06 UTC (rev 12614)
@@ -30,9 +30,7 @@
/*$field_mid = XoopsRequest::getInt('field_mid');
$field_tid = XoopsRequest::getInt('field_tid');
$field_numb = XoopsRequest::getInt('field_numb');
-$field_name = XoopsRequest::getString('field_name', '');
-$session_table = TDMCreateSession::getInstance();
-$table_name = $session_table->getSession('session_table_name');*/
+$field_name = XoopsRequest::getString('field_name', ''); */
//
switch ($op)
{
@@ -166,11 +164,11 @@
if ( !$GLOBALS['xoopsSecurity']->check() ) {
redirect_header('fields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
}
- $field_id = TDMCreate_CleanVars($_POST, 'field_id');
+ $field_id = TDMCreate_CleanVars($_REQUEST, 'field_id');
// Fields Handler
$fields = $tdmcreate->getHandler('fields');
// Set Variables
- foreach ($_POST['field_id'] as $key => $value)
+ foreach($_POST['field_id'] as $key => $value)
{
switch($value){
case 'new':
@@ -179,40 +177,44 @@
case 'edit':
$fieldsObj =& $fields->get($value);
break;
- }
- // Set Data
- $fieldsObj->setVar( 'field_mid', $field_mid );
- $fieldsObj->setVar( 'field_tid', $field_tid );
- $fieldsObj->setVar( 'field_numb', $field_numb );
- $fieldsObj->setVar( 'field_name', (isset($_POST['field_name'][$key]) ? $_POST['field_name'][$key] : '') );
- $fieldsObj->setVar( 'field_type', (isset($_POST['field_type'][$key]) ? $_POST['field_type'][$key] : '') );
- $fieldsObj->setVar( 'field_value', (isset($_POST['field_value'][$key]) ? $_POST['field_value'][$key] : '') );
- $fieldsObj->setVar( 'field_attribute', (isset($_POST['field_attribute'][$key]) ? $_POST['field_attribute'][$key] : '') );
- $fieldsObj->setVar( 'field_null', (isset($_POST['field_null'][$key]) ? $_POST['field_null'][$key] : '') );
- $fieldsObj->setVar( 'field_default', (isset($_POST['field_default'][$key]) ? $_POST['field_default'][$key] : '') );
- $fieldsObj->setVar( 'field_key', (isset($_POST['field_key'][$key]) ? $_POST['field_key'][$key] : '') );
- $fieldsObj->setVar( 'field_element', (isset($_POST['field_element'][$key]) ? $_POST['field_element'][$key] : '') );
- $fieldsObj->setVar( 'field_parent', (($key == isset($_REQUEST['field_parent'][$key])) ? 1 : 0) );
- $fieldsObj->setVar( 'field_inlist', ((isset($_REQUEST['field_inlist'][$key]) == 1) ? 1 : 0) );
- $fieldsObj->setVar( 'field_inform', ((isset($_REQUEST['field_inform'][$key]) == 1) ? 1 : 0) );
- $fieldsObj->setVar( 'field_admin', ((isset($_REQUEST['field_admin'][$key]) == 1) ? 1 : 0) );
- $fieldsObj->setVar( 'field_user', ((isset($_REQUEST['field_user'][$key]) == 1) ? 1 : 0) );
- $fieldsObj->setVar( 'field_block', ((isset($_REQUEST['field_block'][$key]) == 1) ? 1 : 0) );
- $fieldsObj->setVar( 'field_main', (($key == isset($_REQUEST['field_main'][$key])) ? 1 : 0) );
- $fieldsObj->setVar( 'field_search', ((isset($_REQUEST['field_search'][$key]) == 1) ? 1 : 0) );
- $fieldsObj->setVar( 'field_required', ((isset($_REQUEST['field_required'][$key]) == 1) ? 1 : 0) );
- // Insert Data
- $tdmcreate->getHandler('fields')->insert($fieldsObj);
- }
-
- //
+ }
+ if (isset($field_mid) && isset($field_tid) && !empty($_POST['field_name'][$key])) {
+ // Set Data
+ $fieldsObj->setVar( 'field_mid', $field_mid );
+ $fieldsObj->setVar( 'field_tid', $field_tid );
+ $fieldsObj->setVar( 'field_numb', $field_numb );
+ $fieldsObj->setVar( 'field_name', (isset($_POST['field_name'][$key]) ? $_POST['field_name'][$key] : '') );
+ $fieldsObj->setVar( 'field_type', (isset($_POST['field_type'][$key]) ? $_POST['field_type'][$key] : '') );
+ $fieldsObj->setVar( 'field_value', (isset($_POST['field_value'][$key]) ? $_POST['field_value'][$key] : '') );
+ $fieldsObj->setVar( 'field_attribute', (isset($_POST['field_attribute'][$key]) ? $_POST['field_attribute'][$key] : '') );
+ $fieldsObj->setVar( 'field_null', (isset($_POST['field_null'][$key]) ? $_POST['field_null'][$key] : '') );
+ $fieldsObj->setVar( 'field_default', (isset($_POST['field_default'][$key]) ? $_POST['field_default'][$key] : '') );
+ $fieldsObj->setVar( 'field_key', (isset($_POST['field_key'][$key]) ? $_POST['field_key'][$key] : '') );
+ $fieldsObj->setVar( 'field_element', (isset($_POST['field_element'][$key]) ? $_POST['field_element'][$key] : '') );
+ $fieldsObj->setVar( 'field_parent', ((isset($_REQUEST['field_parent'][$key]) == 1) ? 1 : 0) );
+ $fieldsObj->setVar( 'field_inlist', ((isset($_REQUEST['field_inlist'][$key]) == 1) ? 1 : 0) );
+ $fieldsObj->setVar( 'field_inform', ((isset($_REQUEST['field_inform'][$key]) == 1) ? 1 : 0) );
+ $fieldsObj->setVar( 'field_admin', ((isset($_REQUEST['field_admin'][$key]) == 1) ? 1 : 0) );
+ $fieldsObj->setVar( 'field_user', ((isset($_REQUEST['field_user'][$key]) == 1) ? 1 : 0) );
+ $fieldsObj->setVar( 'field_block', ((isset($_REQUEST['field_block'][$key]) == 1) ? 1 : 0) );
+ $fieldsObj->setVar( 'field_main', (($key == isset($_REQUEST['field_main'][$key])) ? 1 : 0) );
+ $fieldsObj->setVar( 'field_search', ((isset($_REQUEST['field_search'][$key]) == 1) ? 1 : 0) );
+ $fieldsObj->setVar( 'field_required', ((isset($_REQUEST['field_required'][$key]) == 1) ? 1 : 0) );
+ // Insert Data
+ $tdmcreate->getHandler('fields')->insert($fieldsObj);
+ }
+ }
+ // Get table name from field table id
+ $tables =& $tdmcreate->getHandler('tables')->get($field_tid);
+ $table_name = $tables->getVar('table_name');
+ // Set field elements
if ($fieldsObj->isNew()) {
// Fields Elements Handler
$fieldelementObj =& $tdmcreate->getHandler('fieldelements')->create();
$fieldelementObj->setVar( 'fieldelement_mid', $field_mid );
$fieldelementObj->setVar( 'fieldelement_tid', $field_tid );
- $fieldelementObj->setVar( 'fieldelement_name', 'Table : '.ucfirst($_SESSION['session_table_name']) );
- $fieldelementObj->setVar( 'fieldelement_value', 'XoopsFormTables-'.ucfirst($_SESSION['session_table_name']) );
+ $fieldelementObj->setVar( 'fieldelement_name', 'Table : '.ucfirst($table_name) );
+ $fieldelementObj->setVar( 'fieldelement_value', 'XoopsFormTables-'.ucfirst($table_name) );
// Insert new field element id for table name
if (!$tdmcreate->getHandler('fieldelements')->insert($fieldelementObj) ) {
$GLOBALS['xoopsTpl']->assign('error', $fieldelementObj->getHtmlErrors() . ' Field element');
@@ -223,10 +225,8 @@
}
//
$GLOBALS['xoopsTpl']->assign('error', $fieldsObj->getHtmlErrors());
- $form = $fieldsObj->getForm($field_mid, $field_tid, $field_numb);
- $GLOBALS['xoopsTpl']->assign('form', $form->render());
-
- unset($_SESSION['session_table_name']);
+ $form = $fieldsObj->getForm(null, $field_tid);
+ $GLOBALS['xoopsTpl']->assign('form', $form->render());
break;
case 'edit':
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields.php 2014-06-16 14:33:04 UTC (rev 12613)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields.php 2014-06-16 23:34:06 UTC (rev 12614)
@@ -159,6 +159,7 @@
* @private function getFormElements
*
* @param object $form
+ * @param boolean $isNew
* @param string $type
* @param integer $id
* @param string $f_name
@@ -207,7 +208,7 @@
$table_autoincrement = $this->tdmcreate->getHandler('tables')->get($field_tid);
if( ($id == 1) && ($table_autoincrement->getVar('table_autoincrement') == 1)) {
$form->addElement(new TDMCreateFormLabel('<td> </td></tr>'));
- } else {
+ } else {
// Box header row
$parameters_tray = new XoopsFormElementTray('', '<br />');
// Field Elements
@@ -221,9 +222,9 @@
unset($criteria_element); unset($criteria_table);
$parameters_tray->addElement($field_elements_select);
- $field_parent = $isNew ? ( $id == 1 ? 1 : 0 ) : $field->getVar('field_parent');
- $check_field_parent = new XoopsFormCheckBox(' ', 'field_parent', $field_parent);
- $check_field_parent->addOption($id, _AM_TDMCREATE_FIELD_PARENT );
+ $field_parent = $isNew ? 0 : $field->getVar('field_parent');
+ $check_field_parent = new XoopsFormCheckBox(' ', 'field_parent['.$id.']');
+ $check_field_parent->addOption($field_parent, _AM_TDMCREATE_FIELD_PARENT );
$parameters_tray->addElement($check_field_parent);
$field_inlist = $isNew ? 0 : $field->getVar('field_inlist');
@@ -249,13 +250,13 @@
$field_block = $isNew ? 0 : $field->getVar('field_block');
$check_field_block = new XoopsFormCheckBox('', 'field_block['.$id.']', $field_block);
$check_field_block->addOption(1, _AM_TDMCREATE_FIELD_BLOCK);
- $parameters_tray->addElement($check_field_block);
-
- $field_main = $isNew ? ( $id == 1 ? 1 : 0 ) : $field->getVar('field_main');
- $check_field_main = new XoopsFormRadio('', 'field_main', $field_main);
- $check_field_main->addOption('', _AM_TDMCREATE_FIELD_MAINFIELD );
- $parameters_tray->addElement($check_field_main);
-
+ $parameters_tray->addElement($check_field_block);
+ //$main = 1;
+ $field_main = $isNew ? $id : $field->getVar('field_main');
+ $check_field_main = new XoopsFormRadio('', 'field_main['.$id.']');
+ $check_field_main->addOption($field_main, _AM_TDMCREATE_FIELD_MAINFIELD );
+ $parameters_tray->addElement($check_field_main);
+
$field_search = $isNew ? 0 : $field->getVar('field_search');
$check_field_search = new XoopsFormCheckBox(' ', 'field_search['.$id.']', $field_search);
$check_field_search->addOption(1, _AM_TDMCREATE_FIELD_SEARCH);
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-06-16 14:33:04 UTC (rev 12613)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin/footer.php 2014-06-16 23:34:06 UTC (rev 12614)
@@ -58,18 +58,14 @@
public function render() {
$module = $this->getModule();
$filename = $this->getFileName();
- $module_name = strtolower($module->getVar('mod_name'));
- $support_name = $module->getVar('mod_support_name');
- $support_url = $module->getVar('mod_support_url');
- $language = $this->getLanguage($module_name, 'AM');
+ $module_name = strtolower($module->getVar('mod_name'));
$content = $this->getHeaderFilesComments($module, $filename);
$content .= <<<EOT
-\necho "<div class='center'><a href='http://www.xoops.org' title='Visit XOOPS' target='_blank'>
- <img src='".\$sysPathIcon32."/xoopsmicrobutton.gif' alt='XOOPS' /></a></div>";
-echo "<div class='center smallsmall italic pad5'>
- <strong>" . \$xoopsModule->getVar('name') . "</strong> ".{$language}MAINTAINEDBY."
- <a href='{$support_url}' title='Visit {$support_name}' class='tooltip' rel='external'>{$support_name}</a></div>";
-xoops_cp_footer();
+if ( isset(\$template_main) ) {
+ \$GLOBALS['xoopsTpl']->display("db:{\$template_main}");
+}
+xoops_cp_footer();
+?>
EOT;
$this->tdmcfile->create($module_name, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
return $this->tdmcfile->renderFile();
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/architecture.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/architecture.php 2014-06-16 14:33:04 UTC (rev 12613)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/architecture.php 2014-06-16 23:34:06 UTC (rev 12614)
@@ -99,8 +99,10 @@
//
$indexFile = $this->path.'/index.html';
$docs_folder = $this->path.'/docs';
+ $stl_module_name = str_replace(' ', '', strtolower($module->getVar('mod_name')));
+ $stl_module_author = str_replace(' ', '', strtolower($module->getVar('mod_author')));
// Creation of the Directory in repository
- $targetDirectory = $this->upload_path.'/repository/'. str_replace(' ', '', strtolower($module->getVar('mod_name')));
+ $targetDirectory = $this->upload_path.'/repository/'. $stl_module_name;
$upload_images_folder = $this->upload_path.'/images/repository';
// Creation of "module" folder
@@ -137,7 +139,7 @@
// Creation of "images/icons/32" folder and index.html file
$this->structure->makeDirAndCopyFile('assets/images/icons/32', $indexFile, 'index.html');
// Creation of 'txmodxoops_logo.png' file
- $this->structure->copyFile('assets/images', $upload_images_folder.'/txmodxoops_logo.png', 'txmodxoops_logo.png');
+ $this->structure->copyFile('assets/images', $upload_images_folder.'/'.$stl_module_author.'_logo.png', $stl_module_author.'_logo.png');
// Creation of "images" folder and index.html file
$this->structure->makeDirAndCopyFile('assets/js', $indexFile, 'index.html');
// Creation of 'docs' folder and index.html file
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-06-16 14:33:04 UTC (rev 12613)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/classes/classes.php 2014-06-16 23:34:06 UTC (rev 12614)
@@ -135,7 +135,7 @@
$ucf_module_name = ucfirst($module_name);
$ucf_table_name = ucfirst($table_name);
$ret = <<<EOT
-\ndefined('XOOPS_ROOT_PATH') or die("Restricted access");
+defined('XOOPS_ROOT_PATH') or die("Restricted access");
/*
* Class Object {$ucf_module_name}{$ucf_table_name}
*/
@@ -174,8 +174,8 @@
public function getHeadFunctionForm($module, $table)
{
$module_name = strtolower($module->getVar('mod_name'));
- $lang_add = $this->getLanguage($module_name, 'AM', 'ADD');
- $lang_edit = $this->getLanguage($module_name, 'AM', 'EDIT');
+ $language = $this->getLanguage($module_name, 'AM');
+ $stu_table_name = strtoupper($table->getVar('table_name'));
$this->formelements->initForm($module, $table);
$ret = <<<EOT
/*
@@ -189,7 +189,7 @@
\$action = filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_ENCODED);
}
- \$title = \$this->isNew() ? sprintf({$lang_add}) : sprintf({$lang_edit});
+ \$title = \$this->isNew() ? sprintf({$language}{$stu_table_name}_ADD) : sprintf({$language}{$stu_table_name}_EDIT);
xoops_load('XoopsFormLoader');
\$form = new XoopsThemeForm(\$title, 'form', \$action, 'post', true);
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/docs/changelog.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/docs/changelog.php 2014-06-16 14:33:04 UTC (rev 12613)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/docs/changelog.php 2014-06-16 23:34:06 UTC (rev 12614)
@@ -63,9 +63,9 @@
$module_name = strtolower($module->getVar('mod_name'));
$date = date('Y/m/d G:i:s');
$content = <<<EOT
-====================================
- {$date} Version {$module->getVar('mod_version')}
-====================================
+==============================================================
+Change Log for {$module_name} - {$date} Version {$module->getVar('mod_version')}
+==============================================================
- Original release {$module_name} ({$module->getVar('mod_author')})
EOT;
$this->tdmcfile->create($module_name, 'docs', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
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-06-16 14:33:04 UTC (rev 12613)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language/admin.php 2014-06-16 23:34:06 UTC (rev 12614)
@@ -20,13 +20,14 @@
*/
defined('XOOPS_ROOT_PATH') or die('Restricted access');
-class LanguageAdmin extends TDMCreateFile
+class LanguageAdmin extends TDMCreateFormElements
{
/*
* @public function constructor
* @param null
*/
public function __construct() {
+ parent::__construct();
$this->tdmcfile = TDMCreateFile::getInstance();
}
/*
@@ -51,8 +52,107 @@
$this->setModule($module);
$this->setTables($tables);
$this->setFileName($filename);
- }
+ }
+ /*
+ * @public function getLanguageAdminIndex
+ * @param string $language
+ * @param string $tables
+ */
+ public function getLanguageAdminIndex($language, $tables)
+ {
+ $ret = <<<EOT
+// ---------------- Index ----------------
+define('{$language}STATISTICS', "Statistics");
+// There are\n
+EOT;
+ foreach (array_keys($tables) as $t)
+ {
+ $table_name = $tables[$t]->getVar('table_name');
+ $stu_table_name = strtoupper($table_name);
+ $stl_table_name = strtolower($table_name);
+ $ret .= <<<EOT
+define('{$language}THEREARE_{$stu_table_name}', "There are <span class='bold'>%s</span> {$stl_table_name} in the database");\n
+EOT;
+ }
+ return $ret;
+ }
+ /*
+ * @public function getLanguageAdminClass
+ * @param string $language
+ * @param string $tables
+ */
+ public function getLanguageAdminClass($language, $tables)
+ {
+ $ret = <<<EOT
+// ---------------- Class ----------------\n
+EOT;
+ foreach (array_keys($tables) as $t)
+ {
+ $table_id = $tables[$t]->getVar('table_id');
+ $table_name = $tables[$t]->getVar('table_name');
+ $stu_table_name = strtoupper($table_name);
+ $ucf_table_name = ucfirst($table_name);
+ $ret .= <<<EOT
+// {$ucf_table_name}
+define('{$language}{$stu_table_name}_ADD', "Add {$table_name}");
+define('{$language}{$stu_table_name}_EDIT', "Edit {$table_name}");
+// Elements of {$ucf_table_name}\n
+EOT;
+ $fields = $this->getTableFields($table_id);
+ foreach(array_keys($fields) as $f)
+ {
+ $field_name = $fields[$f]->getVar('field_name');
+ $stu_field_name = strtoupper($field_name);
+ $field_name_desc = ucfirst(str_replace('_', ' ', $field_name));
+ $ret .= <<<EOT
+define('{$language}{$stu_field_name}', "{$field_name_desc}");\n
+EOT;
+ }
+ }
+ $ret .= <<<EOT
+// Permissions
+define('{$language}PERMISSIONS_APPROVE', "Permissions to approve");
+define('{$language}PERMISSIONS_SUBMIT', "Permissions to submit");
+define('{$language}PERMISSIONS_VIEW', "Permissions to view");\n
+EOT;
+ return $ret;
+ }
/*
+ * @public function getLanguageAdminPermissions
+ * @param string $language
+ */
+ public function getLanguageAdminPermissions($language)
+ {
+ $ret = <<<EOT
+// ---------------- Admin ----------------
+// Permissions
+define('{$language}GLOBAL', "Permissions global");
+define('{$language}GLOBAL_DESC', "Permissions global");
+define('{$language}GLOBAL_4', "Permissions global");
+define('{$language}GLOBAL_8', "Permissions global");
+define('{$language}GLOBAL_16', "Permissions global");
+define('{$language}APPROVE', "Permissions to approve");
+define('{$language}APPROVE_DESC', "Permissions to approve");
+define('{$language}SUBMIT', "Permissions to submit");
+define('{$language}SUBMIT_DESC', "Permissions to submit");
+define('{$language}VIEW', "Permissions to view");
+define('{$language}VIEW_DESC', "Permissions to view");
+define('{$language}NOPERMSSET', "No permission set");\n
+EOT;
+ return $ret;
+ }
+ /*
+ * @public function getLanguageAdminFoot
+ * @param null
+ */
+ public function getLanguageAdminFoot()
+ {
+ $ret = <<<EOT
+// ---------------- ----------------
+EOT;
+ return $ret;
+ }
+ /*
* @public function render
* @param null
*/
@@ -63,19 +163,11 @@
$module_name = $module->getVar('mod_name');
$language = $this->getLanguage($module_name, 'AM');
$content = $this->getHeaderFilesComments($module, $filename);
- $content .= <<<EOT
-\n//Admin
-EOT;
- foreach (array_keys($tables) as $i)
- {
- $table_name = $tables[$i]->getVar('table_name');
- $stu_table_name = strtoupper($table_name);
- $table_name_nohs = strtolower($table_name);
- $content .= <<<EOT
-\n//count "total {$table_name}"
-\ndefine('{$language}{$stu_table_name}', "There are <span class='bold'>%s</span> {$table_name_nohs} in the database");
-EOT;
- }
+ $content .= $this->getLanguageAdminIndex($language, $tables);
+ $content .= $this->getLanguageAdminClass($language, $tables);
+ $content .= $this->getLanguageAdminPermissions($language);
+ $content .= $this->getLanguageAdminFoot();
+ //
$this->tdmcfile->create($module_name, 'language/'.$GLOBALS['xoopsConfig']['language'], $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
return $this->tdmcfile->renderFile();
}
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language/blocks.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language/blocks.php 2014-06-16 14:33:04 UTC (rev 12613)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language/blocks.php 2014-06-16 23:34:06 UTC (rev 12614)
@@ -65,32 +65,29 @@
$language = $this->getLanguage($module_name, 'MB');
$content = $this->getHeaderFilesComments($module, $filename);
$content .= <<<EOT
-\n// Main
+// Main
define('{$language}DISPLAY', "How Many Tables to Display");
define('{$language}TITLELENGTH', "Title Length");
define('{$language}CATTODISPLAY', "Categories to Display");
define('{$language}ALLCAT', "All Categories");\n
EOT;
- foreach (array_keys($tables) as $i)
+ foreach (array_keys($tables) as $t)
{
- $table_id = $tables[$i]->getVar('table_id');
- $table_name = $tables[$i]->getVar('table_name');
- $table_fieldname = $tables[$i]->getVar('table_fieldname');
- $nb_caracteres = strlen($table_fieldname);
- $table_blocks = $tables[$i]->getVar('table_blocks');
- $language1 = $language.strtoupper($table_fieldname);
- $fields = $this->getTableFields($table_id);
+ $table_name = $tables[$t]->getVar('table_name');
+ //$table_fieldname = $tables[$t]->getVar('table_fieldname');
+ //$language1 = $language.strtoupper($table_fieldname);
+ $ucf_table_name = ucfirst($table_name);
+ $content .= <<<EOT
+// {$ucf_table_name}\n
+EOT;
+ $fields = $this->getTableFields($tables[$t]->getVar('table_id'));
foreach (array_keys($fields) as $f)
{
- $field_name = $fields[$f]->getVar('field_name');
- if($f == 0) {
- $fpif = $field_name;
- }
- $fields_final[$f] = substr($fpif, $nb_caracteres);
- $lng_fileds = $language1.'_'.strtoupper($fields_final[$f]);
- $ucf_table_field = $table_name.str_replace('_', ' ', ucfirst($fields_final[$f]));
+ $field_name = $fields[$f]->getVar('field_name');
+ $lng_fields = $language.strtoupper($field_name);
+ $ucf_table_field = ucfirst($table_name.' '.str_replace('_', ' ', $field_name));
$content .= <<<EOT
-define('{$lng_fileds}', "{$ucf_table_field}");\n
+define('{$lng_fields}', "{$ucf_table_field}");\n
EOT;
}
}
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language/main.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language/main.php 2014-06-16 14:33:04 UTC (rev 12613)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/language/main.php 2014-06-16 23:34:06 UTC (rev 12614)
@@ -69,7 +69,7 @@
$language = $this->getLanguage($module_name, 'MA');
$content = $this->getHeaderFilesComments($module, $filename);
$content .= <<<EOT
-\n// Main
+// ---------------- Main ----------------
define('{$language}INDEX', "Home");
define('{$language}TITLE', "{$ucf_mod_name}");
define('{$language}DESC', "{$module_description}");
@@ -79,31 +79,29 @@
{
$table_name = $tables[$i]->getVar('table_name');
$table_fieldname = $tables[$i]->getVar('table_fieldname');
- $nb_caracteres = strlen($table_fieldname);
- $table_blocks = $tables[$i]->getVar('table_blocks');
$lng_stu_table_name = $language.strtoupper($table_name);
$ucf_table_name = UcFirstAndToLower($table_name);
$content .= <<<EOT
+// {$ucf_table_name}
define('{$lng_stu_table_name}', "{$ucf_table_name}");
-define('{$lng_stu_table_name}_DESC', "{$ucf_table_name} description");\n
+define('{$lng_stu_table_name}_DESC', "{$ucf_table_name} description");
+// Caption of {$ucf_table_name}\n
EOT;
$fields = $this->getTableFields($tables[$i]->getVar('table_id'));
foreach (array_keys($fields) as $f)
{
- $field_name = $fields[$f]->getVar('field_name');
- if($f == 0) {
- $fpif = $field_name;
- }
- $fields_final[$f] = substr($fpif, $nb_caracteres);
- $lng_stu_fields = $language.'_'.strtoupper($table_fieldname).strtoupper($fields_final[$f]);
- $ucf_fields = ucfirst($table_fieldname.str_replace("_", " ", $fields_final[$f]));
+ $field_name = $fields[$f]->getVar('field_name');
+ $lng_stu_fields = $language.strtoupper($field_name);
+ $ucf_field_name = ucfirst(str_replace('_', ' ', $field_name));
$content .= <<<EOT
-define('{$lng_stu_fields}', "{$ucf_fields}");\n
+define('{$lng_stu_fields}', "{$ucf_field_name}");\n
EOT;
}
}
$content .= <<<EOT
+// Admin link
define('{$language}ADMIN', "Admin");
+// ---------------- ----------------
EOT;
$this->tdmcfile->create($module_name, 'language/'.$GLOBALS['xoopsConfig']['language'], $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
return $this->tdmcfile->renderFile();
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user/xoopsversion.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user/xoopsversion.php 2014-06-16 14:33:04 UTC (rev 12613)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user/xoopsversion.php 2014-06-16 23:34:06 UTC (rev 12614)
@@ -58,6 +58,11 @@
$this->setTable($table);
$this->setTables($tables);
$this->setFileName($filename);
+ foreach (array_keys($tables) as $t)
+ {
+ $table_name = $tables[$t]->getVar('table_name');
+ $this->setKeywords($table_name);
+ }
}
/*
* @public function setKeywords
@@ -166,13 +171,13 @@
// Scripts to run upon installation or update
'onInstall' => "include/install.php",
'onUpdate' => "include/update.php"
-);
+);\n
EOT;
} else {
$ret .= <<<EOT
// Menu
'hasMain' => 0
-);
+);\n
EOT;
}
return $ret;
@@ -185,23 +190,23 @@
{
$table_name = $table->getVar('table_name');
$stl_mod_name = strtolower($module_name);
- $j = 1;
+ $n = 1;
$ret = '';
if ( !empty($table_name) ) {
$ret .= <<<EOT
-\n\n// Mysql file
+\n// Mysql file
\$modversion['sqlfile']['mysql'] = "sql/mysql.sql";
-// Tables
+// Tables\n
EOT;
$tables = $this->getTables();
- foreach (array_keys($tables) as $i)
+ foreach (array_keys($tables) as $t)
{
$ret .= <<<EOT
-\n\$modversion['tables'][{$j}] = "mod_{$stl_mod_name}_{$tables[$i]->getVar('table_name')}";
+\$modversion['tables'][{$n}] = "mod_{$stl_mod_name}_{$tables[$t]->getVar('table_name')}";\n
EOT;
- $j++;
+ $n++;
}
- unset($j);
+ unset($n);
}
return $ret;
}
@@ -216,10 +221,10 @@
$ret = '';
if ( $module->getVar('mod_search') == 1 ) {
$ret .= <<<EOT
-\n//Search
+//Search
\$modversion['hasSearch'] = 1;
\$modversion['search']['file'] = "include/search.inc.php";
-\$modversion['search']['func'] = "{$stl_mod_name}_search";
+\$modversion['search']['func'] = "{$stl_mod_name}_search";\n
EOT;
}
return $ret;
@@ -235,40 +240,62 @@
$ret = '';
if ( $module->getVar('mod_comments') == 1 ) {
$ret .= <<<EOT
-\n// Comments
+// Comments
\$modversion['comments']['pageName'] = "comments.php";
\$modversion['comments']['itemName'] = "com_id";
// Comment callback functions
\$modversion['comments']['callbackFile'] = "include/comment_functions.php";
\$modversion['comments']['callback']['approve'] = "{$stl_mod_name}_com_approve";
-\$modversion['comments']['callback']['update'] = "{$stl_mod_name}_com_update";
+\$modversion['comments']['callback']['update'] = "{$stl_mod_name}_com_update";\n
EOT;
}
return $ret;
}
/*
- * @private function getXoopsVersionTemplates
+ * @private function getXoopsVersionTemplatesAdmin
* @param string $module_name
*/
- private function getXoopsVersionTemplates($module_name)
+ private function getXoopsVersionTemplatesAdmin($module_name)
{
$stl_mod_name = strtolower($module_name);
$tables = $this->getTables();
$ret = <<<EOT
-\n// Templates
+// Templates Admin
+\$modversion['templates'][] = array('file' => 'header.tpl', 'description' => '', 'type' => 'admin');
+\$modversion['templates'][] = array('file' => 'index.tpl', 'description' => '', 'type' => 'admin');\n
+EOT;
+ foreach (array_keys($tables) as $t)
+ {
+ $ret .= <<<EOT
+\$modversion['templates'][] = array('file' => '{$tables[$t]->getVar('table_name')}.tpl', 'description' => '', 'type' => 'admin');\n
+EOT;
+ }
+ $ret .= <<<EOT
+\$modversion['templates'][] = array('file' => 'footer.tpl', 'description' => '', 'type' => 'admin');\n
+EOT;
+ return $ret;
+ }
+ /*
+ * @private function getXoopsVersionTemplatesUser
+ * @param string $module_name
+ */
+ private function getXoopsVersionTemplatesUser($module_name)
+ {
+ $stl_mod_name = strtolower($module_name);
+ $tables = $this->getTables();
+ $ret = <<<EOT
+// Templates User
\$modversion['templates'][] = array('file' => 'header.tpl', 'description' => '');
-\$modversion['templates'][] = array('file' => 'index.tpl', 'description' => '');
+\$modversion['templates'][] = array('file' => 'index.tpl', 'description' => '');\n
EOT;
- foreach (array_keys($tables) as $i)
+ foreach (array_keys($tables) as $t)
{
- $table_name = $tables[$i]->getVar('table_name');
$ret .= <<<EOT
-\n\$modversion['templates'][] = array('file' => '{$table_name}.tpl', 'description' => '');
+\$modversion['templates'][] = array('file' => '{$tables[$t]->getVar('table_name')}.tpl', 'description' => '');\n
EOT;
- $this->setKeywords($table_name);
}
$ret .= <<<EOT
-\n\$modversion['templates'][] = array('file' => 'footer.tpl', 'description' => '');
+\$modversion['templates'][] = array('file' => 'footer.tpl', 'description' => '');\n
EOT;
return $ret;
}
@@ -277,26 +304,26 @@
* @param string $module_name
* @param string $language
*/
- private function getXoopsVersionBlocks($module_name, $table, $language)
+ private function getXoopsVersionBlocks($module_name, $language)
{
$stl_mod_name = strtolower($module_name);
- $ret = '';
- $ret .= <<<EOT
-\n//Blocks
+ $tables = $this->getTables();
+ $ret = <<<EOT
+//Blocks\n
EOT;
foreach (array_keys($tables) as $i) {
$table_name = $tables[$i]->getVar('table_name');
if ($tables[$i]->getVar('table_blocks') == 1) {
$language1 = $language . strtoupper($table_name);
$ret .= <<<EOT
-\n\$modversion['blocks'][] = array(
+\$modversion['blocks'][] = array(
'file' => "{$table_name}.php",
'name' => {$language1}_BLOCK,
'description' => "",
'show_func' => "b_{$stl_mod_name}_{$table_name}_show",
'edit_func' => "b_{$stl_mod_name}_{$table_name}_edit",
'options' => "{$tables[$i]->getVar('table_fieldname')}|5|25|0",
- 'template' => "{$table_name}_block.html");\n
+ 'template' => "{$table_name}.tpl");\n\n
EOT;
$this->setKeywords($table_name);
}
@@ -313,7 +340,7 @@
$module_name = $module->getVar('mod_name');
$stl_mod_name = strtolower($module_name);
$ret = <<<EOT
-\n// Config
+// Config
xoops_load('xoopseditorhandler');
\$editor_handler = XoopsEditorHandler::getInstance();
\$modversion['config'][] = array(
@@ -323,11 +350,11 @@
'formtype' => "select",
'valuetype' => "text",
'options' => array_flip(\$editor_handler->getList()),
- 'default' => "dhtml");\n
+ 'default' => "dhtml");\n\n
EOT;
if ( $module->getVar('mod_permissions') == 1 ) {
- $ret .= <<<EOT
-\n// Get groups
+ $ret .= <<<EOT
+// Get groups
\$member_handler =& xoops_gethandler('member');
\$xoopsgroups = \$member_handler->getGroupList();
foreach (\$xoopsgroups as \$key => \$group) {
@@ -357,22 +384,19 @@
'formtype' => "select_multi",
'valuetype' => "array",
'options' => \$admin_groups,
- 'default' => \$admin_groups);\n
+ 'default' => \$admin_groups);\n\n
EOT;
-}
+ }
+ $key = implode(', ', $this->getKeywords());
$ret .= <<<EOT
-\n\$modversion['config'][] = array(
+\$modversion['config'][] = array(
'name' => "keywords",
'title' => "{$language}KEYWORDS",
'description' => "{$language}KEYWORDS_DESC",
'formtype' => "textbox",
'valuetype' => "text",
- 'default' => "{$stl_mod_name},\n
+ 'default' => "{$stl_mod_name}, {$key}");\n
EOT;
- $ret .= implode(', ', $this->getKeywords());
- $ret .= <<<EOT
-");\n
-EOT;
unset($this->keywords);
if ($table->getVar('table_name') != '')
{
@@ -603,9 +627,14 @@
if ($table->getVar('table_comments') == 1) {
$content .= $this->getXoopsVersionComments($module);
}
- $content .= $this->getXoopsVersionTemplates($module_name);
+ if($table->getVar('table_admin') == 1) {
+ $content .= $this->getXoopsVersionTemplatesAdmin($module_name);
+ }
+ if($table->getVar('table_user') == 1) {
+ $content .= $this->getXoopsVersionTemplatesUser($module_name);
+ }
if ($table->getVar('table_blocks') == 1) {
- $content .= $this->getXoopsVersionBlocks($module_name, $table, $language);
+ $content .= $this->getXoopsVersionBlocks($module_name, $language);
}
$content .= $this->getXoopsVersionConfig($module, $table, $language);
if ($table->getVar('table_notifications') == 1) {
|