Skip to content

Commit

Permalink
Clear chace before compiling
Browse files Browse the repository at this point in the history
  • Loading branch information
txmodxoops committed May 23, 2015
1 parent 967897e commit 70de646
Show file tree
Hide file tree
Showing 56 changed files with 3,388 additions and 547 deletions.
11 changes: 9 additions & 2 deletions admin/building.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,17 @@
$op = XoopsRequest::getString('op', 'default');
$mid = XoopsRequest::getInt('mod_id');
$moduleObj = $tdmcreate->getHandler('modules')->get($mid);
// Clear cache
$cacheFile1 = TDMC_CLASSES_PATH . '/cache/classpaths.cache';
$cacheFile2 = TDMC_CLASSES_PATH . '/files/cache/classpaths.cache';
if (file_exists($cacheFile1) && file_exists($cacheFile2)) {
unlink($cacheFile1);
unlink($cacheFile2);
}
// Switch option
switch ($op) {
case 'build':
$template_main = 'tdmcreate_building.tpl';
$templateMain = 'tdmcreate_building.tpl';
$GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('building.php'));
// Get var module dirname
$moduleDirname = $moduleObj->getVar('mod_dirname');
Expand Down Expand Up @@ -72,7 +79,7 @@

case 'default':
default:
$template_main = 'tdmcreate_building.tpl';
$templateMain = 'tdmcreate_building.tpl';
$GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('building.php'));
// Redirect if there aren't modules
$nbModules = $tdmcreate->getHandler('modules')->getCount();
Expand Down
6 changes: 3 additions & 3 deletions admin/fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
$start = XoopsRequest::getInt('start', 0);
$limit = XoopsRequest::getInt('limit', $tdmcreate->getConfig('tables_adminpager'));
// Define main template
$template_main = 'tdmcreate_fields.tpl';
$templateMain = 'tdmcreate_fields.tpl';
$GLOBALS['xoTheme']->addStylesheet( 'modules/tdmcreate/assets/css/admin/style.css' );
$GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js');
$GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js');
Expand Down Expand Up @@ -143,7 +143,7 @@

case 'new':
// Define main template
$template_main = 'tdmcreate_fields.tpl';
$templateMain = 'tdmcreate_fields.tpl';
$GLOBALS['xoTheme']->addStylesheet( 'modules/tdmcreate/assets/css/admin/style.css' );
$GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('fields.php'));
$adminMenu->addItemButton(_AM_TDMCREATE_TABLES_LIST, 'tables.php', 'list');
Expand Down Expand Up @@ -227,7 +227,7 @@

case 'edit':
// Define main template
$template_main = 'tdmcreate_fields.tpl';
$templateMain = 'tdmcreate_fields.tpl';
$GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('fields.php'));
$adminMenu->addItemButton(_AM_TDMCREATE_ADD_TABLE, 'tables.php?op=new', 'add');
$adminMenu->addItemButton(_AM_TDMCREATE_TABLES_LIST, 'tables.php', 'list');
Expand Down
4 changes: 2 additions & 2 deletions admin/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @version $Id: footer.php 12207 2013-10-23 02:46:52Z beckmi $
*/
$GLOBALS['xoopsTpl']->assign('module_name', $GLOBALS['xoopsModule']->getVar('name'));
if (isset($template_main)) {
$GLOBALS['xoopsTpl']->display("db:{$template_main}");
if (isset($templateMain)) {
$GLOBALS['xoopsTpl']->display("db:{$templateMain}");
}
xoops_cp_footer();
2 changes: 1 addition & 1 deletion admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
$count_tables = $tdmcreate->getHandler('tables')->getCount($criteria);
$count_fields = $tdmcreate->getHandler('fields')->getCount($criteria);
unset($criteria);
$template_main = 'tdmcreate_index.tpl';
$templateMain = 'tdmcreate_index.tpl';
$adminMenu->addInfoBox(_AM_TDMCREATE_ADMIN_NUMMODULES);
$adminMenu->addInfoBoxLine(_AM_TDMCREATE_ADMIN_NUMMODULES, '<label>' . _AM_TDMCREATE_THEREARE_NUMMODULES . '</label>', $count_modules, 'Green');
$adminMenu->addInfoBoxLine(_AM_TDMCREATE_ADMIN_NUMMODULES, '<label>' . _AM_TDMCREATE_THEREARE_NUMTABLES . '</label>', $count_tables, 'Orange');
Expand Down
6 changes: 3 additions & 3 deletions admin/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
$start = XoopsRequest::getInt('start', 0);
$limit = XoopsRequest::getInt('limit', $tdmcreate->getConfig('modules_adminpager'));
// Define main template
$template_main = 'tdmcreate_modules.tpl';
$templateMain = 'tdmcreate_modules.tpl';
$GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js');
$GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css');
$GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('modules.php'));
Expand Down Expand Up @@ -83,7 +83,7 @@

case 'new':
// Define main template
$template_main = 'tdmcreate_modules.tpl';
$templateMain = 'tdmcreate_modules.tpl';
$GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js');
$GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('modules.php'));
$adminMenu->addItemButton(_AM_TDMCREATE_MODULES_LIST, 'modules.php', 'list');
Expand Down Expand Up @@ -177,7 +177,7 @@

case 'edit':
// Define main template
$template_main = 'tdmcreate_modules.tpl';
$templateMain = 'tdmcreate_modules.tpl';
$GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js');
$GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('modules.php'));
$adminMenu->addItemButton(_AM_TDMCREATE_ADD_MODULE, 'modules.php?op=new', 'add');
Expand Down
12 changes: 6 additions & 6 deletions admin/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,25 @@
// Recovered value of argument op in the URL $
$op = XoopsRequest::getString('op', 'edit');
//
$modId = XoopsRequest::getInt('set_id');
$setId = XoopsRequest::getInt('set_id');
//
switch ($op) {
case 'edit':
default:
// Define main template
$template_main = 'tdmcreate_settings.tpl';
$templateMain = 'tdmcreate_settings.tpl';
$GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('settings.php'));
$settingsObj = $tdmcreate->getHandler('settings')->get($modId);
$form = $settingsObj->getForm();
$settingsObj = $tdmcreate->getHandler('settings')->get($setId);
$form = $settingsObj->getForm();
$GLOBALS['xoopsTpl']->assign('form', $form->render());
break;

case 'save':
if (!$GLOBALS['xoopsSecurity']->check()) {
redirect_header('settings.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
}
if (isset($modId)) {
$settingsObj =& $tdmcreate->getHandler('settings')->get($modId);
if (isset($setId)) {
$settingsObj =& $tdmcreate->getHandler('settings')->get($setId);
}
$moduleDirname = preg_replace('/[^a-zA-Z0-9]\s+/', '', strtolower($_POST['set_dirname']));
//Form module save
Expand Down
6 changes: 3 additions & 3 deletions admin/tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
$start = XoopsRequest::getInt('start', 0);
$limit = XoopsRequest::getInt('limit', $tdmcreate->getConfig('modules_adminpager'));
// Define main template
$template_main = 'tdmcreate_tables.tpl';
$templateMain = 'tdmcreate_tables.tpl';
$GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css');
$GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js');
$GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js');
Expand Down Expand Up @@ -132,7 +132,7 @@

case 'new':
// Define main template
$template_main = 'tdmcreate_tables.tpl';
$templateMain = 'tdmcreate_tables.tpl';
$GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('tables.php'));
$adminMenu->addItemButton(_AM_TDMCREATE_TABLES_LIST, 'tables.php', 'list');
$GLOBALS['xoopsTpl']->assign('buttons', $adminMenu->renderButton());
Expand Down Expand Up @@ -230,7 +230,7 @@

case 'edit':
// Define main template
$template_main = 'tdmcreate_tables.tpl';
$templateMain = 'tdmcreate_tables.tpl';
$GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('tables.php'));
$adminMenu->addItemButton(_AM_TDMCREATE_ADD_TABLE, 'tables.php?op=new', 'add');
$adminMenu->addItemButton(_AM_TDMCREATE_TABLES_LIST, 'tables.php?op=list', 'list');
Expand Down
100 changes: 85 additions & 15 deletions class/files/TDMCreateArchitecture.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class TDMCreateArchitecture extends TDMCreateStructure
* @var mixed
*/
private $tdmcreate;

/*
* @var mixed
*/
Expand All @@ -46,6 +47,7 @@ class TDMCreateArchitecture extends TDMCreateStructure
public function __construct()
{
$this->tdmcreate = TDMCreateHelper::getInstance();
$this->tdmcfile = TDMCreateFile::getInstance();
$this->structure = TDMCreateStructure::getInstance();
$this->structure->setUploadPath(TDMC_UPLOAD_REPOSITORY_PATH);
}
Expand Down Expand Up @@ -80,10 +82,7 @@ public function createBaseFoldersFiles($module)
$modId = $module->getVar('mod_id');
$language = $GLOBALS['xoopsConfig']['language'];
// Id of tables
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('table_mid', $modId));
$tables = $this->tdmcreate->getHandler('tables')->getObjects($criteria);
unset($criteria);
$tables = $this->tdmcfile->getTableTables($modId);
//
$table = null;
foreach (array_keys($tables) as $t) {
Expand All @@ -96,6 +95,8 @@ public function createBaseFoldersFiles($module)
}
//
$indexFile = XOOPS_UPLOAD_PATH . '/index.html';
$cache1 = TDMC_CLASSES_PATH . '/cache';
$cache2 = TDMC_CLASSES_PATH . '/files/cache';
$stlModuleAuthor = str_replace(' ', '', strtolower($module->getVar('mod_author')));
$this->structure->setModuleName($module->getVar('mod_dirname'));
$uploadPath = $this->structure->getUploadPath();
Expand Down Expand Up @@ -173,6 +174,8 @@ public function createBaseFoldersFiles($module)
$this->structure->makeDirAndCopyFile('language/english', $indexFile, 'index.html');
// Creation of "language/english/help" folder and index.html file
$this->structure->makeDirAndCopyFile('language/english/help', $indexFile, 'index.html');
// Creation of "preloads" folder and index.html file
$this->structure->makeDirAndCopyFile('preloads', $indexFile, 'index.html');
if (1 == $module->getVar('mod_admin')) {
// Creation of "templates" folder and index.html file
$this->structure->makeDirAndCopyFile('templates', $indexFile, 'index.html');
Expand Down Expand Up @@ -210,16 +213,11 @@ public function createBaseFoldersFiles($module)
public function createFilesToBuilding($module)
{
// Module
$modId = $module->getVar('mod_id');
$moduleDirname = $module->getVar('mod_dirname');
$icon32 = 'assets/icons/32';
// Id of tables
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('table_mid', $modId));
$criteria->setSort('table_order');
$tables = $this->tdmcreate->getHandler('tables')->getObjects($criteria);
unset($criteria);
$ret = array();
$modId = $module->getVar('mod_id');
$moduleDirname = $module->getVar('mod_dirname');
$icon32 = 'assets/icons/32';
$tables = $this->tdmcfile->getTableTables($modId);
$ret = array();
//
$table = array();
foreach (array_keys($tables) as $t) {
Expand Down Expand Up @@ -353,7 +351,7 @@ public function createFilesToBuilding($module)
if (1 == $table->getVar('table_permissions')) {
// Admin Permissions File
$adminPermissions = AdminPermissions::getInstance();
$adminPermissions->write($module, $tables, 'permissions.php');
$adminPermissions->write($module, $table, $tables, 'permissions.php');
$ret[] = $adminPermissions->render();
// Templates Admin Permissions File
$adminTemplatesPermissions = TemplatesAdminPermissions::getInstance();
Expand Down Expand Up @@ -447,18 +445,90 @@ public function createFilesToBuilding($module)
$userNotificationUpdate = UserNotificationUpdate::getInstance();
$userNotificationUpdate->write($module, 'notification_update.php');
$ret[] = $userNotificationUpdate->render();
}
// User Broken File
if ((1 == $table->getVar('table_broken'))) {
$userBroken = UserBroken::getInstance();
$userBroken->write($module, $table, 'broken.php');
$ret[] = $userBroken->render();
// User Templates Broken File
$userTemplatesBroken = TemplatesUserBroken::getInstance();
$userTemplatesBroken->write($module, $table);
$ret[] = $userTemplatesBroken->renderFile($moduleDirname . '_broken.tpl');
}
// User Pdf File
if ((1 == $table->getVar('table_pdf'))) {
$userPdf = UserPrint::getInstance();
$userPdf->write($module, $table, 'pdf.php');
$ret[] = $userPdf->render();
// User Templates Pdf File
$userTemplatesPdf = TemplatesUserPdf::getInstance();
$userTemplatesPdf->write($module, $table);
$ret[] = $userTemplatesPdf->renderFile($moduleDirname . '_pdf.tpl');
}
// User Print File
if ((1 == $table->getVar('table_print'))) {
$userPrint = UserPrint::getInstance();
$userPrint->write($module, $table, 'print.php');
$ret[] = $userPrint->render();
// User Templates Print File
$userTemplatesPrint = TemplatesUserPrint::getInstance();
$userTemplatesPrint->write($module, $table);
$ret[] = $userTemplatesPrint->renderFile($moduleDirname . '_print.tpl');
}
// User Rate File
if ((1 == $table->getVar('table_rate'))) {
$userRate = UserRate::getInstance();
$userRate->write($module, $table, 'rate.php');
$ret[] = $userRate->render();
// User Templates Rate File
$userTemplatesRate = TemplatesUserRate::getInstance();
$userTemplatesRate->write($module, $table);
$ret[] = $userTemplatesRate->renderFile($moduleDirname . '_rate.tpl');
}
// User Rss File
if ((1 == $table->getVar('table_rss'))) {
$userRss = UserRss::getInstance();
$userRss->write($module, $table, 'rss.php');
$ret[] = $userRss->render();
// User Templates Rss File
$userTemplatesRss = TemplatesUserRss::getInstance();
$userTemplatesRss->write($module, $table);
$ret[] = $userTemplatesRss->renderFile($moduleDirname . '_rss.tpl');
}
// User Single File
if ((1 == $table->getVar('table_single'))) {
$userSingle = UserSingle::getInstance();
$userSingle->write($module, $table, 'single.php');
$ret[] = $userSingle->render();
// User Templates Single File
$userTemplatesSingle = TemplatesUserSingle::getInstance();
$userTemplatesSingle->write($module, $table);
$ret[] = $userTemplatesSingle->renderFile($moduleDirname . '_single.tpl');
}
// User Submit File
if ((1 == $table->getVar('table_submit'))) {
$userSubmit = UserSubmit::getInstance();
$userSubmit->write($module, $table, 'submit.php');
$ret[] = $userSubmit->render();
// User Templates Submit File
$userTemplatesSubmit = TemplatesUserSubmit::getInstance();
$userTemplatesSubmit->write($module, $table);
$ret[] = $userTemplatesSubmit->renderFile($moduleDirname . '_submit.tpl');
}// User Visit File
if ((1 == $table->getVar('table_visit'))) {
$userVisit = UserVisit::getInstance();
$userVisit->write($module, $table, 'visit.php');
$ret[] = $userVisit->render();
}
// User Tag Files
if ((1 == $table->getVar('table_tag'))) {
$userListTag = UserListTag::getInstance();
$userListTag->write($module, 'list.tag.php');
$ret[] = $userListTag->render();
$userViewTag = UserViewTag::getInstance();
$userViewTag->write($module, 'view.tag.php');
$ret[] = $userViewTag->render();
}
// User Index File
$userIndex = UserIndex::getInstance();
Expand Down
24 changes: 21 additions & 3 deletions class/files/TDMCreateTableFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,34 @@ public function __construct()
{
$this->tdmcreate = TDMCreateHelper::getInstance();
}

/**
* @public function getTableTables
* @param $mId
* @return mixed
*/
public function getTableTables($mId)
{
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('table_mid', $mId)); // $mId = module Id
$criteria->setSort('table_order');
$tables = $this->tdmcreate->getHandler('tables')->getObjects($criteria);
unset($criteria);

return $tables;
}

/**
* @public function getTableFields
* @param $tableId
* @param $mId
* @param $tId
* @return mixed
*/
public function getTableFields($tableId)
public function getTableFields($mId, $tId)
{
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('field_tid', $tableId));
$criteria->add(new Criteria('field_mid', $mId)); // $mId = module Id
$criteria->add(new Criteria('field_tid', $tId)); // $tId = table Id
$criteria->setSort('field_order');
$fields = $this->tdmcreate->getHandler('fields')->getObjects($criteria);
unset($criteria);
Expand Down
2 changes: 1 addition & 1 deletion class/files/admin/AdminAbout.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function render()
$content = $this->getHeaderFilesComments($module, $filename);
$content .= <<<EOT
include __DIR__ . '/header.php';
\$template_main = '{$moduleDirname}_admin_about.tpl';
\$templateMain = '{$moduleDirname}_admin_about.tpl';
\$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('about.php'));
\$GLOBALS['xoopsTpl']->assign('about', \$adminMenu->renderAbout('{$moduleDonations}', false));
include __DIR__ . '/footer.php';
Expand Down
2 changes: 1 addition & 1 deletion class/files/admin/AdminFooter.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function render()
$moduleDirname = $module->getVar('mod_dirname');
$content = $this->getHeaderFilesComments($module, $filename);
$content .= <<<EOT
if ( isset(\$template_main) ) {
if ( isset(\$templateMain) ) {
\$GLOBALS['xoopsTpl']->display("db:{\$templateMain}");
}
xoops_cp_footer();
Expand Down
3 changes: 1 addition & 2 deletions class/files/admin/AdminObjects.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,7 @@ public function getUploadImageGetVar($lpFieldName, $rpFieldName, $tableName, $fi
$ret = <<<EOT
\t\t\t\t// Get Var {$fieldName}
\t\t\t\t\${$fieldName} = \${$tableName}All[\$i]->getVar('{$fieldName}');
\t\t\t\t\$upload_image = \${$fieldName} ? \${$fieldName} : 'blank.gif';
\t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = \$upload_image;\n
\t\t\t\t\${$lpFieldName}['{$rpFieldName}'] = \${$fieldName} ? \${$fieldName} : 'blank.gif';\n
EOT;
return $ret;
}
Expand Down
Loading

0 comments on commit 70de646

Please sign in to comment.