|
From: <txm...@us...> - 2015-04-28 21:55:43
|
Revision: 13050
http://sourceforge.net/p/xoops/svn/13050
Author: txmodxoops
Date: 2015-04-28 21:55:41 +0000 (Tue, 28 Apr 2015)
Log Message:
-----------
Updated
Fixed bugs
Modified Paths:
--------------
XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/tables.php
XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/modules.php
XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/docs/changelog.txt
XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/language/english/admin.php
XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/sql/mysql.sql
XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/xoops_version.php
Removed Paths:
-------------
XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/about.php
XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/footer.php
XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/header.php
XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/index.php
XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/menu.php
XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/objects.php
XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/pages.php
XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/permissions.php
XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/user/index.php
XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/form/simpleform.php
XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/form/themeform.php
XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/helper.php
XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/html/html.php
XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/html/htmlform.php
XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/html/htmltable.php
XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/html/htmltag.php
XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/html/simplelabel.php
Modified: XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/tables.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/tables.php 2015-04-28 16:44:18 UTC (rev 13049)
+++ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/admin/tables.php 2015-04-28 21:55:41 UTC (rev 13050)
@@ -155,84 +155,80 @@
}
//
$tables =& $tdmcreate->getHandler('tables');
- if (!isset($tableId)) {
- // Checking if table name exist $tables->isNew()
- $criteria = new CriteriaCompo();
- $criteria->add(new Criteria('table_name', $tableName));
- $table_name_search = $tables->getObjects($criteria);
- //unset($criteria);
- foreach (array_keys($table_name_search) as $t)
- {
- if( ($table_name_search[$t]->getVar('table_name') === $_POST['table_name']) &&
- ($table_name_search[$t]->getVar('table_mid') === $tableMid) &&
- ($table_name_search[$t]->getVar('table_id') === $tableId)) {
- }
+ // Checking if table name exist
+ $criteria = new CriteriaCompo();
+ $criteria->add(new Criteria('table_mid', $tableMid));
+ $table_name_search = $tables->getObjects($criteria);
+ //unset($criteria);
+ foreach (array_keys($table_name_search) as $t)
+ {
+ if( $table_name_search[$t]->getVar('table_name') === $_POST['table_name'] ) {
+ redirect_header('tables.php?op=new', 3, sprintf(_AM_TDMCREATE_ERROR_TABLE_NAME_EXIST, $_POST['table_name']));
+ return false;
+ }
+ }
+ //
+ if (isset($tableId)) {
+ $tablesObj =& $tables->get($tableId);
+ } else {
+ $tablesObj =& $tables->create();
+ }
+ $order = $tablesObj->isNew() ? $tableOrder + 1 : $tableOrder;
+ // Form save tables
+ $tablesObj->setVars(array('table_mid' => $tableMid,
+ 'table_name' => $_POST['table_name'],
+ 'table_category' => $_REQUEST['table_category'],
+ 'table_nbfields' => $tableNumbFields,
+ 'table_order' => $order,
+ 'table_fieldname' => $tableFieldname));
+ //Form table_image
+ include_once XOOPS_ROOT_PATH.'/class/uploader.php';
+ $uploaddir = is_dir(XOOPS_ICONS32_PATH) ? XOOPS_ICONS32_PATH : TDMC_UPLOAD_IMGTAB_PATH;
+ $uploader = new XoopsMediaUploader($uploaddir, $tdmcreate->getConfig('mimetypes'),
+ $tdmcreate->getConfig('maxsize'), null, null);
+ if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
+ $uploader->fetchMedia($_POST['xoops_upload_file'][0]);
+ if (!$uploader->upload()) {
+ $errors = $uploader->getErrors();
+ redirect_header('javascript:history.go(-1)', 3, $errors);
+ } else {
+ $tablesObj->setVar('table_image', $uploader->getSavedFileName());
}
- redirect_header('tables.php?op=new', 3, sprintf(_AM_TDMCREATE_ERROR_TABLE_NAME_EXIST, $_POST['table_name']));
- } else {
- if (isset($tableId)) {
- $tablesObj =& $tables->get($tableId);
- } else {
- $tablesObj =& $tables->create();
- }
- $order = $tablesObj->isNew() ? $tableOrder + 1 : $tableOrder;
- // Form save tables
- $tablesObj->setVars(array('table_mid' => $tableMid,
- 'table_name' => $_POST['table_name'],
- 'table_category' => (($_REQUEST['table_category'] == 1) ? '1' : '0'),
- 'table_nbfields' => $tableNumbFields,
- 'table_order' => $order,
- 'table_fieldname' => $tableFieldname));
- //Form table_image
- include_once XOOPS_ROOT_PATH.'/class/uploader.php';
- $framePathIcon32 = XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32';
- $uploaddir = is_dir($framePathIcon32) ? $framePathIcon32 : TDMC_UPLOAD_IMGTAB_PATH;
- $uploader = new XoopsMediaUploader($uploaddir, $tdmcreate->getConfig('mimetypes'),
- $tdmcreate->getConfig('maxsize'), null, null);
- if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
- $uploader->fetchMedia($_POST['xoops_upload_file'][0]);
- if (!$uploader->upload()) {
- $errors = $uploader->getErrors();
- redirect_header('javascript:history.go(-1)', 3, $errors);
- } else {
- $tablesObj->setVar('table_image', $uploader->getSavedFileName());
- }
+ } else {
+ $tablesObj->setVar('table_image', $_POST['table_image']);
+ }
+ $tablesObj->setVars(array('table_autoincrement' => $_REQUEST['table_autoincrement'],
+ 'table_blocks' => $_REQUEST['table_blocks'],
+ 'table_admin' => $_REQUEST['table_admin'],
+ 'table_user' => $_REQUEST['table_user'],
+ 'table_submenu' => $_REQUEST['table_submenu'],
+ 'table_submit' => $_REQUEST['table_submit'],
+ 'table_tag' => $_REQUEST['table_tag'],
+ 'table_broken' => $_REQUEST['table_broken'],
+ 'table_search' => $_REQUEST['table_search'],
+ 'table_comments' => $_REQUEST['table_comments'],
+ 'table_notifications' => $_REQUEST['table_notifications'],
+ 'table_permissions' => $_REQUEST['table_permissions'],
+ 'table_rate' => $_REQUEST['table_rate'],
+ 'table_print' => $_REQUEST['table_print'],
+ 'table_pdf' => $_REQUEST['table_pdf'],
+ 'table_rss' => $_REQUEST['table_rss'],
+ 'table_single' => $_REQUEST['table_single'],
+ 'table_visit' => $_REQUEST['table_visit']
+ ) );
+ //
+ if( $tables->insert($tablesObj) ) {
+ if( $tablesObj->isNew() ) {
+ $tableTid = $GLOBALS['xoopsDB']->getInsertId();
+ $tableAction = '&field_mid='.$tableMid.'&field_tid='.$tableTid.'&field_numb='.$tableNumbFields.'&field_name='.$tableFieldname;
+ redirect_header('fields.php?op=new'.$tableAction, 5, sprintf(_AM_TDMCREATE_TABLE_FORM_CREATED_OK, $_POST['table_name']));
} else {
- $tablesObj->setVar('table_image', $_POST['table_image']);
- }
- $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'),
- 'table_submit' => (($_REQUEST['table_submit'] == 1) ? '1' : '0'),
- 'table_tag' => (($_REQUEST['table_tag'] == 1) ? '1' : '0'),
- 'table_broken' => (($_REQUEST['table_broken'] == 1) ? '1' : '0'),
- 'table_search' => (($_REQUEST['table_search'] == 1) ? '1' : '0'),
- 'table_comments' => (($_REQUEST['table_comments'] == 1) ? '1' : '0'),
- 'table_notifications' => (($_REQUEST['table_notifications'] == 1) ? '1' : '0'),
- 'table_permissions' => (($_REQUEST['table_permissions'] == 1) ? '1' : '0'),
- 'table_rate' => (($_REQUEST['table_rate'] == 1) ? '1' : '0'),
- 'table_print' => (($_REQUEST['table_print'] == 1) ? '1' : '0'),
- 'table_pdf' => (($_REQUEST['table_pdf'] == 1) ? '1' : '0'),
- 'table_rss' => (($_REQUEST['table_rss'] == 1) ? '1' : '0'),
- 'table_single' => (($_REQUEST['table_single'] == 1) ? '1' : '0'),
- 'table_visit' => (($_REQUEST['table_visit'] == 1) ? '1' : '0')
- ) );
- //
- if( $tables->insert($tablesObj) ) {
- if( $tablesObj->isNew() ) {
- $tableTid = $GLOBALS['xoopsDB']->getInsertId();
- $table_action = '&field_mid='.$tableMid.'&field_tid='.$tableTid.'&field_numb='.$tableNumbFields.'&field_name='.$tableFieldname;
- redirect_header('fields.php?op=new'.$table_action, 5, sprintf(_AM_TDMCREATE_TABLE_FORM_CREATED_OK, $_POST['table_name']));
- } else {
- // Get fields where table id
- $fields =& $tdmcreate->getHandler('fields');
- $fieldsObj = $fields->get($tableId);
- $fieldsObj->setVar('field_numb', $tableNumbFields);
- $fields->insert($fieldsObj);
- redirect_header('tables.php', 5, sprintf(_AM_TDMCREATE_TABLE_FORM_UPDATED_OK, $_POST['table_name']));
- }
+ // Get fields where table id
+ $fields =& $tdmcreate->getHandler('fields');
+ $fieldsObj = $fields->get($tableId);
+ $fieldsObj->setVar('field_numb', $tableNumbFields);
+ $fields->insert($fieldsObj);
+ redirect_header('tables.php', 5, sprintf(_AM_TDMCREATE_TABLE_FORM_UPDATED_OK, $_POST['table_name']));
}
}
//
Deleted: XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/about.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/about.php 2015-04-28 16:44:18 UTC (rev 13049)
+++ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/about.php 2015-04-28 21:55:41 UTC (rev 13050)
@@ -1,73 +0,0 @@
-<?php
-/*
- You may not change or alter any portion of this comment or credits
- of supporting developers from this source code or any supporting source code
- which is considered copyrighted (c) material of the original comment or credit authors.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- */
-/**
- * tdmcreate module
- *
- * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
- * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
- * @package tdmcreate
- * @since 2.5.0
- * @author Txmod Xoops http://www.txmodxoops.org
- * @version $Id: 1.91 admin_about.php 12258 2014-01-02 09:33:29Z timgno $
- */
-defined('XOOPS_ROOT_PATH') or die('Restricted access');
-
-class AdminAbout extends TDMCreateFile
-{
- /*
- * @public function constructor
- * @param null
- */
- public function __construct() {
- $this->tdmcfile = TDMCreateFile::getInstance();
- }
- /*
- * @static function &getInstance
- * @param null
- */
- public static function &getInstance()
- {
- static $instance = false;
- if (!$instance) {
- $instance = new self();
- }
- return $instance;
- }
- /*
- * @public function write
- * @param string $module
- * @param string $filename
- */
- public function write($module, $filename) {
- $this->setModule($module);
- $this->setFileName($filename);
- }
- /*
- * @public function render
- * @param null
- */
- public function render() {
- $module = $this->getModule();
- $filename = $this->getFileName();
- $moduleDirname = $module->getVar('mod_dirname');
- $moduleDonations = $module->getVar('mod_donations');
- $content = $this->getHeaderFilesComments($module, $filename);
- $content .= <<<EOT
-include 'header.php';
-\$template_main = '{$moduleDirname}_admin_about.tpl';
-\$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('about.php'));
-\$GLOBALS['xoopsTpl']->assign('about', \$adminMenu->renderAbout('{$moduleDonations}', false));
-include 'footer.php';
-EOT;
- $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
Deleted: XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/footer.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/footer.php 2015-04-28 16:44:18 UTC (rev 13049)
+++ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/footer.php 2015-04-28 21:55:41 UTC (rev 13050)
@@ -1,73 +0,0 @@
-<?php
-/*
- You may not change or alter any portion of this comment or credits
- of supporting developers from this source code or any supporting source code
- which is considered copyrighted (c) material of the original comment or credit authors.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- */
-/**
- * tdmcreate module
- *
- * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
- * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
- * @package tdmcreate
- * @since 2.5.0
- * @author Txmod Xoops http://www.txmodxoops.org
- * @version $Id: 1.91 admin_footer.php 12258 2014-01-02 09:33:29Z timgno $
- */
-defined('XOOPS_ROOT_PATH') or die('Restricted access');
-
-class AdminFooter extends TDMCreateFile
-{
- /*
- * @public function constructor
- * @param null
- */
- public function __construct() {
- $this->tdmcfile = TDMCreateFile::getInstance();
- }
- /*
- * @static function &getInstance
- * @param string $module
- * @param string $filename
- */
- public static function &getInstance()
- {
- static $instance = false;
- if (!$instance) {
- $instance = new self();
- }
- return $instance;
- }
- /*
- * @public function write
- * @param string $module
- * @param string $filename
- */
- public function write($module, $filename) {
- $this->setModule($module);
- $this->setFileName($filename);
- }
- /*
- * @public function render
- * @param null
- */
- public function render() {
- $module = $this->getModule();
- $filename = $this->getFileName();
- $moduleDirname = $module->getVar('mod_dirname');
- $content = $this->getHeaderFilesComments($module, $filename);
- $content .= <<<EOT
-if ( isset(\$template_main) ) {
- \$GLOBALS['xoopsTpl']->display("db:{\$template_main}");
-}
-xoops_cp_footer();
-?>
-EOT;
- $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
Deleted: XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/header.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/header.php 2015-04-28 16:44:18 UTC (rev 13049)
+++ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/header.php 2015-04-28 21:55:41 UTC (rev 13050)
@@ -1,126 +0,0 @@
-<?php
-/*
- You may not change or alter any portion of this comment or credits
- of supporting developers from this source code or any supporting source code
- which is considered copyrighted (c) material of the original comment or credit authors.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- */
-/**
- * tdmcreate module
- *
- * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
- * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
- * @package tdmcreate
- * @since 2.5.0
- * @author Txmod Xoops http://www.txmodxoops.org
- * @version $Id: admin_header.php 12258 2014-01-02 09:33:29Z timgno $
- */
-defined('XOOPS_ROOT_PATH') or die('Restricted access');
-
-class AdminHeader extends TDMCreateFile
-{
- /*
- * @public function constructor
- * @param null
- */
- public function __construct() {
- $this->tdmcfile = TDMCreateFile::getInstance();
- }
- /*
- * @static function &getInstance
- * @param null
- */
- public static function &getInstance()
- {
- static $instance = false;
- if (!$instance) {
- $instance = new self();
- }
- return $instance;
- }
- /*
- * @public function write
- * @param string $module
- * @param mixed $table
- * @param array $tables
- * @param string $filename
- */
- public function write($module, $table, $tables, $filename) {
- $this->setModule($module);
- $this->setTable($table);
- $this->setTables($tables);
- $this->setFileName($filename);
- }
- /*
- * @public function render
- * @param null
- */
- public function render() {
- $module = $this->getModule();
- $table = $this->getTable();
- $tables = $this->getTables();
- $filename = $this->getFileName();
- $moduleDirname = $module->getVar('mod_dirname');
- $ucfModuleDirname = ucfirst($moduleDirname);
- $language = $this->getLanguage('AM');
- $content = $this->getHeaderFilesComments($module, $filename);
- $content .= <<<EOT
-\nrequire_once dirname(dirname(dirname(dirname(__FILE__)))). '/include/cp_header.php';
-\$thisPath = dirname(dirname(__FILE__));
-include_once \$thisPath.'/include/common.php';
-\$sysPathIcon16 = '../' . \$xoopsModule->getInfo('sysicons16');
-\$sysPathIcon32 = '../' . \$xoopsModule->getInfo('sysicons32');
-\$pathModuleAdmin = \$GLOBALS['xoopsModule']->getInfo('dirmoduleadmin');
-//
-\$modPathIcon16 = \$xoopsModule->getInfo('modicons16');
-\$modPathIcon32 = \$xoopsModule->getInfo('modicons32');\n
-EOT;
- if (is_object($table)) {
- if ( $table->getVar('table_name') != '' ) {
- $content .= <<<EOT
-// Get instance of module
-\${$moduleDirname} = {$ucfModuleDirname}Helper::getInstance();\n
-EOT;
- }
- foreach (array_keys($tables) as $t)
- {
- $tableName = $tables[$t]->getVar('table_name');
- $content .= <<<EOT
-// {$tableName}
-\${$tableName}Handler =& \${$moduleDirname}->getHandler('{$tableName}');\n
-EOT;
- }
- }
- $content .=<<<EOT
-//
-\$myts =& MyTextSanitizer::getInstance();
-if (!isset(\$xoopsTpl) || !is_object(\$xoopsTpl)) {
- include_once(XOOPS_ROOT_PATH."/class/template.php");
- \$xoopsTpl = new XoopsTpl();
-}
-// System icons path
-\$xoopsTpl->assign('sysPathIcon16', \$sysPathIcon16);
-\$xoopsTpl->assign('sysPathIcon32', \$sysPathIcon32);
-// Local icons path
-\$xoopsTpl->assign('modPathIcon16', \$modPathIcon16);
-\$xoopsTpl->assign('modPathIcon32', \$modPathIcon32);
-
-//Load languages
-xoops_loadLanguage('admin');
-xoops_loadLanguage('modinfo');
-// Local admin menu class
-if ( file_exists(\$GLOBALS['xoops']->path(\$pathModuleAdmin.'/moduleadmin.php'))){
- include_once \$GLOBALS['xoops']->path(\$pathModuleAdmin.'/moduleadmin.php');
-}else{
- redirect_header("../../../admin.php", 5, _AM_MODULEADMIN_MISSING, false);
-}
-xoops_cp_header();
-\$adminMenu = new ModuleAdmin();
-EOT;
- $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
Deleted: XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/index.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/index.php 2015-04-28 16:44:18 UTC (rev 13049)
+++ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/index.php 2015-04-28 21:55:41 UTC (rev 13050)
@@ -1,114 +0,0 @@
-<?php
-/*
- You may not change or alter any portion of this comment or credits
- of supporting developers from this source code or any supporting source code
- which is considered copyrighted (c) material of the original comment or credit authors.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- */
-/**
- * tdmcreate module
- *
- * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
- * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
- * @package tdmcreate
- * @since 2.5.0
- * @author Txmod Xoops http://www.txmodxoops.org
- * @version $Id: admin_index.php 12258 2014-01-02 09:33:29Z timgno $
- */
-defined('XOOPS_ROOT_PATH') or die('Restricted access');
-
-class AdminIndex extends TDMCreateFile
-{
- /*
- * @public function constructor
- * @param null
- */
- public function __construct() {
- $this->tdmcfile = TDMCreateFile::getInstance();
- }
- /*
- * @static function &getInstance
- * @param null
- */
- public static function &getInstance()
- {
- static $instance = false;
- if (!$instance) {
- $instance = new self();
- }
- return $instance;
- }
- /*
- * @public function write
- * @param string $module
- * @param mixed $tables
- * @param string $filename
- */
- public function write($module, $tables, $filename) {
- $this->setModule($module);
- $this->setTables($tables);
- $this->setFileName($filename);
- }
- /*
- * @public function render
- * @param null
- */
- public function render() {
- $module = $this->getModule();
- $tables = $this->getTables();
- $filename = $this->getFileName();
- $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';
-// Count elements\n
-EOT;
- $tableName = null;
- if(is_array($tables)) {
- foreach (array_keys($tables) as $i)
- {
- $tableName = $tables[$i]->getVar('table_name');
- $content .= <<<EOT
-\$count_{$tableName} = \${$tableName}Handler->getCount();\n
-EOT;
- }
- }
- $content .= <<<EOT
-// Template Index
-\$template_main = '{$moduleDirname}_admin_index.tpl';\n
-EOT;
- if(is_array($tables)) {
- $content .= <<<EOT
-// InfoBox Statistics
-\$adminMenu->addInfoBox({$language}STATISTICS);
-// Info elements\n
-EOT;
- foreach (array_keys($tables) as $i)
- {
- $tableName = $tables[$i]->getVar('table_name');
- $stuTableName = $language_thereare.strtoupper($tableName);
- $content .= <<<EOT
-\$adminMenu->addInfoBoxLine({$language}STATISTICS, '<label>'.{$stuTableName}.'</label>', \$count_{$tableName});\n
-EOT;
- }
- }
- if($tableName == null) {
- $content .= <<<EOT
-\$adminMenu->addInfoBoxLine({$language}STATISTICS, '<label>No statistics</label>', 0);\n
-EOT;
- }
- $content .= <<<EOT
-// Render Index
-echo \$adminMenu->addNavigation('index.php');
-echo \$adminMenu->renderIndex();
-include_once 'footer.php';
-EOT;
- $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
Deleted: XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/menu.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/menu.php 2015-04-28 16:44:18 UTC (rev 13049)
+++ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/menu.php 2015-04-28 21:55:41 UTC (rev 13050)
@@ -1,165 +0,0 @@
-<?php
-/*
- You may not change or alter any portion of this comment or credits
- of supporting developers from this source code or any supporting source code
- which is considered copyrighted (c) material of the original comment or credit authors.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- */
-/**
- * tdmcreate module
- *
- * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
- * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
- * @package tdmcreate
- * @since 2.5.0
- * @author Txmod Xoops http://www.txmodxoops.org
- * @version $Id: admin_menu.php 12258 2014-01-02 09:33:29Z timgno $
- */
-defined('XOOPS_ROOT_PATH') or die('Restricted access');
-
-class AdminMenu extends TDMCreateFile
-{
- /*
- * @public function constructor
- * @param null
- */
- public function __construct() {
- parent::__construct();
- $this->tdmcfile = TDMCreateFile::getInstance();
- }
- /*
- * @static function &getInstance
- * @param null
- */
- public static function &getInstance()
- {
- static $instance = false;
- if (!$instance) {
- $instance = new self();
- }
- return $instance;
- }
- /*
- * @public function write
- * @param string $module
- * @param object $table
- * @param array $tables
- * @param string $filename
- */
- public function write($module, $table, $tables, $filename) {
- $this->setModule($module);
- $this->setTable($table);
- $this->setTables($tables);
- $this->setFileName($filename);
- }
- /*
- * @private function getAdminMenuHeader
- * @param null
- */
- private function getAdminMenuHeader() {
- $ret = <<<EOT
-\$dirname = basename( dirname( dirname( __FILE__ ) ) ) ;
-\$module_handler =& xoops_gethandler('module');
-\$xoopsModule =& XoopsModule::getByDirname(\$dirname);
-\$moduleInfo =& \$module_handler->get(\$xoopsModule->getVar('mid'));
-\$sysPathIcon32 = \$moduleInfo->getInfo('sysicons32');\n
-EOT;
- return $ret;
- }
- /*
- * @private function getAdminMenuDashboard
- * @param string $language
- * @param integer $menu
- */
- private function getAdminMenuDashboard($language, $menu) {
- $ret = <<<EOT
-\$i = 1;
-\$adminmenu[\$i]['title'] = {$language}{$menu};
-\$adminmenu[\$i]['link'] = 'admin/index.php';
-\$adminmenu[\$i]['icon'] = \$sysPathIcon32.'/dashboard.png';
-\$i++;\n
-EOT;
- return $ret;
- }
- /*
- * @private function getAdminMenuImagesPath
- * @param array $tables
- * @param integer $t
- */
- private function getAdminMenuImagesPath($tables, $t) {
- $fields = $this->getTableFields($tables[$t]->getVar('table_id'));
- foreach (array_keys($fields) as $f)
- {
- $fieldElement = $fields[$f]->getVar('field_element');
- switch( $fieldElement ) {
- case 11:
- $ret = <<<EOT
-\$adminmenu[\$i]['icon'] = 'assets/icons/32/{$tables[$t]->getVar('table_image')}';\n
-EOT;
- break;
- default:
- $ret = <<<EOT
-\$adminmenu[\$i]['icon'] = \$sysPathIcon32.'/{$tables[$t]->getVar('table_image')}';\n
-EOT;
- break;
- }
- }
- return $ret;
- }
- /*
- * @public function render
- * @param null
- */
- public function render() {
- $module = $this->getModule();
- $table = $this->getTable();
- $tables = $this->getTables();
- $filename = $this->getFileName();
- $moduleDirname = $module->getVar('mod_dirname');
- $language = $this->getLanguage($moduleDirname, 'MI', 'ADMENU');
- $menu = 1;
- $content = $this->getHeaderFilesComments($module, $filename);
- $content .= $this->getAdminMenuHeader();
- $content .= $this->getAdminMenuDashboard($language, $menu);
- foreach (array_keys($tables) as $t)
- {
- $tablePermissions = $tables[$t]->getVar('table_permissions');
- if ( $tables[$t]->getVar('table_admin') == 1 )
- {
- $menu++;
- $content .= <<<EOT
-\$adminmenu[\$i]['title'] = {$language}{$menu};
-\$adminmenu[\$i]['link'] = 'admin/{$tables[$t]->getVar('table_name')}.php';
-\$adminmenu[\$i]['icon'] = 'assets/icons/32/{$tables[$t]->getVar('table_image')}';\n
-EOT;
- //$content .= $this->getAdminMenuImagesPath($tables, $t);
- $content .= <<<EOT
-\$i++;\n
-EOT;
- }
- }
- if (is_object($table) && $table->getVar('table_permissions') == 1) {
- $menu++;
- $content .= <<<EOT
-\$adminmenu[\$i]['title'] = {$language}{$menu};
-\$adminmenu[\$i]['link'] = 'admin/permissions.php';
-\$adminmenu[\$i]['icon'] = \$sysPathIcon32.'/permissions.png';
-\$i++;\n
-EOT;
- }
- $menu++;
- $content .= <<<EOT
-\$adminmenu[\$i]['title'] = {$language}{$menu};
-\$adminmenu[\$i]['link'] = 'admin/about.php';
-\$adminmenu[\$i]['icon'] = \$sysPathIcon32.'/about.png';
-unset( \$i );
-EOT;
- unset( $menu );
-
- $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
Deleted: XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/objects.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/objects.php 2015-04-28 16:44:18 UTC (rev 13049)
+++ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/objects.php 2015-04-28 21:55:41 UTC (rev 13050)
@@ -1,246 +0,0 @@
-<?php
-/*
- You may not change or alter any portion of this comment or credits
- of supporting developers from this source code or any supporting source code
- which is considered copyrighted (c) material of the original comment or credit authors.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- */
-/**
- * tdmcreate module
- *
- * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
- * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
- * @package tdmcreate
- * @since 2.5.0
- * @author Txmod Xoops http://www.txmodxoops.org
- * @version $Id: admin_objects.php 12258 2014-01-02 09:33:29Z timgno $
- */
-defined('XOOPS_ROOT_PATH') or die('Restricted access');
-
-class AdminObjects
-{
- /*
- * @static function &getInstance
- * @param null
- */
- public static function &getInstance()
- {
- static $instance = false;
- if (!$instance) {
- $instance = new self();
- }
- return $instance;
- }
- /*
- * @public function getSimpleSetVar
- * @param string $tableName
- * @param string $fieldName
- */
- public function getSimpleSetVar($tableName, $fieldName) {
- $ret = <<<EOT
- // Set Var {$fieldName}
- \${$tableName}Obj->setVar('{$fieldName}', \$_POST['{$fieldName}']);\n
-EOT;
- return $ret;
- }
- /*
- * @public function getTextDateSelectSetVar
- * @param string $tableName
- * @param string $fieldName
- */
- public function getTextDateSelectSetVar($tableName, $fieldName) {
- $ret = <<<EOT
- // Set Var {$fieldName}
- \${$tableName}Obj->setVar('{$fieldName}', strtotime(\$_POST['{$fieldName}']));\n
-EOT;
- return $ret;
- }
- /*
- * @public function getCheckBoxOrRadioYNSetVar
- * @param string $tableName
- * @param string $fieldName
- */
- public function getCheckBoxOrRadioYNSetVar($tableName, $fieldName) {
- $ret = <<<EOT
- // Set Var {$fieldName}
- \${$tableName}Obj->setVar('{$fieldName}', ((\$_REQUEST['{$fieldName}'] == 1) ? '1' : '0'));\n
-EOT;
- return $ret;
- }
- /*
- * @public function getImageListSetVar
- * @param string $moduleDirname
- * @param string $tableName
- * @param string $fieldName
- */
- public function getImageListSetVar($moduleDirname, $tableName, $fieldName) {
- $ret = <<<EOT
- // Set Var {$fieldName}
- 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 getUploadImageSetVar
- * @param string $moduleDirname
- * @param string $tableName
- * @param string $fieldName
- */
- public function getUploadImageSetVar($moduleDirname, $tableName, $fieldName) {
- $stuModuleDirname = strtoupper($moduleDirname);
- $ret = <<<EOT
- // Set Var {$fieldName}
- include_once XOOPS_ROOT_PATH.'/class/uploader.php';
- \$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('{$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 getUploadFileSetVar
- * @param string $moduleDirname
- * @param string $tableName
- * @param string $fieldName
- */
- public function getUploadFileSetVar($moduleDirname, $tableName, $fieldName) {
- $stuModuleDirname = strtoupper($moduleDirname);
- $ret = <<<EOT
- // Set Var {$fieldName}
- include_once XOOPS_ROOT_PATH.'/class/uploader.php';
- \$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('{$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());
- }
- }\n
-EOT;
- return $ret;
- }
- /*
- * @public function getSimpleGetVar
- * @param string $lpFieldName
- * @param string $rpFieldName
- * @param string $tableName
- * @param string $fieldName
- */
- public function getSimpleGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) {
- $ret = <<<EOT
-\t\t\t\t// Get Var {$fieldName}
-\t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = \${$tableName}_arr[\$i]->getVar('{$fieldName}');\n
-EOT;
- return $ret;
- }
- /*
- * @public function getTopicGetVar
- * @param string $lpFieldName
- * @param string $rpFieldName
- * @param string $tableName
- * @param string $tableNameTopic
- * @param string $fieldNameParent
- * @param string $fieldNameTopic
- */
- public function getTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableNameTopic, $fieldNameParent, $fieldNameTopic) {
- $ret = <<<EOT
-\t\t\t\t// Get Var {$fieldNameParent}
-\t\t\t\t\${$rpFieldName} =& \${$tableNameTopic}Handler->get(\${$tableName}_arr[\$i]->getVar('{$fieldNameParent}'));
-\t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = \${$rpFieldName}->getVar('{$fieldNameTopic}');\n
-EOT;
- return $ret;
- }
- /*
- * @public function getUploadImageGetVar
- * @param string $lpFieldName
- * @param string $rpFieldName
- * @param string $tableName
- * @param string $fieldName
- */
- public function getUploadImageGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) {
- $ret = <<<EOT
-\t\t\t\t// Get Var {$fieldName}
-\t\t\t\t\${$fieldName} = \${$tableName}_arr[\$i]->getVar('{$fieldName}');
-\t\t\t\t\$upload_image = \${$fieldName} ? \${$fieldName} : 'blank.gif';
-\t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = \$upload_image;\n
-EOT;
- return $ret;
- }
- /*
- * @public function getTextAreaGetVar
- * @param string $lpFieldName
- * @param string $rpFieldName
- * @param string $tableName
- * @param string $fieldName
- */
- public function getTextAreaGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) {
- $ret = <<<EOT
-\t\t\t\t// Get Var {$fieldName}
-\t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = strip_tags(\${$tableName}_arr[\$i]->getVar('{$fieldName}'));\n
-EOT;
- return $ret;
- }
- /*
- * @public function getSelectUserGetVar
- * @param string $lpFieldName
- * @param string $rpFieldName
- * @param string $tableName
- * @param string $fieldName
- */
- public function getSelectUserGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) {
- $ret = <<<EOT
-\t\t\t\t// Get Var {$fieldName}
-\t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = XoopsUser::getUnameFromId(\${$tableName}_arr[\$i]->getVar('{$fieldName}'), 's');\n
-EOT;
- return $ret;
- }
- /*
- * @public function getTextDateSelectGetVar
- * @param string $lpFieldName
- * @param string $rpFieldName
- * @param string $tableName
- * @param string $fieldName
- */
- public function getTextDateSelectGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) {
- $ret = <<<EOT
-\t\t\t\t// Get Var {$fieldName}
-\t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = formatTimeStamp(\${$tableName}_arr[\$i]->getVar('{$fieldName}'), 's');\n
-EOT;
- return $ret;
- }
-}
\ No newline at end of file
Deleted: XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/pages.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/pages.php 2015-04-28 16:44:18 UTC (rev 13049)
+++ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/pages.php 2015-04-28 21:55:41 UTC (rev 13050)
@@ -1,380 +0,0 @@
-<?php
-/*
- You may not change or alter any portion of this comment or credits
- of supporting developers from this source code or any supporting source code
- which is considered copyrighted (c) material of the original comment or credit authors.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- */
-/**
- * tdmcreate module
- *
- * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
- * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
- * @package tdmcreate
- * @since 2.5.0
- * @author Txmod Xoops http://www.txmodxoops.org
- * @version $Id: pages.php 12258 2014-01-02 09:33:29Z timgno $
- */
-defined('XOOPS_ROOT_PATH') or die('Restricted access');
-require_once 'objects.php';
-class AdminPages extends TDMCreateFile
-{
- /*
- * @var string
- */
- private $adminobjects = null;
- /*
- * @public function constructor
- * @param null
- */
- public function __construct() {
- parent::__construct();
- $this->adminobjects = AdminObjects::getInstance();
- $this->tdmcfile = TDMCreateFile::getInstance();
- }
- /*
- * @static function &getInstance
- * @param null
- */
- public static function &getInstance()
- {
- static $instance = false;
- if (!$instance) {
- $instance = new self();
- }
- return $instance;
- }
- /*
- * @public function write
- * @param string $module
- * @param string $table
- */
- public function write($module, $table) {
- $this->setModule($module);
- $this->setTable($table);
- }
- /*
- * @public function getAdminPagesHeader
- * @param string $moduleDirname
- * @param string $tableName
- */
- public function getAdminPagesHeader($moduleDirname, $table, $fpif) {
-
- $ret = <<<EOT
-include_once 'header.php';
-//It recovered the value of argument op in URL$
-\$op = XoopsRequest::getString('op', 'list');
-// Request {$fpif}
-\${$fpif} = XoopsRequest::getInt('{$fpif}');
-// Switch options
-switch (\$op)
-{\n
-EOT;
- return $ret;
- }
-
- /*
- * @public function getAdminPagesList
- * @param string $moduleDirname
- * @param string $table
- * @param string $tableFieldname
- * @param string $language
- * @param string $fields
- * @param string $fpif
- * @param string $fpmf
- */
- public function getAdminPagesList($moduleDirname, $table, $tableFieldname, $language, $fields, $fpif, $fpmf) {
- $stuModuleDirname = strtoupper($moduleDirname);
- $tableName = $table->getVar('table_name');
- $tableAutoincrement = $table->getVar('table_autoincrement');
- $stuTableName = strtoupper($tableName);
- $stuTableFieldname = strtoupper($tableFieldname);
- $ret = <<<EOT
- case 'list':
- default:
- \$start = XoopsRequest::getInt('start', 0);
- \$limit = XoopsRequest::getInt('limit', \${$moduleDirname}->getConfig('adminpager'));
- \$template_main = '{$moduleDirname}_admin_{$tableName}.tpl';
- \$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('{$tableName}.php'));
- \$adminMenu->addItemButton({$language}ADD_{$stuTableFieldname}, '{$tableName}.php?op=new', 'add');
- \$GLOBALS['xoopsTpl']->assign('buttons', \$adminMenu->renderButton());
- \$criteria = new CriteriaCompo();
- \$criteria->setSort('{$fpif} ASC, {$fpmf}');
- \$criteria->setOrder('ASC');
- \${$tableName}_rows = \${$tableName}Handler->getCount(\$criteria);
- \${$tableName}_arr = \${$tableName}Handler->getAll(\$criteria);
- unset(\$criteria);
- \$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_url', {$stuModuleDirname}_URL);
- \$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_upload_url', {$stuModuleDirname}_UPLOAD_URL);
- // Table view
- if (\${$tableName}_rows > 0)
- {
- foreach (array_keys(\${$tableName}_arr) as \$i)
- {\n
-EOT;
- foreach(array_keys($fields) as $f)
- {
- $fieldName = $fields[$f]->getVar('field_name');
- $fieldParent = $fields[$f]->getVar('field_parent');
- // Verify if table_fieldname is not empty
- $lpFieldName = !empty($tableFieldname) ? substr($fieldName, 0, strpos($fieldName, '_')) : $tableName;
- $rpFieldName = $this->tdmcfile->getRightString($fieldName);
- //
- $fieldElement = $fields[$f]->getVar('field_element');
- if( ($fields[$f]->getVar('field_admin') == 1) || ($tableAutoincrement == 1) ) {
- switch($fieldElement) {
- case 3:
- case 4:
- $ret .= $this->adminobjects->getTextAreaGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName);
- break;
- case 8:
- $ret .= $this->adminobjects->getSelectUserGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName);
- break;
- case 11:
- $ret .= $this->adminobjects->getUploadImageGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName);
- break;
- case 13:
- $ret .= $this->adminobjects->getTextDateSelectGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName);
- break;
- default:
- if( ($fieldParent == 1) && !$table->getVar('table_category') ) {
- if($fieldElement > 13) {
- $fieldElements = $this->tdmcreate->getHandler('fieldelements')->get($fieldElement);
- $fieldElementTid = $fieldElements->getVar('fieldelement_tid');
- $fieldElementName = $fieldElements->getVar('fieldelement_name');
- $rpFieldElementName = strtolower(str_replace('Table : ', '', $fieldElementName));
- }
- //
- $fieldNameParent = $fieldName;
- //
- $criteriaFieldsTopic = new CriteriaCompo();
- $criteriaFieldsTopic->add(new Criteria('field_tid', $fieldElementTid));
- $fieldsTopic = $this->tdmcreate->getHandler('fields')->getObjects($criteriaFieldsTopic);
- unset($criteriaFieldsTopic);
- foreach(array_keys($fieldsTopic) as $ft)
- {
- if( $fieldsTopic[$ft]->getVar('field_main') == 1 ) {
- $fieldNameTopic = $fieldsTopic[$ft]->getVar('field_name');
- }
- }
- $ret .= $this->adminobjects->getTopicGetVar($lpFieldName, $rpFieldName, $tableName, $rpFieldElementName, $fieldNameParent, $fieldNameTopic);
- } else {
- $ret .= $this->adminobjects->getSimpleGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName);
- }
- break;
- }
- }
- }
- $ret .= <<<EOT
- \$GLOBALS['xoopsTpl']->append('{$tableName}_list', \${$lpFieldName});
- unset(\${$lpFieldName});
- }\n
-EOT;
- $ret .= <<<EOT
- if ( \${$tableName}_rows > \$limit ) {
- include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
- \$pagenav = new XoopsPageNav(\${$tableName}_rows, \$limit, \$start, 'start', 'op=list&limit=' . \$limit);
- \$GLOBALS['xoopsTpl']->assign('pagenav', \$pagenav->renderNav(4));
- }
- } else {
- \$GLOBALS['xoopsTpl']->assign('error', {$language}THEREARENT_{$stuTableName});
- }
- break;\n
-EOT;
- return $ret;
- }
-
- /*
- * @public function getAdminPagesNew
- * @param string $moduleDirname
- * @param string $tableName
- * @param string $language
- */
- public function getAdminPagesNew($moduleDirname, $tableName, $language) {
- $stuTableName = strtoupper($tableName);
- $ret = <<<EOT
- case 'new':
- \$template_main = '{$moduleDirname}_admin_{$tableName}.tpl';
- \$adminMenu->addItemButton({$language}{$stuTableName}_LIST, '{$tableName}.php', 'list');
- \$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('{$tableName}.php'));
- \$GLOBALS['xoopsTpl']->assign('buttons', \$adminMenu->renderButton());
- // Get Form
- \${$tableName}Obj =& \${$tableName}Handler->create();
- \$form = \${$tableName}Obj->getForm();
- \$GLOBALS['xoopsTpl']->assign('form', \$form->render());
- break;\n
-EOT;
- return $ret;
- }
-
- /*
- * @public function getAdminPagesSave
- * @param string $moduleDirname
- * @param string $tableName
- * @param string $language
- * @param string $fields
- * @param string $fpif
- * @param string $fpmf
- */
- public function getAdminPagesSave($moduleDirname, $tableName, $language, $fields, $fpif, $fpmf)
- {
- $ret = <<<EOT
- case 'save':
- if ( !\$GLOBALS['xoopsSecurity']->check() ) {
- redirect_header('{$tableName}.php', 3, implode(',', \$GLOBALS['xoopsSecurity']->getErrors()));
- }
- if (isset(\${$fpif})) {
- \${$tableName}Obj =& \${$tableName}Handler->get(\${$fpif});
- } else {
- \${$tableName}Obj =& \${$tableName}Handler->create();
- }
- // Set Vars\n
-EOT;
- foreach (array_keys($fields) as $f)
- {
- $fieldName = $fields[$f]->getVar('field_name');
- $fieldElement = $fields[$f]->getVar('field_element');
- if($f > 0) { // If we want to hide field id
- switch($fieldElement) {
- case 5:
- case 6:
- $ret .= $this->adminobjects->getCheckBoxOrRadioYNSetVar($tableName, $fieldName);
- break;
- case 10:
- $ret .= $this->adminobjects->getImageListSetVar($moduleDirname, $tableName, $fieldName);
- break;
- case 11:
- $ret .= $this->adminobjects->getUploadImageSetVar($moduleDirname, $tableName, $fieldName);
- break;
- case 12:
- $ret .= $this->adminobjects->getUploadFileSetVar($moduleDirname, $tableName, $fieldName);
- break;
- case 13:
- $ret .= $this->adminobjects->getTextDateSelectSetVar($tableName, $fieldName);
- break;
- default:
- $ret .= $this->adminobjects->getSimpleSetVar($tableName, $fieldName);
- break;
- }
- }
- }
-
- $ret .= <<<EOT
- // Insert Data
- if (\${$tableName}Handler->insert(\${$tableName}Obj)) {
- redirect_header('{$tableName}.php?op=list', 2, {$language}FORMOK);
- }
- // Get Form
- \$GLOBALS['xoopsTpl']->assign('error', \${$tableName}Obj->getHtmlErrors());
- \$form =& \${$tableName}Obj->getForm();
- \$GLOBALS['xoopsTpl']->assign('form', \$form->render());
- break;\n
-EOT;
- return $ret;
- }
-
- /*
- * @public function getAdminPagesEdit
- * @param string $moduleDirname
- * @param string $tableName
- * @param string $tableFieldname
- * @param string $language
- * @param string $fpif
- */
- public function getAdminPagesEdit($moduleDirname, $tableName, $tableFieldname, $language, $fpif) {
- $stuTableName = strtoupper($tableName);
- $stuTableFieldname = strtoupper($tableFieldname);
- $ret = <<<EOT
- case 'edit':
- \$template_main = '{$moduleDirname}_admin_{$tableName}.tpl';
- \$adminMenu->addItemButton({$language}ADD_{$stuTableFieldname}, '{$tableName}.php?op=new', 'add');
- \$adminMenu->addItemButton({$language}{$stuTableName}_LIST, '{$tableName}.php', 'list');
- \$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('{$tableName}.php'));
- \$GLOBALS['xoopsTpl']->assign('buttons', \$adminMenu->renderButton());
- // Get Form
- \${$tableName}Obj = \${$tableName}Handler->get(\${$fpif});
- \$form = \${$tableName}Obj->getForm();
- \$GLOBALS['xoopsTpl']->assign('form', \$form->render());
- break;\n
-EOT;
- return $ret;
- }
-
- /*
- * @public function getAdminPagesDelete
- * @param string $tableName
- * @param string $language
- */
- public function getAdminPagesDelete($tableName, $language, $fpif, $fpmf) {
-
- $ret = <<<EOT
- case 'delete':
- \${$tableName}Obj =& \${$tableName}Handler->get(\${$fpif});
- if (isset(\$_REQUEST['ok']) && \$_REQUEST['ok'] == 1) {
- if ( !\$GLOBALS['xoopsSecurity']->check() ) {
- redirect_header('{$tableName}.php', 3, implode(', ', \$GLOBALS['xoopsSecurity']->getErrors()));
- }
- if (\${$tableName}Handler->delete(\${$tableName}Obj)) {
- redirect_header('{$tableName}.php', 3, {$language}FORMDELOK);
- } else {
- echo \${$tableName}Obj->getHtmlErrors();
- }
- } else {
- xoops_confirm(array('ok' => 1, '{$fpif}' => \${$fpif}, 'op' => 'delete'), \$_SERVER['REQUEST_URI'], sprintf({$language}FORMSUREDEL, \${$tableName}Obj->getVar('{$fpmf}')));
- }
- break;\n
-EOT;
- return $ret;
- }
-
- /*
- * @public function getAdminPagesFooter
- * @param null
- */
- public function getAdminPagesFooter() {
- $ret = <<<EOT
-}
-include_once 'footer.php';
-EOT;
- return $ret;
- }
-
- /*
- * @public function render
- * @param null
- */
- public function renderFile($filename)
- {
- $module = $this->getModule();
- $table = $this->getTable();
- $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)
- {
- $fieldName = $fields[$f]->getVar('field_name');
- if($f == 0) {
- $fpif = $fieldName;
- }
- if($fields[$f]->getVar('field_main') == 1) {
- $fpmf = $fieldName;
- }
- }
- $content = $this->getHeaderFilesComments($module, $filename);
- $content .= $this->getAdminPagesHeader($moduleDirname, $tableName, $fpif);
- $content .= $this->getAdminPagesList($moduleDirname, $table, $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($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
- return $this->tdmcfile->renderFile();
- }
-}
\ No newline at end of file
Deleted: XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/permissions.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/permissions.php 2015-04-28 16:44:18 UTC (rev 13049)
+++ XoopsModules/TDMCreate/branches/timgno/1.91a2/tdmcreate/class/files/admin/permissions.php 2015-04-28 21:55:41 UTC (rev 13050)
@@ -1,222 +0,0 @@
-<?php
-/*
- You may not change or alter any portion of this comment or credits
- of supporting developers from this source code or any supporting source code
- which is considered copyrighted (c) material of the original comment or credit authors.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- */
-/**
- * tdmcreate module
- *
- * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
- * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
- * @package tdmcreate
- * @since 2.5.0
- * @author Txmod Xoops http://www.txmodxoops.org
- * @version $Id: admin_permissions.php 12258 2014-01-02 09:33:29Z timgno $
- */
-defined('XOOPS_ROOT_PATH') or die('Restricted access');
-
-class AdminPermissions extends TDMCreateFile
-{
- /*
- * @public function constructor
- * @param null
- */
- public function __construct() {
- parent::__construct();
- $this->tdmcfile = TDMCreateFile::getInstance();
- }
- /*
- * @static function &getInstance
- * @param null
- */
- public static function &getInstance()
- {
- static $instance = false;
- if (!$instance) {
- $instance = new self();
- }
- return $instance;
- }
- /*
- * @public function write
- * @param string $module
- * @param mixed $tables
- * @param string $filename
- */
- public function write($module, $tables, $filename) {
- $this->setModule($module);
- $this->setTables($tables);
- $this->setFileName($filename);
- }
- /*
- * @private function getPermissionsCodeHeader
- * @param string $moduleDirname
- * @param string $language
- */
- private function getPermissionsCodeHeader($moduleDirname, $language)
- {
- $ret = <<<PRM
-\ninclude_once 'header.php';
-include_once XOOPS_ROOT_PATH.'/class/xoopsform/grouppermform.php';
-if( !empty(\$_POST['submit']) )
-{
- redirect_header( XOOPS_URL.'/modules/'.\$xoopsModule->dirname().'/admin/permissions.php', 1, _MP_GPERMUPDATED );
-}
-// Check admin have access to this page
-/*\$group = \$xoopsUser->getGroups ();
-\$groups = xoops_getModuleOption ( 'admin_groups', \$thisDirname );
-if (count ( array_intersect ( \$group, \$groups ) ) <= 0) {
- redirect_header ( 'index.php', 3, _NOPERM );
-}*/
-\$template_main = '{$moduleDirname}_admin_permissions.tpl';
-echo \$adminMenu->addNavigation('permissions.php');
-
-\$permission = {$moduleDirname}_CleanVars(\$_REQUEST, 'permission', 1, 'int');
-\$selected = array('', '', '', '');
-\$selected[\$permission-1] = ' selected';
-xoops_load('XoopsFormLoader');
-\$permTableForm = new XoopsSimpleForm('', 'fselperm', 'permissions.php', 'get');
-\$formSelect = new XoopsFormSelect('', 'permission', \$permission);
-\$formSelect->setExtra('onchange="document.forms.fselperm.submit()"');
-\$formSelect->addOption(\$selected[0], {$language}GLOBAL);
-\$formSelect->addOption(\$selected[1], {$language}APPROVE);
-\$formSelect->addOption(\$selected[2], {$language}SUBMIT);
-\$formSelect->addOption(\$selected[3], {$language}VIEW);
-\$permTableForm->addElement(\$formSelect);
-\$permTableForm->display();\n\n
-PRM;
- return $ret;
- }
-
- /*
- * @private function getPermissionsCodeSwitch
- * @param string $moduleDirname
- * @param string $language
- */
- private function getPermissionsCodeSwitch($moduleDirname, $language)
- {
- $ret = <<<PRM
-\$module_id = \$xoopsModule->getVar('mid');
-switch(\$permission)
-{
- case 1:
- \$formTitle = {$language}GLOBAL;
- \$permName = '{$moduleDirname}_ac';
- \$permDesc = {$language}GLOBAL_DESC;
- \$globalPerms = array( '4' => {$language}GLOBAL_4,
- '8' => {$language}GLOBAL_8,
- '16' => {$language}GLOBAL_16 );
- break;
- case 2:
- \$formTitle = {$language}APPROVE;
- \$permName = '{$moduleDirname}_access';
- \$permDesc = {$language}APPROVE_DESC;
- break;
- case 3:
- \$formTitle = {$language}SUBMIT;
- \$permName = '{$moduleDirname}_submit';
- \$permDesc = {$language}SUBMIT_DESC;
- break;
- case 4:
- \$formTitle = {$language}VIEW;
- \$permName = '{$moduleDirname}_view';
- \$permDesc = {$language}VIEW_DESC;
- break;
-}\n
-PRM;
- return $ret;
- }
-
- /*
- * @private function getPermissionsCodeBody
- * @param string $moduleDirname
- * @param string $tableName
- * @param string $language
- */
- private function getPermissionsCodeBody($moduleDirname, $language)
- {
- $tables = $this->getTables();
- foreach(array_keys($tables) as $t)
- {
- $tableId = $tables[$t]->getVar('table_id');
- if($tables[$t]->getVar('table_permissions') == 1) {
- $tableName = $tables[$t]->getVar('table_name');
- }
- }
- $fields = $this->getTableFields($tableId);
- foreach(array_keys($fields) as $f)
- {
- if($f == 0) {
- $fpif = $fields[$f]->getVar('field_name');
- }
- if($fields[$f]->getVar('field_main') == 1) {
- $fpmf = $fields[$f]->getVar('field_name');
- }
- }
- $ret = <<<PRM
-\$permform = new XoopsGroupPermForm(\$formTitle, \$module_id, \$permName, \$permDesc, 'admin/permissions.php');
-if (\$permission == 1) {
- foreach (\$globalPerms as \$perm_id => \$perm_name) {
- \$permform->addItem(\$perm_id, \$perm_name);
- }
- echo \$permform->render();
- echo '<br /><br />';
-} else {
- \$criteria = new CriteriaCompo();
- \$criteria->setSort('{$fpmf}');
- \$criteria->setOrder('ASC');
- \${$tableName}_count = \${$tableName}Handler->getCount(\$criteria);
- \${$tableName}_arr = \${$tableName}Handler->getObjects(\$criteria);
- unset(\$criteria);
- foreach (array_keys(\${$tableName}_arr) as \$i) {
- \$permform->addItem(\${$tableName}_arr[\$i]->getVar('{$fpif}'), \${$tableName}_arr[\$i]->getVar('{$fpmf}'));
- }
- // 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 ( '{$tableName}.php?op=new', 3, {$language}NOPERMSSET );
- exit ();
- }\n
-PRM;
- return $ret;
- }
-
- /*
- * @private function getPermissionsCodeFooter
- * @param null
- */
- private function getPermissionsCodeFooter() {
- $ret = <<<PRM
-}
-unset(\$permform);
-include_once 'footer.php';
-PRM;
- return $ret;
- }
-
- /*
- * @public function render
- * @param null
- */
- public function render() {
- $module = $this->getModule();
- $filename = $this->getFileName();
- $moduleDirname = $module->getVar('mod_dirname');
- $language = $this->getLanguage($moduleDirname, 'AM');
- $content = $this->getHeaderFilesComments($module, $filename);
- $content .= $this->getPermissionsCodeHeader($moduleDirname, $language);
- $content .= $this->getPermissionsCodeSwitch($moduleDirname, $language);
- $content .= $this->getPermissionsCodeBody($moduleDirname, $language);
- ...
[truncated message content] |