|
From: <txm...@us...> - 2014-03-02 01:52:33
|
Revision: 12337
http://sourceforge.net/p/xoops/svn/12337
Author: txmodxoops
Date: 2014-03-02 01:52:29 +0000 (Sun, 02 Mar 2014)
Log Message:
-----------
Updated
Added separated class HtmlSmartyCodes file for admin & user templates
Modified Paths:
--------------
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/headerfiles.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_header.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_index.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_pages.php
Added Paths:
-----------
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin_templates.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/htmlsmartycodes.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_footer.php
Added: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin_templates.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin_templates.php (rev 0)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin_templates.php 2014-03-02 01:52:29 UTC (rev 12337)
@@ -0,0 +1,48 @@
+<?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_templates.php 12258 2014-01-02 09:33:29Z timgno $
+ */
+if (!defined('XOOPS_ROOT_PATH')) {
+ die('XOOPS root path not defined');
+}
+
+class AdminTemplates extends HtmlSmartyCodes
+{
+ /*
+ * @public function constructor
+ * @param string $module
+ * @param mixed $table
+ * @param string $file_name
+ */
+ public function __construct($module, $table, $file_name = null) {
+ $this->module = $module;
+ $this->table = $table;
+ $this->file_name = $file_name;
+ $this->language = $this->geLanguage('_AM_', '_');
+ }
+ /*
+ * @public function render
+ * @param null
+ */
+ public function render() {
+ /*$ret = $this->getUploadImage();
+ $ret = $this->getUploadFile();
+ return $ret;*/
+ }
+}
\ No newline at end of file
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/headerfiles.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/headerfiles.php 2014-02-28 21:29:57 UTC (rev 12336)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/headerfiles.php 2014-03-02 01:52:29 UTC (rev 12337)
@@ -29,30 +29,30 @@
/**
* "path" attribute of the files
*
- * @var string
+ * @var mixed
*/
- private $path = '';
+ private $path = XOOPS_ROOT_PATH.'/modules/TDMCreate';
/**
* "module" attribute of the files
*
- * @var string
+ * @var mixed
*/
- private $_module = '';
+ private $module = null;
/**
* "folder" attribute of the files
*
- * @var string
+ * @var mixed
*/
- private $folder = '';
+ private $folder = null;
/**
* "file_name" attribute of the files
*
- * @var string
+ * @var mixed
*/
- private $file_name = '';
+ private $file_name = null;
/**
* Generates output for the files.
@@ -66,14 +66,16 @@
/*
* @public function getHeader
* @param string $path
+ * @param string $module
* @param string $folder
* @param string $file_name
*/
- public function getHeader($path, $folder, $file_name) {
+ public function getHeader($path, $module, $folder, $file_name) {
$this->path = $path;
$this->folder = $folder;
+ $this->module = $module;
$this->file_name = $file_name;
- $ret = $this->path . DIRECTORY_SEPARATOR . $this->_module . DIRECTORY_SEPARATOR . $this->folder . DIRECTORY_SEPARATOR . $this->file_name;
+ $ret = $this->path . DIRECTORY_SEPARATOR . $this->module . DIRECTORY_SEPARATOR . $this->folder . DIRECTORY_SEPARATOR . $this->file_name;
return $ret;
}
@@ -83,19 +85,19 @@
* @param string $file_name
*/
public function getHeaderComment($module, $file_name) {
- $this->_module = $module;
+ $this->module = $module;
$this->file_name = $file_name;
- $mod_name = $this->_module->getVar('mod_name');
- $mod_version = $this->_module->getVar('mod_version');
- $mod_since = $this->_module->getVar('mod_since');
- //$mod_min_xoops = $this->_module->getVar('mod_min_xoops');
- $mod_author = $this->_module->getVar('mod_author');
- $mod_credits = $this->_module->getVar('mod_credits');
- $mod_a_m = $this->_module->getVar('mod_author_mail');
- $mod_a_w_url = $this->_module->getVar('mod_author_website_url');
- $mod_license = $this->_module->getVar('mod_license');
- $mod_subversion = $this->_module->getVar('mod_subversion');
+ $mod_name = $this->module->getVar('mod_name');
+ $mod_version = $this->module->getVar('mod_version');
+ $mod_since = $this->module->getVar('mod_since');
+ $mod_min_xoops = $this->module->getVar('mod_min_xoops');
+ $mod_author = $this->module->getVar('mod_author');
+ $mod_credits = $this->module->getVar('mod_credits');
+ $mod_a_m = $this->module->getVar('mod_author_mail');
+ $mod_a_w_url = $this->module->getVar('mod_author_website_url');
+ $mod_license = $this->module->getVar('mod_license');
+ $mod_subversion = $this->module->getVar('mod_subversion');
$date = date('D Y/m/d G:i:s');
$package = strtolower($mod_name);
@@ -116,8 +118,9 @@
* @license {$mod_license}
* @package {$package}
* @since {$mod_since}
+ * @min_xoops {$mod_min_xoops}
* @author {$mod_author} <{$mod_a_m}> - <{$mod_a_w_url}>
- * @version \$Id: {$mod_version} {$filename} {$mod_subversion} {$date}Z {$mod_credits} \$
+ * @version \$Id: {$mod_version} {$file_name} {$mod_subversion} {$date}Z {$mod_credits} \$
*/
EOT;
return $ret;
@@ -128,7 +131,7 @@
* @param null
*/
public function getModuleName() {
- $ret = strtolower($this->_module->getVar('mod_name'));
+ $ret = strtolower($this->module->getVar('mod_name'));
return $ret;
}
@@ -139,9 +142,9 @@
*/
public function getLanguage($prefix = '', $extra = '') {
if(!empty($extra))
- $ret = $prefix . strtoupper($this->_module->getVar('mod_name')) . $extra;
+ $ret = $prefix . strtoupper($this->module->getVar('mod_name')) . $extra;
else
- $ret = $prefix . strtoupper($this->_module->getVar('mod_name'));
+ $ret = $prefix . strtoupper($this->module->getVar('mod_name'));
return $ret;
}
Added: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/htmlsmartycodes.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/htmlsmartycodes.php (rev 0)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/htmlsmartycodes.php 2014-03-02 01:52:29 UTC (rev 12337)
@@ -0,0 +1,227 @@
+<?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 $
+ */
+if (!defined('XOOPS_ROOT_PATH')) {
+ die('XOOPS root path not defined');
+}
+
+class HtmlSmartyCodes extends HeaderFile
+{
+ /*
+ * @var mixed
+ */
+ public $table = null;
+ /*
+ * @var string
+ */
+ public $language = null;
+ /*
+ * @public function constructor
+ * @param string $module
+ * @param mixed $table
+ * @param string $file_name
+ */
+ public function __construct($module, $table) {
+ $this->module = $module;
+ $this->table = $table;
+ $this->language = $this->geLanguage('_AM_', '_');
+ }
+ /*
+ * @public function getHtmlDiv
+ * @param string $class
+ * @param string $content
+ */
+ public function getHtmlDiv($class = '', $content = '') {
+ $ret = <<<EOT
+ <div class='{$class}'>
+ {$content}
+ </div>
+EOT;
+ return $ret;
+ }
+ /*
+ * @public function getHtmlSpan
+ * @param string $class
+ * @param string $content
+ */
+ public function getHtmlSpan($class = '', $content = '') {
+ $ret = <<<EOT
+ <span class='{$class}'>
+ {$content}
+ </span>
+EOT;
+ return $ret;
+ }
+ /*
+ * @public function getHtmlTable
+ * @param string $class
+ * @param string $content
+ */
+ public function getHtmlTable($class = '', $content = '') {
+ $ret = <<<EOT
+ <table class='{$class}'>
+ {$content}
+ </table>
+EOT;
+ return $ret;
+ }
+ /*
+ * @public function getHtmlTable
+ * @param string $class
+ * @param string $content
+ */
+ public function getHtmlTableThead($class = '', $content = '') {
+ $ret = <<<EOT
+ <thead class='{$class}'>
+ {$content}
+ </thead>
+EOT;
+ return $ret;
+ }
+ /*
+ * @public function getHtmlTable
+ * @param string $class
+ * @param string $content
+ */
+ public function getHtmlTableTbody($class = '', $content = '') {
+ $ret = <<<EOT
+ <tbody class='{$class}'>
+ {$content}
+ </tbody>
+EOT;
+ return $ret;
+ }
+ /*
+ * @public function getHtmlTableTfoot
+ * @param string $class
+ * @param string $content
+ */
+ public function getHtmlTableTfoot($class = '', $content = '') {
+ $ret = <<<EOT
+ <tfoot class='{$class}'>
+ {$content}
+ </tfoot>
+EOT;
+ return $ret;
+ }
+ /*
+ * @public function getHtmlTableHead
+ * @param string $class
+ * @param mixed $field_name
+ */
+ public function getHtmlTableHead($class = '', $field_name) {
+ $field_name = strtoupper($field_name);
+ $ret = <<<EOT
+ <th class='{$class}'><{{$this->language}{$field_name}}></th>
+EOT;
+ return $ret;
+ }
+ /*
+ * @public function getHtmlTableRow
+ * @param string $class
+ * @param string $content
+ */
+ public function getHtmlTableRow($class = '', $content = '') {
+ $ret = <<<EOT
+ <tr class='{$class}'>
+ {$content}
+ </tr>
+EOT;
+ return $ret;
+ }
+ /*
+ * @public function getHtmlTableData
+ * @param string $class
+ * @param mixed $field_name
+ */
+ public function getHtmlTableData($class = '', $field_name) {
+ $table_fieldname = $this->table->getVar('table_fieldname');
+ $ret = <<<EOT
+ <td class='{$class}'><{\${$table_fieldname}.{$field_name}}></td>
+EOT;
+ return $ret;
+ }
+ /*
+ * @public function getSmartyIncludeFile
+ * @param string $name
+ */
+ public function getSmartyIncludeFile($name = 'header') {
+ $module_name = $this->module->getVar('mod_name');
+ $ret = <<<EOT
+ <{include file='db:{$module_name}_{$name}.html'}>
+EOT;
+ return $ret;
+ }
+ /*
+ * @public function getSmartyConditions
+ * @param string $condition
+ * @param string $operator
+ * @param string $type
+ * @param string $content_if
+ * @param mixed $content_else
+ */
+ public function getSmartyConditions($condition = '', $operator = '==', $type = '1', $content_if = '', $content_else = false) {
+ $ret = '';
+ 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
+ */
+ public function getSmartyForeach($item = 'item', $from = 'from', $content = 'content') {
+ $ret = <<<EOT
+ <{foreach item={$item} from=${$from}}>
+ {$content}
+ <{/foreach}>
+EOT;
+ return $ret;
+ }
+ /*
+ * @public function getSmartySection
+ * @param string $name
+ * @param string $loop
+ * @param string $content
+ */
+ public function getSmartySection($name = 'name', $loop = 'loop', $content = 'content') {
+ $ret = <<<EOT
+ <{section name={$name} loop=${$loop}}>
+ {$content}
+ <{/section}>
+EOT;
+ return $ret;
+ }
+}
\ No newline at end of file
Added: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_footer.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_footer.php (rev 0)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_footer.php 2014-03-02 01:52:29 UTC (rev 12337)
@@ -0,0 +1,57 @@
+<?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: user_footer.php 12258 2014-01-02 09:33:29Z timgno $
+ */
+if (!defined('XOOPS_ROOT_PATH')) {
+ die('XOOPS root path not defined');
+}
+
+class UserFooter extends HeaderFile
+{
+ /*
+ * @var string
+ */
+ public $_module = '';
+ /*
+ * @var string
+ */
+ public $file_name = null;
+ /*
+ * @public function constructor
+ * @param string $module
+ * @param string $file_name
+ */
+ public function __construct($module, $file_name) {
+ $this->_module = $module;
+ $this->file_name = $file_name;
+ }
+ /*
+ * @public function render
+ * @param null
+ */
+ public function render() {
+ $module_name = $this->getModuleName();
+ $language = $this->getLanguage('_MA_');
+ $ret <<<EOT
+\n// User footer
+include_once XOOPS_ROOT_PATH.'/footer.php';
+EOT;
+ return $ret;
+ }
+}
\ No newline at end of file
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_header.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_header.php 2014-02-28 21:29:57 UTC (rev 12336)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_header.php 2014-03-02 01:52:29 UTC (rev 12337)
@@ -31,21 +31,15 @@
/*
* @var string
*/
- public $_table = array();
- /*
- * @var string
- */
public $file_name = null;
/*
* @public function constructor
* @param string $module
* @param string $file_name
*/
- public function __construct($module, $table, $file_name) {
+ public function __construct($module, $file_name) {
$this->_module = $module;
- $this->_table[] = $table;
$this->file_name = $file_name;
- $this->permissions = $permissions;
}
/*
* @public function render
@@ -53,7 +47,8 @@
*/
public function render() {
$module_name = $this->getModuleName();
- $language = $this->getLanguage('_MA_');
+ $language = $this->getLanguage('_MA_');
+ $stu_mod_name = strtoupper($module_name);
$ret <<<EOT
\nrequire_once dirname(dirname(dirname(__FILE__))) . '/mainfile.php';
\$dirname = \$GLOBALS['xoopsModule']->getVar('dirname');
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_index.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_index.php 2014-02-28 21:29:57 UTC (rev 12336)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_index.php 2014-03-02 01:52:29 UTC (rev 12337)
@@ -45,7 +45,6 @@
$this->_module = $module;
$this->_table[] = $table;
$this->file_name = $file_name;
- $this->permissions = $permissions;
}
/*
* @public function render
@@ -53,7 +52,7 @@
*/
public function render() {
$module_name = $this->getModuleName();
- $language = $this->getLanguage('_MA_');
+ $language = $this->getLanguage('_MA_', '_');
$ret <<<EOT
\ninclude_once 'header.php';
\$xoopsOption['template_main'] = '{$stl_mod_name}_index.html';
@@ -63,7 +62,7 @@
// keywords
{$stl_mod_name}_meta_keywords(xoops_getModuleOption('keywords', \$dirname));
// description
-{$stl_mod_name}_meta_description({$language}_DESC);
+{$stl_mod_name}_meta_description({$language}DESC);
//
\$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', {$stu_mod_name}_URL.'/index.php');
\$GLOBALS['xoopsTpl']->assign('{$stl_mod_name}_url', {$stu_mod_name}_URL);
@@ -75,7 +74,7 @@
\$GLOBALS['xoopsTpl']->assign('admin', {$stu_mod_name}_ADMIN);
\$GLOBALS['xoopsTpl']->assign('copyright', \$copyright);
//
-include_once XOOPS_ROOT_PATH.'/footer.php';
+include_once 'footer.php';
EOT;
return $ret;
}
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_pages.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_pages.php 2014-02-28 21:29:57 UTC (rev 12336)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_pages.php 2014-03-02 01:52:29 UTC (rev 12337)
@@ -27,7 +27,7 @@
/*
* @var string
*/
- public $_module = ;
+ public $_module = null;
/*
* @var string
*/
|