|
From: <txm...@us...> - 2014-04-18 11:37:59
|
Revision: 12458
http://sourceforge.net/p/xoops/svn/12458
Author: txmodxoops
Date: 2014-04-18 11:37:54 +0000 (Fri, 18 Apr 2014)
Log Message:
-----------
Added function for copy directory of new module in root/modules
Updated -> refactoring
P.S: This is a pre-alpha, only for repository (NO TEST)
Modified Paths:
--------------
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/building.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/fields.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/modules.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/tables.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/form_elements.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/form/themeform.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/tables.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/include/functions.php
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/building.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/building.php 2014-04-17 21:19:14 UTC (rev 12457)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/building.php 2014-04-18 11:37:54 UTC (rev 12458)
@@ -26,7 +26,8 @@
} else {
$modules =& $modulesHandler;
}
-
+$from_dir = TDMC_UPLOAD_MODULES_PATH.'/'.strtolower($mod_name);
+$to_dir = XOOPS_ROOT_PATH.'/modules/'.strtolower($mod_name);
switch ($op) {
case 'build':
$template_main = 'tdmcreate_building.html';
@@ -50,6 +51,9 @@
$mod_name = 'uploads/tdmcreate/modules/' . str_replace(' ', '', strtolower($modules->getVar('mod_name')));
// Creation of the structure of folders and files
$GLOBALS['xoopsTpl']->assign('build_list', 'Under new construction - Temporary build only folders of this selected module "'.$mod_name.'/"');
+ if ( $modules->getVar('mod_install') == 1 ) {
+ copyInRootModules($from_dir, $to_dir);
+ }
break;
case 'default':
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/fields.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/fields.php 2014-04-17 21:19:14 UTC (rev 12457)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/fields.php 2014-04-18 11:37:54 UTC (rev 12458)
@@ -37,7 +37,7 @@
{
case 'list':
default:
- $limit = xoops_getModuleOption('fields_adminpager');
+ $limit = $GLOBALS['xoopsModuleConfig']['fields_adminpager'];
$start = TDMCreate_CleanVars($_REQUEST, 'start', 0);
// Define main template
$template_main = 'tdmcreate_fields.html';
@@ -155,7 +155,7 @@
'field_default' => $_POST['field_default'][$i],
'field_key' => $_POST['field_key'][$i],
'field_autoincrement' => (($_REQUEST['field_autoincrement'][$i] == 1) ? '1' : '0'),
- 'field_element' => $_REQUEST['fieldelement_name'][$i],
+ 'field_element' => $_POST['field_element'][$i],
'field_inlist' => (($_REQUEST['field_inlist'][$i] == 1) ? '1' : '0'),
'field_inform' => (($_REQUEST['field_inform'][$i] == 1) ? '1' : '0'),
'field_admin' => (($_REQUEST['field_admin'][$i] == 1) ? '1' : '0'),
@@ -188,7 +188,7 @@
$GLOBALS['xoopsTpl']->assign('buttons', $adminMenu->renderButton());
$obj = $fieldsHandler->get($field_id);
- $form = $obj->getForm($field_mid, $field_tid, $field_numb, $field_name);
+ $form = $obj->getForm($field_mid, $field_tid, $field_numb);
$GLOBALS['xoopsTpl']->assign('form', $form->render());
break;
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/modules.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/modules.php 2014-04-17 21:19:14 UTC (rev 12457)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/modules.php 2014-04-18 11:37:54 UTC (rev 12458)
@@ -26,7 +26,7 @@
{
case 'list':
default:
- $limit = xoops_getModuleOption('mod_adminpager');
+ $limit = $GLOBALS['xoopsModuleConfig']['modules_adminpager'];
$start = TDMCreate_CleanVars($_REQUEST, 'start', 0);
// Define main template
$template_main = 'tdmcreate_modules.html';
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/tables.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/tables.php 2014-04-17 21:19:14 UTC (rev 12457)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/admin/tables.php 2014-04-18 11:37:54 UTC (rev 12458)
@@ -32,7 +32,7 @@
{
case 'list':
default:
- $limit = xoops_getModuleOption('adminperpage');
+ $limit = $GLOBALS['xoopsModuleConfig']['tables_adminpager'];
$start = TDMCreate_CleanVars($_REQUEST, 'start', 0);
// Define main template
$template_main = 'tdmcreate_tables.html';
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields.php 2014-04-17 21:19:14 UTC (rev 12457)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/fields.php 2014-04-18 11:37:54 UTC (rev 12458)
@@ -16,7 +16,7 @@
* @package tdmcreate
* @since 2.5.0
* @author Txmod Xoops http://www.txmodxoops.org
- * @version $Id: fields.php 12258 2014-01-02 09:33:29Z timgno $
+ * @version $Id: 1.91 fields.php 12258 2014-01-02 09:33:29Z timgno $
*/
defined('XOOPS_ROOT_PATH') or die('Restricted access');
require_once 'simplelabel.php';
@@ -86,55 +86,54 @@
public function getForm($f_mid = null, $f_tid = null, $f_numb = null, $f_name = null, $action = false)
{
if ($action === false) {
- $action = $_SERVER['REQUEST_URI'];
+ $action = XOOPS_URL.'/modules/TDMCreate/admin/fields.php'; //$_SERVER['REQUEST_URI'];
}
+ $isNew = $this->isNew();
+ $title = $isNew ? sprintf(_AM_TDMCREATE_FIELD_ADD) : sprintf(_AM_TDMCREATE_FIELD_EDIT);
- $title = $this->isNew() ? sprintf(_AM_TDMCREATE_FIELD_ADD) : sprintf(_AM_TDMCREATE_FIELD_EDIT);
+ $field_mid = $isNew ? $f_mid : $this->getVar('field_mid');
+ $field_tid = $isNew ? $f_tid : $this->getVar('field_tid');
+ $field_numb = $isNew ? $f_numb : $this->getVar('field_numb');
- if ($this->isNew()) {
- $field_tid = $f_tid;
- $field_mid = $f_mid;
- $field_numb = $f_numb;
- } else {
- $field_mid = $this->getVar('field_mid');
- $field_tid = $this->getVar('field_tid');
- $field_numb = $this->getVar('field_numb');
- }
-
- $form = new TDMCreateThemeForm($title, 'form', $action, 'post', true);
+ $form = new TDMCreateThemeForm(null, 'form', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
$tablesHandler = xoops_getModuleHandler('tables');
+ $fieldsHandler = xoops_getModuleHandler('fields');
$fieldelementsHandler =& xoops_getModuleHandler('fieldelements');
$fieldtypeHandler =& xoops_getModuleHandler('fieldtype');
$fieldattrsHandler =& xoops_getModuleHandler('fieldattributes');
$fieldnullHandler =& xoops_getModuleHandler('fieldnull');
$fieldkeyHandler =& xoops_getModuleHandler('fieldkey');
// New Object HtmlTable
- $form->addElement(new TDMCreateFormLabel('<table class="outer">'));
- $form->addElement(new TDMCreateFormLabel('<thead class="center"><tr class="width5">'));
- $form->addElement(new TDMCreateFormLabel('<th>'._AM_TDMCREATE_FIELD_NUMBER.'</th>'));
- $form->addElement(new TDMCreateFormLabel('<th>'._AM_TDMCREATE_FIELD_NAME.'</th>'));
- $form->addElement(new TDMCreateFormLabel('<th>'._AM_TDMCREATE_FIELD_TYPE.'</th>'));
- $form->addElement(new TDMCreateFormLabel('<th>'._AM_TDMCREATE_FIELD_VALUE.'</th>'));
- $form->addElement(new TDMCreateFormLabel('<th>'._AM_TDMCREATE_FIELD_ATTRIBUTE.'</th>'));
- $form->addElement(new TDMCreateFormLabel('<th>'._AM_TDMCREATE_FIELD_NULL.'</th>'));
- $form->addElement(new TDMCreateFormLabel('<th>'._AM_TDMCREATE_FIELD_DEFAULT.'</th>'));
- $form->addElement(new TDMCreateFormLabel('<th>'._AM_TDMCREATE_FIELD_KEY.'</th>'));
- $form->addElement(new TDMCreateFormLabel('<th>'._AM_TDMCREATE_FIELD_PARAMETERS.'</th>'));
+ $form->addElement(new TDMCreateFormLabel('<table border="0" cellspacing="1" class="outer width100">'));
+ $form->addElement(new TDMCreateFormLabel('<thead class="center">'));
+ $form->addElement(new TDMCreateFormLabel('<tr class="head"><th colspan="9">'.$title.'</th></tr>'));
+ $form->addElement(new TDMCreateFormLabel('<tr class="head width5">'));
+ $form->addElement(new TDMCreateFormLabel('<td>'._AM_TDMCREATE_FIELD_NUMBER.'</td>'));
+ $form->addElement(new TDMCreateFormLabel('<td>'._AM_TDMCREATE_FIELD_NAME.'</td>'));
+ $form->addElement(new TDMCreateFormLabel('<td>'._AM_TDMCREATE_FIELD_TYPE.'</td>'));
+ $form->addElement(new TDMCreateFormLabel('<td>'._AM_TDMCREATE_FIELD_VALUE.'</th>'));
+ $form->addElement(new TDMCreateFormLabel('<td>'._AM_TDMCREATE_FIELD_ATTRIBUTE.'</th>'));
+ $form->addElement(new TDMCreateFormLabel('<td>'._AM_TDMCREATE_FIELD_NULL.'</th>'));
+ $form->addElement(new TDMCreateFormLabel('<td>'._AM_TDMCREATE_FIELD_DEFAULT.'</th>'));
+ $form->addElement(new TDMCreateFormLabel('<td>'._AM_TDMCREATE_FIELD_KEY.'</th>'));
+ $form->addElement(new TDMCreateFormLabel('<td>'._AM_TDMCREATE_FIELD_PARAMETERS.'</th>'));
$form->addElement(new TDMCreateFormLabel('</tr></thead>'));
- $form->addElement(new TDMCreateFormLabel('<tbody>'));
+ $form->addElement(new TDMCreateFormLabel('<tbody>'));
+
+ $fields = $fieldsHandler->getObjects(null);
- $class = 'even';
+ $class = '';
for($i = 1; $i <= $field_numb; $i++)
{
- $class = $class ? 'odd' : 'even';
+ $class = ($class == 'even') ? 'odd' : 'even';
$form->addElement(new TDMCreateFormLabel('<tr class="'.$class.'">'));
// Index ID
$form->addElement(new TDMCreateFormLabel('<td class="center">'.$i.'</td>'));
- $field_name = $this->isNew() ? $f_name . '_' : $this->getVar('field_name');
- $field_name = new XoopsFormText(_AM_TDMCREATE_FIELD_NAME, 'field_name['.$i.']', 15, 255, $field_name);
- // Field Name
+ // Field Name
+ $field_name = $isNew ? $f_name . '_' : $this->getVar('field_name');
+ $field_name = new XoopsFormText(_AM_TDMCREATE_FIELD_NAME, 'field_name['.$i.']', 15, 255, $field_name);
$form->addElement(new TDMCreateFormLabel('<td class="center">'.$field_name->render().'</td>'));
// Field Type
$fieldtype_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_TYPE, 'field_type['.$i.']', $this->getVar('field_type'));
@@ -168,7 +167,7 @@
// Box header row
$parameters_tray = new XoopsFormElementTray('', '<br />');
// Field Elements
- $field_elements_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_ELEMENT_NAME, 'fieldelement_name['.$i.']', $this->getVar('fieldelement_name'));
+ $field_elements_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_ELEMENT_NAME, 'field_element['.$i.']', $this->getVar('field_element'));
$field_elements_select->addOptionArray($fieldelementsHandler->getList());
$criteria = new CriteriaCompo(new Criteria('table_id', $f_tid));
$criteria->add(new Criteria('table_mid', $f_mid));
@@ -176,10 +175,10 @@
$criteria->setOrder('ASC');
$table_arr = $tablesHandler->getAll($criteria);
unset($criteria);
- foreach (array_keys($table_arr) as $j)
+ foreach (array_keys($table_arr) as $xft_other)
{
- $form_table_name = $table_arr[$j]->getVar('table_name');
- if ( $j[$i] == 'XoopsFormTables-'.$form_table_name ) {
+ $form_table_name = $table_arr[$xft_other]->getVar('table_name');
+ if ( $xft_other[$i] == 'XoopsFormTables-'.$form_table_name ) {
$field_elements_select->addOption('XoopsFormTables-'.$form_table_name, 'Table : '.$form_table_name);
}
}
@@ -210,7 +209,7 @@
$check_field_block->addOption(1, _AM_TDMCREATE_FIELD_BLOCK);
$parameters_tray->addElement($check_field_block);
- $field_mnfield = $this->isNew() ? 0 : $this->getVar('field_main');
+ $field_mnfield = $this->isNew() ? 1 : $this->getVar('field_main');
$field_main = new XoopsFormRadio('', 'field_main['.$i.']', $field_mnfield);
$field_main->addOption( $i, _AM_TDMCREATE_FIELD_MAINFIELD );
$parameters_tray->addElement($field_main);
@@ -248,12 +247,12 @@
* @param null
*/
public function toArray() {
- $ret = parent::toArray();
- $f_tid = $this->table->getVar('table_id');
+ $ret = parent::toArray();
$f_mid = $this->table->getVar('table_mid');
+ $f_tid = $this->table->getVar('table_id');
$f_numb = $this->table->getVar('table_nbfields');
$f_name = $this->table->getVar('table_fieldname');
- $ret['edit_form'] = $this->getForm($f_tid, $f_mid, $f_numb, $f_name);
+ $ret['edit_form'] = $this->getForm($f_mid, $f_tid, $f_numb, $f_name);
return $ret;
}
}
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/form_elements.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/form_elements.php 2014-04-17 21:19:14 UTC (rev 12457)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/form_elements.php 2014-04-18 11:37:54 UTC (rev 12458)
@@ -18,27 +18,20 @@
* @author Txmod Xoops http://www.txmodxoops.org
* @version $Id: form_elements.php 12258 2014-01-02 09:33:29Z timgno $
*/
-if (!defined('XOOPS_ROOT_PATH')) {
- die('XOOPS root path not defined');
-}
+defined('XOOPS_ROOT_PATH') or die('Restricted access');
class FormElements
{
/*
- * @var string
- */
- private $required = '';
- /*
* @public function constructor
* @param string $module
* @param array $table
* @param string $fields
*/
- public function __construct($module, $table, $fields, $required) {
+ public function __construct($module, $table, $fields) {
$this->setModule($module);
$this->setTable($table);
$this->setFields($fields);
- $this->required = $required;
}
/**
* @param string $method
@@ -63,36 +56,36 @@
}
/*
* @public function getXoopsFormText
- * @param string $lng_form
+ * @param string $language
* @param string $field_name
* @param string $required
*/
- public function getXoopsFormText($lng_form, $field_name, $required = 'false') {
+ public function getXoopsFormText($language, $field_name, $required = 'false') {
$ret = <<<EOT
- \$form->addElement(new XoopsFormText({$lng_form}, '{$field_name}', 50, 255, \$this->getVar('{$field_name}')), {$required});
+ \$form->addElement(new XoopsFormText({$language}, '{$field_name}', 50, 255, \$this->getVar('{$field_name}')), {$required});
EOT;
return $ret;
}
/*
* @public function getXoopsFormText
- * @param string $lng_form
+ * @param string $language
* @param string $field_name
* @param string $required
*/
- public function getXoopsFormTextArea($lng_form, $field_name, $required = 'false') {
+ public function getXoopsFormTextArea($language, $field_name, $required = 'false') {
$ret = <<<EOT
- \$form->addElement(new XoopsFormTextArea({$lng_form}, '{$field_name}', \$this->getVar('{$field_name}'), 4, 47), {$required});
+ \$form->addElement(new XoopsFormTextArea({$language}, '{$field_name}', \$this->getVar('{$field_name}'), 4, 47), {$required});
EOT;
return $ret;
}
/*
* @public function getXoopsFormDhtmlTextArea
- * @param string $lng_form
+ * @param string $language
* @param string $module_name
* @param string $field_name
* @param string $required
*/
- public function getXoopsFormDhtmlTextArea($lng_form, $module_name, $field_name, $required = 'false') {
+ public function getXoopsFormDhtmlTextArea($language, $module_name, $field_name, $required = 'false') {
$ret = <<<EOT
\$editor_configs = array();
\$editor_configs['name'] = '{$field_name}';
@@ -102,20 +95,20 @@
\$editor_configs['width'] = '100%';
\$editor_configs['height'] = '400px';
\$editor_configs['editor'] = xoops_getModuleOption('{$module_name}_editor', '{$module_name}');
- \$form->addElement( new XoopsFormEditor({$lng_form}, '{$field_name}', \$editor_configs), {$required} );
+ \$form->addElement( new XoopsFormEditor({$language}, '{$field_name}', \$editor_configs), {$required} );
EOT;
return $ret;
}
/*
* @public function getXoopsFormCheckBox
- * @param string $lng_form
+ * @param string $language
* @param string $field_name
* @param string $required
*/
- public function getXoopsFormCheckBox($lng_form, $field_name, $required = 'false') {
+ public function getXoopsFormCheckBox($language, $field_name, $required = 'false') {
$ret = <<<EOT
\${$field_name} = \$this->isNew() ? 0 : \$this->getVar('{$field_name}');
- \$check_{$field_name} = new XoopsFormCheckBox({$lng_form}, '{$field_name}', \${$field_name});
+ \$check_{$field_name} = new XoopsFormCheckBox({$language}, '{$field_name}', \${$field_name});
\$check_{$field_name}->addOption(1, " ");
\$form->addElement(\$check_{$field_name}, {$required});
EOT;
@@ -133,146 +126,188 @@
}
/*
* @public function getXoopsFormUploadFile
- * @param string $lng_form
+ * @param string $language
* @param string $field_name
* @param string $required
*/
- public function getXoopsFormUploadFile($lng_form, $field_name, $required = 'false') {
+ public function getXoopsFormUploadFile($language, $field_name, $required = 'false') {
$ret = <<<EOT
- \$form->addElement(new XoopsFormUploadFile({$lng_form}, '{$field_name}', \$xoopsModuleConfig['maxsize']), {$required});
+ \$form->addElement(new XoopsFormUploadFile({$language}, '{$field_name}', \$xoopsModuleConfig['maxsize']), {$required});
EOT;
return $ret;
}
/*
* @public function getXoopsFormUploadImage
- * @param string $lng_form
+ * @param string $language
* @param string $field_name
* @param string $required
*/
- public function getXoopsFormUploadImage($lng_form, $field_name, $required = 'false') {
+ public function getXoopsFormUploadImage($language, $field_name, $required = 'false') {
$ret = <<<EOT
- \$form->addElement(new XoopsFormUploadImage({$lng_form}, '{$field_name}', \$xoopsModuleConfig['maxsize']), {$required});
+ \$form->addElement(new XoopsFormUploadImage({$language}, '{$field_name}', \$xoopsModuleConfig['maxsize']), {$required});
EOT;
return $ret;
}
/*
* @public function getXoopsFormColorPicker
- * @param string $lng_form
+ * @param string $language
* @param string $field_name
* @param string $required
*/
- public function getXoopsFormColorPicker($lng_form, $field_name, $required = 'false') {
+ public function getXoopsFormColorPicker($language, $field_name, $required = 'false') {
$ret = <<<EOT
- \$form->addElement(new XoopsFormColorPicker({$lng_form}, '{$field_name}', \$xoopsModuleConfig['maxsize']), {$required});
+ \$form->addElement(new XoopsFormColorPicker({$language}, '{$field_name}', \$xoopsModuleConfig['maxsize']), {$required});
EOT;
return $ret;
}
/*
* @public function getXoopsFormSelectUser
- * @param string $lng_form
+ * @param string $language
* @param string $field_name
* @param string $required
*/
- public function getXoopsFormSelectUser($lng_form, $field_name, $required = 'false') {
+ public function getXoopsFormSelectUser($language, $field_name, $required = 'false') {
$ret = <<<EOT
- \$form->addElement(new XoopsFormSelectUser({$lng_form}, '{$field_name}', false, \$this->getVar('{$field_name}'), 1, false), {$required});
+ \$form->addElement(new XoopsFormSelectUser({$language}, '{$field_name}', false, \$this->getVar('{$field_name}'), 1, false), {$required});
EOT;
return $ret;
}
/*
* @public function getXoopsFormRadioYN
- * @param string $lng_form
+ * @param string $language
* @param string $field_name
* @param string $required
*/
- public function getXoopsFormRadioYN($lng_form, $field_name, $required = 'false') {
+ public function getXoopsFormRadioYN($language, $field_name, $required = 'false') {
$ret = <<<EOT
${$field_name} = \$this->isNew() ? 0 : \$this->getVar('{$field_name}');
- \$form->addElement(new XoopsFormRadioYN({$lng_form}, '{$field_name}', ${$field_name}), {$required});
+ \$form->addElement(new XoopsFormRadioYN({$language}, '{$field_name}', ${$field_name}), {$required});
EOT;
return $ret;
}
/*
* @public function getXoopsFormTextDateSelect
- * @param string $lng_form
+ * @param string $language
* @param string $field_name
* @param string $required
*/
- public function getXoopsFormTextDateSelect($lng_form, $field_name, $required = 'false') {
+ public function getXoopsFormTextDateSelect($language, $field_name, $required = 'false') {
$ret = <<<EOT
- \$form->addElement(new XoopsFormTextDateSelect({$lng_form}, '{$field_name}', '', \$this->getVar('{$field_name}')), {$required});
+ \$form->addElement(new XoopsFormTextDateSelect({$language}, '{$field_name}', '', \$this->getVar('{$field_name}')), {$required});
EOT;
return $ret;
}
/*
- * @public function getXoopsFormTables
- * @param string $lng_form
+ * @public function getXoopsFormTable
+ * @param string $language
* @param string $module_name
* @param string $table_name
* @param string $field_name
* @param string $required
*/
- public function getXoopsFormTables($lng_form, $module_name, $table_name, $field_name, $required = 'false') {
- $ret = <<<EOT
+ public function getXoopsFormTable($language, $module_name, $table_name, $field_name, $required = 'false') {
+ $ret = <<<XFT
\${$table_name}Handler =& xoops_getModuleHandler('{$table_name}', '{$module_name}');
- \${$field_name}_select = new XoopsFormSelect({$lng_form}, '{$field_name}', \$this->getVar('{$field_name}'));
+ \${$field_name}_select = new XoopsFormSelect({$language}, '{$field_name}', \$this->getVar('{$field_name}'));
\${$field_name}_select->addOptionArray(${$field_name}Handler->getList());
\$form->addElement(${$field_name}_select, {$required});
-EOT;
+XFT;
return $ret;
}
/*
+ * @public function getXoopsFormTopic
+ * @param string $language
+ * @param string $module_name
+ * @param string $table_name
+ * @param string $field_name
+ * @param string $required
+ */
+ public function getXoopsFormTopic($language, $module_name, $table_name, $fields, $required = 'false') {
+ //
+ //
+ // ========================== Da elaborare per field parent e field name ============================
+ //
+ //
+ if($fields->getVar('field_id') == 1) {
+ $field_id = $fields->getVar('field_name');
+ }
+ if($fields->getVar('field_main') == 1) {
+ $field_name = $fields->getVar('field_name');
+ }
+ if($fields->getVar('field_parent') == 1) {
+ $field_pid = $fields->getVar('field_name');
+ }
+ $ret = <<<XFT
+ include_once(XOOPS_ROOT_PATH . '/class/tree.php');
+ \${$table_name}Handler = xoops_getModuleHandler('{$table_name}', '\${$module_name}' );
+ \$criteria = new CriteriaCompo();
+ \${$table_name} = \${$table_name}Handler->getObjects( \$criteria );
+ if(\${$table_name}) {
+ \${$table_name}_tree = new XoopsObjectTree( \${$table_name}, '{$field_id}', '{$field_pid}' );
+ \${$field_pid} = \${$table_name}_tree->makeSelBox( '{$field_pid}', '{$field_name}','--', \$this->getVar('{$field_pid}', 'e' ), true );
+ \$form->addElement( new XoopsFormLabel ( {$language}, \${$field_pid} ) );
+ }
+XFT;
+ // ========================== Da elaborare per field parent e field name ============================
+ return $ret;
+ }
+ /*
* @public function render
* @param null
*/
public function renderElement() {
- $module = $this->getModule();
- $table_name = $this->getTable()->getVar('table_name');
- $fields = $this->getFields();
- $filename = $this->getFileName();
- $module_name = $module->getVar('module_name');
- $field_name = $fields->getVar('field_name');
+ $module = $this->getModule();
+ $module_name = $module->getVar('module_name');
+ $table = $this->getTable();
+ $table_name = $table->getVar('table_name');
+ $fields = $this->getFields();
+ $field_name = $fields->getVar('field_name');
+ $filename = $this->getFileName();
$language = $this->getLanguage('AM', '_');
- $lng_form = $language . strtoupper($table_name) . '_' . strtoupper($field_name);
+ $language = $language . strtoupper($table_name) . '_' . strtoupper($field_name);
$required = ( $fields->getVar('field_required') == 1 ) ? 'true' : 'false';
$ret = '';
switch($fields->getVar('field_element'))
{
case 1:
- $ret .= $this->getXoopsFormText($lng_form, $field_name, $required);
+ $ret .= $this->getXoopsFormText($language, $field_name, $required);
break;
case 2:
- $ret .= $this->getXoopsFormTextArea($lng_form, $field_name, $required);
+ $ret .= $this->getXoopsFormTextArea($language, $field_name, $required);
break;
case 3:
- $ret .= $this->getXoopsFormDhtmlTextArea($lng_form, $module_name, $field_name, $required);
+ $ret .= $this->getXoopsFormDhtmlTextArea($language, $module_name, $field_name, $required);
break;
case 4:
- $ret .= $this->getXoopsFormCheckBox($lng_form, $field_name, $required);
+ $ret .= $this->getXoopsFormCheckBox($language, $field_name, $required);
break;
case 5:
$ret .= $this->getXoopsFormHidden($field_name);
break;
case 6:
- $ret .= $this->getXoopsFormUploadFile($lng_form, $field_name, $required);
+ $ret .= $this->getXoopsFormUploadFile($language, $field_name, $required);
break;
case 7:
- $ret .= $this->getXoopsFormUploadImage($lng_form, $field_name, $required);
+ $ret .= $this->getXoopsFormUploadImage($language, $field_name, $required);
break;
case 8:
- $ret .= $this->getXoopsFormColorPicker($lng_form, $field_name, $required);
+ $ret .= $this->getXoopsFormColorPicker($language, $field_name, $required);
break;
case 9:
- $ret .= $this->getXoopsFormSelectUser($lng_form, $field_name, $required);
+ $ret .= $this->getXoopsFormSelectUser($language, $field_name, $required);
break;
case 10:
- $ret .= $this->getXoopsFormRadioYN($lng_form, $field_name, $required);
+ $ret .= $this->getXoopsFormRadioYN($language, $field_name, $required);
break;
case 11:
- $ret .= $this->getXoopsFormTextDateSelect($lng_form, $field_name, $required);
+ $ret .= $this->getXoopsFormTextDateSelect($language, $field_name, $required);
break;
default:
- $ret .= $this->getXoopsFormTables($lng_form, $module_name, $table_name, $field_name, $required);
+ if($table->getVar('table_category') == 0) {
+ $ret .= $this->getXoopsFormTable($language, $module_name, $table_name, $field_name, $required);
+ } else {
+ $ret .= $this->getXoopsFormTopic($language, $module_name, $table_name, $fields, $required);
+ }
break;
}
return $ret;
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/form/themeform.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/form/themeform.php 2014-04-17 21:19:14 UTC (rev 12457)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/form/themeform.php 2014-04-18 11:37:54 UTC (rev 12458)
@@ -45,8 +45,8 @@
public function render()
{
$ele_name = $this->getName();
- $ret = ($this->getTitle() ? '<div class=" center head ">' . $this->getTitle() . '</div>' : '');
- $ret .= NWLINE . '<form name="' . $ele_name . '" id="' . $ele_name . '" action="' . $this->getAction() . '" method="' . $this->getMethod() . '" onsubmit="return xoopsFormValidate_' . $ele_name . '();"' . $this->getExtra() . '>' . NWLINE;
+ //$ret = ($this->getTitle() ? '<div class=" center head ">' . $this->getTitle() . '</div>' : '');
+ $ret = NWLINE . '<form name="' . $ele_name . '" id="' . $ele_name . '" action="' . $this->getAction() . '" method="' . $this->getMethod() . '" onsubmit="return xoopsFormValidate_' . $ele_name . '();"' . $this->getExtra() . '>' . NWLINE;
$hidden = '';
$class = 'even';
foreach ($this->getElements() as $ele) {
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/tables.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/tables.php 2014-04-17 21:19:14 UTC (rev 12457)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/tables.php 2014-04-18 11:37:54 UTC (rev 12458)
@@ -16,7 +16,7 @@
* @package tdmcreate
* @since 2.5.5
* @author Txmod Xoops <su...@tx...>
- * @version $Id: 1.59 tables.php 11297 2013-03-24 10:58:10Z timgno $
+ * @version $Id: 1.91 tables.php 11297 2013-03-24 10:58:10Z timgno $
*/
defined('XOOPS_ROOT_PATH') or die('Restricted access');
/*
@@ -50,7 +50,7 @@
$this->initVar('table_submenu',XOBJ_DTYPE_INT);
/*$this->initVar('table_status',XOBJ_DTYPE_INT);
$this->initVar('table_waiting',XOBJ_DTYPE_INT);
- $this->initVar('table_online',XOBJ_DTYPE_INT);*/
+ $this->initVar('table_display',XOBJ_DTYPE_INT);*/
$this->initVar('table_search',XOBJ_DTYPE_INT);
$this->initVar('table_comments',XOBJ_DTYPE_INT);
$this->initVar('table_notifications',XOBJ_DTYPE_INT);
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/include/functions.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/include/functions.php 2014-04-17 21:19:14 UTC (rev 12457)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/include/functions.php 2014-04-18 11:37:54 UTC (rev 12458)
@@ -86,7 +86,7 @@
// Deep copy directories
if (is_dir("$source/$entry") && ($dest !== "$source/$entry")) {
- copyr("$source/$entry", "$dest/$entry");
+ TDMCreate_copyr("$source/$entry", "$dest/$entry");
} else {
copy("$source/$entry", "$dest/$entry");
}
@@ -97,6 +97,29 @@
return true;
}
+// copy a directory and all subdirectories and files (recursive)
+// void dircpy( str 'source directory', str 'destination directory' [, bool 'overwrite existing files'] )
+function copyInRootModules($source, $dest, $overwrite = false) {
+ if($handle = opendir($source)){ // if the folder exploration is sucsessful, continue
+ while(false !== ($file = readdir($handle))){ // as long as storing the next file to $file is successful, continue
+ if($file != '.' && $file != '..') {
+ $path = $source . '/' . $file;
+ if(is_file($path)) {
+ if(!is_file($dest . '/' . $file) || $overwrite)
+ if(!@copy($path, $dest . '/' . $file)){
+ echo '<div class="red">File ('.$path.') could not be copied, likely a permissions problem.</div>';
+ }
+ } elseif(is_dir($path)){
+ if(!is_dir($dest . '/' . $file))
+ mkdir($dest . '/' . $file); // make subdirectory before subdirectory is copied
+ copyInRootModules($path, $dest . '/' . $file, $overwrite); //recurse!
+ }
+ }
+ }
+ closedir($handle);
+ }
+} // end of dircpy()
+
/*
if(function_exists(isset($_GET['f']))) { // get function name and parameter $_GET['f']($_GET["p"]);
include_once TDMC_PATH . '/class/modules.php';
|