From: <txm...@us...> - 2015-06-13 14:20:15
|
Revision: 13088 http://sourceforge.net/p/xoops/svn/13088 Author: txmodxoops Date: 2015-06-13 14:20:13 +0000 (Sat, 13 Jun 2015) Log Message: ----------- Fix Refacoring More Files Updated Modified Paths: -------------- XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/assets/css/admin/style.css XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/TDMCreateArchitecture.php XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/TDMCreateTableFields.php XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/admin/AdminMenu.php XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/language/LanguageModinfo.php XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/templates/admin/TemplatesAdminPages.php XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/templates/user/TemplatesUserIndex.php Added Paths: ----------- XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/TDMCreateMoreFiles.php Removed Paths: ------------- XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/templates/TDMCreateHtmlSmartyCodes.php XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/templates/user/TemplatesUserMoreFiles.php Modified: XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/assets/css/admin/style.css =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/assets/css/admin/style.css 2015-06-12 21:33:08 UTC (rev 13087) +++ XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/assets/css/admin/style.css 2015-06-13 14:20:13 UTC (rev 13088) @@ -95,6 +95,14 @@ min-width: 80px; } +tr.files td { + margin: 0; + padding: 5px; + border-bottom: 1px solid #ccc; + background-color:rgba(100,110,80,0.3); + vertical-align: middle; +} + /*#show_rows { margin: 0; padding: 0; width: 60%; } #sortable tr { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1.1em; height: 16px; }*/ Modified: XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/TDMCreateArchitecture.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/TDMCreateArchitecture.php 2015-06-12 21:33:08 UTC (rev 13087) +++ XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/TDMCreateArchitecture.php 2015-06-13 14:20:13 UTC (rev 13088) @@ -216,10 +216,11 @@ $moduleDirname = $module->getVar('mod_dirname'); $icon32 = 'assets/icons/32'; $tables = $this->tdmcfile->getTableTables($modId); + $files = $this->tdmcfile->getTableMoreFiles($modId); $ret = array(); // $table = array(); - foreach (array_keys($tables) as $t) { + foreach(array_keys($tables) as $t) { $tableMid = $tables[$t]->getVar('table_mid'); $tableId = $tables[$t]->getVar('table_id'); $tableName = $tables[$t]->getVar('table_name'); @@ -283,7 +284,17 @@ $userTemplatesPagesList->write($module, $table); $ret[] = $userTemplatesPagesList->renderFile($moduleDirname . '_' . $tableName . '_list' . '.tpl'); } - } + + } + foreach(array_keys($files) as $t) { + $fileName = $files[$t]->getVar('file_name'); + $fileExtension = $files[$t]->getVar('file_extension'); + $fileInfolder = $files[$t]->getVar('file_infolder'); + // More File + $moreFiles = TDMCreateMoreFiles::getInstance(); + $moreFiles->write($module, $fileName, $fileInfolder, $fileExtension); + $ret[] = $moreFiles->render(); + } // Language Modinfo File $languageModinfo = LanguageModinfo::getInstance(); $languageModinfo->write($module, $table, $tables, 'modinfo.php'); Added: XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/TDMCreateMoreFiles.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/TDMCreateMoreFiles.php (rev 0) +++ XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/TDMCreateMoreFiles.php 2015-06-13 14:20:13 UTC (rev 13088) @@ -0,0 +1,251 @@ +<?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: TDMCreateMoreFiles.php 12258 2014-01-02 09:33:29Z timgno $ + */ +defined('XOOPS_ROOT_PATH') or die('Restricted access'); +/** + * Class TDMCreateMoreFiles + */ +class TDMCreateMoreFiles extends TDMCreateFile +{ + // + private $folder; + // + private $extension; + /* + * @public function constructor + * @param null + */ + /** + * + */ + public function __construct() + { + parent::__construct(); + $this->tdmcfile = TDMCreateFile::getInstance(); + } + + /* + * @static function &getInstance + * @param null + */ + /** + * @return TDMCreateMoreFiles + */ + public static function &getInstance() + { + static $instance = false; + if (!$instance) { + $instance = new self(); + } + + return $instance; + } + + /* + * @public function write + * @param string $module + * @param string $filename + */ + /** + * @param $module + * @param $filename + * @return string + */ + public function write($module, $filename, $folder, $extension) + { + $this->setModule($module); + $this->extension = $extension; + $this->setFileName($filename . '.' . $extension); + if(strstr($folder, 'user')){ + $this->folder = '/'; + } else { + $this->folder = $folder; + } + } + + /* + * @private function getMoreFilesFilePhp + * @param $header + */ + /** + * @param $header + * @return string + */ + private function getMoreFilesFilePhp($header) + { + $ret = <<<EOT +<?php +{$header}\n +EOT; + + return $ret; + } + + /* + * @private function getMoreFilesFileTpl + * @param $header + */ + /** + * @param $header + * @return string + */ + private function getMoreFilesFileTpl() + { + $ret = <<<EOT +<div class="panel"> + Pleace! put your template code here +</div>\n +EOT; + + return $ret; + } + + /* + * @private function getMoreFilesFileHtml + * @param $header + */ + /** + * @param $header + * @return string + */ + private function getMoreFilesFileHtml() + { + $ret = <<<EOT +<div class="panel"> + Pleace! put your Html code here +</div>\n +EOT; + + return $ret; + } + + /* + * @private function getMoreFilesFileText + * @param null + */ + /** + * @param null + * @return string + */ + private function getMoreFilesFileText() + { + $ret = <<<EOT +Pleace! put your text code here\n +EOT; + + return $ret; + } + + /* + * @private function getMoreFilesFileSql + * @param null + */ + /** + * @param null + * @return string + */ + private function getMoreFilesFileSql() + { + $ret = <<<EOT +Pleace! put your sql code here\n +EOT; + + return $ret; + } + + /* + * @private function getMoreFilesFileCss + * @param $header + */ + /** + * @param $header + * @return string + */ + private function getMoreFilesFileCss($header) + { + $ret = <<<EOT +@charset "UTF-8"; +{$header}\n\nPleace! put your sql code here\n +EOT; + + return $ret; + } + + /* + * @private function getMoreFilesFileDefault + * @param null + */ + /** + * @param null + * @return string + */ + private function getMoreFilesFileDefault() + { + $ret = <<<EOT +\n +EOT; + + return $ret; + } + + /* + * @public function renderFile + * @param string $filename + */ + /** + * @param $filename + * @return bool|string + */ + public function renderFile() + { + $module = $this->getModule(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $header = $this->getHeaderFilesComments($module, $filename, 0); + switch($this->extension) { + case 'php': + $content = $this->getMoreFilesFilePhp($header); + break; + case 'tpl': + $content = $this->getMoreFilesFileTpl(); + break; + case 'html': + $content = $this->getMoreFilesFileHtml(); + break; + case 'text': + $content = $this->getMoreFilesFileText(); + break; + case 'sql': + $content = $this->getMoreFilesFileSql(); + break; + case 'css': + $content = $this->getMoreFilesFileCss($header); + break; + default: + $content = $this->getMoreFilesFileDefault(); + break; + } + + // + $this->tdmcfile->create($moduleDirname, $this->folder, $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + + return $this->tdmcfile->renderFile(); + } +} Modified: XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/TDMCreateTableFields.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/TDMCreateTableFields.php 2015-06-12 21:33:08 UTC (rev 13087) +++ XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/TDMCreateTableFields.php 2015-06-13 14:20:13 UTC (rev 13088) @@ -108,4 +108,21 @@ return $fieldElements; } + + /** + * @public function getTableMoreFiles + * @param $mId + * @return mixed + */ + public function getTableMoreFiles($mId, $sort = 'file_id ASC, file_name', $order = 'ASC') + { + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('file_mid', $mId)); // $mId = module Id + $criteria->setSort($sort); + $criteria->setOrder($order); + $morefiles = $this->tdmcreate->getHandler('morefiles')->getObjects($criteria); + unset($criteria); + + return $morefiles; + } } Modified: XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/admin/AdminMenu.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/admin/AdminMenu.php 2015-06-12 21:33:08 UTC (rev 13087) +++ XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/admin/AdminMenu.php 2015-06-13 14:20:13 UTC (rev 13088) @@ -170,7 +170,7 @@ $content = $this->getHeaderFilesComments($module, $filename); $content .= $this->getAdminMenuHeader(); $content .= $this->getAdminMenuDashboard($language, $menu); - $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order ASC, table_name'); + $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); foreach (array_keys($tables) as $t) { $tablePermissions = $tables[$t]->getVar('table_permissions'); if (1 == $tables[$t]->getVar('table_admin')) { Modified: XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/language/LanguageModinfo.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/language/LanguageModinfo.php 2015-06-12 21:33:08 UTC (rev 13087) +++ XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/language/LanguageModinfo.php 2015-06-13 14:20:13 UTC (rev 13088) @@ -106,7 +106,7 @@ */ private function getLanguageMenu($module, $language, $table) { - $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order ASC, table_name'); + $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); $menu = 1; $ret = $this->defines->getAboveHeadDefines('Admin Menu'); $ret .= $this->defines->getDefine($language, "ADMENU{$menu}", "Dashboard"); Deleted: XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/templates/TDMCreateHtmlSmartyCodes.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/templates/TDMCreateHtmlSmartyCodes.php 2015-06-12 21:33:08 UTC (rev 13087) +++ XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/templates/TDMCreateHtmlSmartyCodes.php 2015-06-13 14:20:13 UTC (rev 13088) @@ -1,489 +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: htmlsmartycodes.php 12258 2014-01-02 09:33:29Z timgno $ - */ -defined('XOOPS_ROOT_PATH') or die('Restricted access'); - -/** - * Class TDMCreateHtmlSmartyCodes - */ -class TDMCreateHtmlSmartyCodes extends TDMCreateFile -{ - /* - * @public function constructor - * @param null - */ - /** - * - */ - public function __construct() - { - parent::__construct(); - } - - /* - * @static function &getInstance - * @param null - */ - /** - * @return TDMCreateHtmlSmartyCodes - */ - public static function &getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - - return $instance; - } - - /* - * @public function getHtmlDiv - * @param string $class - * @param string $content - */ - /** - * @param string $class - * @param string $content - * @return string - */ - public function getHtmlDiv($class = 'bnone', $content = '') - { - $ret = <<<EOT - <div class='{$class}'> - {$content} - </div> -EOT; - - return $ret; - } - - /* - * @public function getHtmlSpan - * @param string $class - * @param string $content - */ - /** - * @param string $class - * @param string $content - * @return string - */ - public function getHtmlSpan($class = 'bnone', $content = '') - { - $ret = <<<EOT - <span class='{$class}'> - {$content} - </span> -EOT; - - return $ret; - } - - /* - * @public function getHtmlParagraph - * @param string $class - * @param string $content - */ - /** - * @param string $class - * @param string $content - * @return string - */ - public function getHtmlParagraph($class = 'bnone', $content = '') - { - $ret = <<<EOT - <p class='{$class}'> - {$content} - </p> -EOT; - - return $ret; - } - - /* - * @public function getHtmlAnchor - * @param string $class - * @param string $url - * @param string $target - * @param string $content - */ - /** - * @param string $class - * @param string $url - * @param string $target - * @param string $content - * @return string - */ - public function getHtmlAnchor($class = 'bnone', $url = 'http://', $target = '_top', $content = '') - { - $ret = <<<EOT - <a class='{$class}' href='{$url}' target='{$target}'> - {$content} - </a> -EOT; - - return $ret; - } - - /* - * @public function getHtmlImage - * @param string $class - * @param string $src - * @param string $alt - */ - /** - * @param string $class - * @param string $src - * @param string $alt - * @return string - */ - public function getHtmlImage($class = 'bnone', $src = 'blank.gif', $alt = 'blank.gif') - { - $ret = <<<EOT - <img class='{$class}' src='{$src}' alt='{$alt}' /> -EOT; - - return $ret; - } - - /* - * @public function getHtmlTable - * @param string $class - * @param string $content - */ - /** - * @param string $class - * @param string $content - * @return string - */ - public function getHtmlTable($class = 'bnone', $content = '') - { - $ret = <<<EOT - <table class='{$class}'> - {$content} - </table> -EOT; - - return $ret; - } - - /* - * @public function getHtmlTableThead - * @param string $class - * @param string $content - */ - /** - * @param string $class - * @param string $content - * @return string - */ - public function getHtmlTableThead($class = 'bnone', $content = '') - { - $ret = <<<EOT - <thead class='{$class}'> - {$content} - </thead> -EOT; - - return $ret; - } - - /* - * @public function getHtmlTableTbody - * @param string $class - * @param string $content - */ - /** - * @param string $class - * @param string $content - * @return string - */ - public function getHtmlTableTbody($class = 'bnone', $content = '') - { - $ret = <<<EOT - <tbody class='{$class}'> - {$content} - </tbody> -EOT; - - return $ret; - } - - /* - * @public function getHtmlTableTfoot - * @param string $class - * @param string $content - */ - /** - * @param string $class - * @param string $content - * @return string - */ - public function getHtmlTableTfoot($class = 'bnone', $content = '') - { - $ret = <<<EOT - <tfoot class='{$class}'> - {$content} - </tfoot> -EOT; - - return $ret; - } - - /* - * @public function getHtmlTableHead - * @param string $class - * @param string $content - */ - /** - * @param string $class - * @param string $content - * @return string - */ - public function getHtmlTableHead($class = 'bnone', $content = '') - { - $ret = <<<EOT - <th class='{$class}'>{$content}</th> -EOT; - - return $ret; - } - - /* - * @public function getHtmlTableRow - * @param string $class - * @param string $content - */ - /** - * @param string $class - * @param string $content - * @return string - */ - public function getHtmlTableRow($class = 'bnone', $content = '') - { - $ret = <<<EOT - <tr class='{$class}'> - {$content} - </tr> -EOT; - - return $ret; - } - - /* - * @public function getHtmlTableData - * @param string $class - * @param string $content - */ - /** - * @param string $class - * @param string $content - * @return string - */ - public function getHtmlTableData($class = 'bnone', $content = '') - { - $ret = <<<EOT - <td class='{$class}'>{$content}</td> -EOT; - - return $ret; - } - - /* - * @public function getSmartyConst - * @param string $language - * @param mixed $fieldName - */ - /** - * @param $language - * @param $fieldName - * @return string - */ - public function getSmartyConst($language, $fieldName) - { - $ret = <<<EOT - <{\$smarty.const.{$language}{$fieldName}}> -EOT; - - return $ret; - } - - /* - * @public function getSmartyTableFieldNameEmptyData - * @param string $tableName - * @param string $fieldName - */ - /** - * @param string $tableName - * @param string $fieldName - * @return string - */ - public function getSmartyTableFieldNameEmptyData($tableName = '', $fieldName = '') - { - $ret = <<<EOT - <{\${$tableName}.{$fieldName}}> -EOT; - - return $ret; - } - - /* - * @public function getSmartyTableField - * @param string $tableFieldname - * @param string $fieldName - */ - /** - * @param string $tableFieldname - * @param string $fieldName - * @return string - */ - public function getSmartyTableFieldData($tableFieldname = '', $fieldName = '') - { - $ret = <<<EOT - <{\${$tableFieldname}.{$fieldName}}> -EOT; - - return $ret; - } - - /* - * @public function getSmartyIncludeFile - * @param string $name - */ - /** - * @param $moduleDirname - * @param string $tableName - * @return string - */ - public function getSmartyIncludeFile($moduleDirname, $tableName = 'header') - { - $ret = <<<EOT - <{include file='db:{$moduleDirname}_{$tableName}.html'}> -EOT; - - return $ret; - } - - /* - * @public function getSmartyConditions - * @param string $condition - * @param string $operator - * @param string $type - * @param string $content_if - * @param mixed $content_else - */ - /** - * @param string $condition - * @param string $operator - * @param string $type - * @param string $content_if - * @param bool $content_else - * @return string - */ - public function getSmartyConditions($condition = '', $operator = '==', $type = '1', $content_if = '', $content_else = false) - { - if (!$content_else) { - $ret = <<<EOT - <{if ${$condition} {$operator} {$type}'}> - {$content_if} - <{/if}> -EOT; - } else { - $ret = <<<EOT - <{if ${$condition} {$operator} {$type}'}> - {$content_if} - <{else}> - {$content_else} - <{/if}> -EOT; - } - - return $ret; - } - - /* - * @public function getSmartyForeach - * @param string $item - * @param string $from - * @param string $content - */ - /** - * @param string $item - * @param string $from - * @param string $content - * @return string - */ - public function getSmartyForeach($item = 'item', $from = 'from', $content = 'content') - { - $ret = <<<EOT - <{foreach item={$item} from=${$from}}> - {$content} - <{/foreach}> -EOT; - - return $ret; - } - - /* - * @public function getSmartyForeachQuery - * @param string $item - * @param string $from - * @param string $content - */ - /** - * @param string $item - * @param string $from - * @param string $content - * @return string - */ - public function getSmartyForeachQuery($item = 'item', $from = 'from', $content = 'content') - { - $ret = <<<EOT - <{foreachq item={$item} from=${$from}}> - {$content} - <{/foreachq}> -EOT; - - return $ret; - } - - /* - * @public function getSmartySection - * @param string $name - * @param string $loop - * @param string $content - */ - /** - * @param string $name - * @param string $loop - * @param string $content - * @return string - */ - public function getSmartySection($name = 'name', $loop = 'loop', $content = 'content') - { - $ret = <<<EOT - <{section name={$name} loop=${$loop}}> - {$content} - <{/section}> -EOT; - - return $ret; - } -} Modified: XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/templates/admin/TemplatesAdminPages.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/templates/admin/TemplatesAdminPages.php 2015-06-12 21:33:08 UTC (rev 13087) +++ XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/templates/admin/TemplatesAdminPages.php 2015-06-13 14:20:13 UTC (rev 13088) @@ -298,7 +298,7 @@ $moduleDirname = $module->getVar('mod_dirname'); $tableFieldname = $table->getVar('table_fieldname'); $language = $this->getLanguage($moduleDirname, 'AM'); - $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id'), 'field_order ASC'); + $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id'), 'field_order'); $content = $this->getTemplatesAdminPagesHeader($moduleDirname, $table, $fields, $language); // Verify if table_fieldname is not empty if (!empty($tableFieldname)) { Modified: XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/templates/user/TemplatesUserIndex.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/templates/user/TemplatesUserIndex.php 2015-06-12 21:33:08 UTC (rev 13087) +++ XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/templates/user/TemplatesUserIndex.php 2015-06-13 14:20:13 UTC (rev 13088) @@ -110,7 +110,7 @@ <ul class="menu"> <li><a href="<{\${$moduleDirname}_url}>"><{\$smarty.const.{$language}INDEX}></a></li>\n EOT; - $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order ASC'); + $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); foreach (array_keys($tables) as $i) { $tableName = $tables[$i]->getVar('table_name'); $stuTableName = strtoupper($tableName); Deleted: XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/templates/user/TemplatesUserMoreFiles.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/templates/user/TemplatesUserMoreFiles.php 2015-06-12 21:33:08 UTC (rev 13087) +++ XoopsModules/TDMCreate/branches/timgno/1.91a3/tdmcreate/class/files/templates/user/TemplatesUserMoreFiles.php 2015-06-13 14:20:13 UTC (rev 13088) @@ -1,122 +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: TemplatesUserMoreFiles.php 12258 2014-01-02 09:33:29Z timgno $ - */ -defined('XOOPS_ROOT_PATH') or die('Restricted access'); - -/** - * Class TemplatesUserMoreFiles - */ -class TemplatesUserMoreFiles extends TDMCreateFile -{ - // - private $folder; - // - private $extension; - /* - * @public function constructor - * @param null - */ - /** - * - */ - public function __construct() - { - parent::__construct(); - $this->tdmcfile = TDMCreateFile::getInstance(); - } - - /* - * @static function &getInstance - * @param null - */ - /** - * @return TemplatesUserMoreFiles - */ - public static function &getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - - return $instance; - } - - /* - * @public function write - * @param string $module - * @param string $filename - */ - /** - * @param $module - * @param $filename - * @return string - */ - public function write($module, $folder = '', $filename, $extension) - { - $this->setModule($module); - $this->setFileName($filename); - if($folder != ''){ - $this->folder = 'templates/'.$folder; - } else { - $this->folder = 'templates'; - } - $this->extension = $extension; - } - - /* - * @private function getTemplatesUserMoreFile - * @param null - */ - /** - * @param null - * @return string - */ - private function getTemplatesUserMoreFile() - { - $ret = <<<EOT -<div class="panel"> - Pleace! Enter here your template code here -</div> -EOT; - - return $ret; - } - - /* - * @public function renderFile - * @param string $filename - */ - /** - * @param $filename - * @return bool|string - */ - public function renderFile() - { - $module = $this->getModule(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $content = $this->getTemplatesUserMoreFile(); - // - $this->tdmcfile->create($moduleDirname, $this->folder, $filename . '.' . $this->extension, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $this->tdmcfile->renderFile(); - } -} |