From 37362cdac997995d3b2c1edc00fdabfb2d986111 Mon Sep 17 00:00:00 2001 From: Txmod Xoops Date: Mon, 1 Jun 2015 13:24:50 +0200 Subject: [PATCH] Fix & Addeds --- admin/fields.php | 146 ++++++------- admin/modules.php | 118 +++++------ admin/tables.php | 195 +++++++++--------- assets/icons/16/rss.gif | Bin 0 -> 1335 bytes assets/icons/24/index.html | 1 + assets/icons/24/next.png | Bin 0 -> 677 bytes assets/icons/24/previous.png | Bin 0 -> 729 bytes class/fields.php | 65 ++++++ class/files/TDMCreateArchitecture.php | 6 +- class/files/admin/AdminObjects.php | 20 +- class/files/admin/AdminPages.php | 7 +- class/files/cache/classpaths.cache | 1 + class/files/classes/ClassFiles.php | 7 +- class/files/classes/ClassFormElements.php | 16 +- class/files/include/IncludeFunctions.php | 4 +- .../templates/admin/TemplatesAdminPages.php | 24 ++- .../templates/user/TemplatesUserIndex.php | 71 ++++++- class/files/user/UserIndex.php | 181 ++++++++++++++-- class/files/user/UserPages.php | 34 +-- class/files/user/UserXoopsVersion.php | 101 +++++++++ class/modules.php | 50 +++++ class/tables.php | 73 ++++++- sql/mysql.sql | 5 +- templates/admin/tdmcreate_modules.tpl | 14 +- templates/admin/tdmcreate_tables.tpl | 14 +- templates/admin/tdmcreate_tables_item.tpl | 16 +- 26 files changed, 808 insertions(+), 361 deletions(-) create mode 100644 assets/icons/16/rss.gif create mode 100644 assets/icons/24/index.html create mode 100644 assets/icons/24/next.png create mode 100644 assets/icons/24/previous.png create mode 100644 class/files/cache/classpaths.cache diff --git a/admin/fields.php b/admin/fields.php index 619ca20a..94936b3e 100644 --- a/admin/fields.php +++ b/admin/fields.php @@ -49,81 +49,45 @@ $GLOBALS['xoopsTpl']->assign('modPathIcon16', $modPathIcon16); $GLOBALS['xoopsTpl']->assign('sysPathIcon32', $sysPathIcon32); // Redirect if there aren't modules - $countModules = $tdmcreate->getHandler('modules')->getCount(); - if ( $countModules == 0 ) { + $modulesCount = $tdmcreate->getHandler('modules')->getCountModules(); + if ( $modulesCount == 0 ) { redirect_header('modules.php?op=new', 2, _AM_TDMCREATE_NOTMODULES ); } - unset($countModules); + unset($modulesCount); // Redirect if there aren't tables - $handlerTables = $tdmcreate->getHandler('tables'); - $countTables = $handlerTables->getCount(); - if ($countTables == 0) { + $tablesCount = $tdmcreate->getHandler('tables')->getCountTables(); + if ($tablesCount == 0) { redirect_header('tables.php?op=new', 2, _AM_TDMCREATE_NOTTABLES ); } - unset($countTables); // Get the list of tables - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('table_mid', $handlerTables->getVar('table_mid'))); - $criteria->setStart($start); - $criteria->setLimit($limit); - $criteria->setSort('table_id ASC, table_order ASC, table_name'); - $criteria->setOrder('ASC'); - $countTables = $tdmcreate->getHandler('tables')->getCount($criteria); - $tablesAll = $tdmcreate->getHandler('tables')->getAll($criteria); - unset($criteria); - if ($countTables > 0) + $tablesAll = $tdmcreate->getHandler('tables')->getAllTables($start, $limit); + if ($tablesCount > 0) { $tlid = 1; foreach (array_keys($tablesAll) as $tid) - { + { // Display tables list - $table['id'] = $tid; - $table['lid'] = $tlid; - $table['mid'] = $tablesAll[$tid]->getVar('table_mid'); - $table['name'] = ucfirst($tablesAll[$tid]->getVar('table_name')); - $table['image'] = $tablesAll[$tid]->getVar('table_image'); - $table['nbfields'] = $tablesAll[$tid]->getVar('table_nbfields'); - $table['order'] = $tablesAll[$tid]->getVar('table_order'); - $table['autoincrement'] = $tablesAll[$tid]->getVar('table_autoincrement'); - $table['blocks'] = $tablesAll[$tid]->getVar('table_blocks'); - $table['admin'] = $tablesAll[$tid]->getVar('table_admin'); - $table['user'] = $tablesAll[$tid]->getVar('table_user'); - $table['search'] = $tablesAll[$tid]->getVar('table_search'); + $table = $tablesAll[$tid]->getValues(); + $talid = array('lid' => $tlid); + $table = array_merge($table, $talid); // Get the list of fields - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('field_mid', $table['mid'])); - $criteria->add(new Criteria('field_tid', $tid)); - $criteria->setSort('field_order ASC, field_id ASC, field_name'); - $criteria->setOrder('ASC'); - $countFields = $tdmcreate->getHandler('fields')->getCount($criteria); - $fieldsAll = $tdmcreate->getHandler('fields')->getObjects($criteria); - unset($criteria); + $fieldsCount = $tdmcreate->getHandler('fields')->getCountFields(); + $fieldsAll = $tdmcreate->getHandler('fields')->getAllFieldsByModuleAndTableId($table['mid'], $tid); // Display fields list $fields = array(); $lid = 1; - if ( $countFields > 0 ) + if ( $fieldsCount > 0 ) { - foreach (array_keys($fieldsAll) as $fid) + foreach (array_keys($fieldsAll) as $fid) { - $field['id'] = $fid; - $field['lid'] = $lid; - $field['order'] = $fieldsAll[$fid]->getVar('field_order'); - $field['name'] = str_replace('_', ' ', ucfirst($fieldsAll[$fid]->getVar('field_name'))); - $field['parent'] = $fieldsAll[$fid]->getVar('field_parent'); - $field['inlist'] = $fieldsAll[$fid]->getVar('field_inlist'); - $field['inform'] = $fieldsAll[$fid]->getVar('field_inform'); - $field['admin'] = $fieldsAll[$fid]->getVar('field_admin'); - $field['user'] = $fieldsAll[$fid]->getVar('field_user'); - $field['block'] = $fieldsAll[$fid]->getVar('field_block'); - $field['main'] = $fieldsAll[$fid]->getVar('field_main'); - $field['search'] = $fieldsAll[$fid]->getVar('field_search'); - $field['required'] = $fieldsAll[$fid]->getVar('field_required'); - $fields[] = $field; - unset($field); - $lid++; + $field = $fieldsAll[$fid]->getValues(); + $falid = array('lid' => $lid); + $fields[] = array_merge($field, $falid); + unset($field); + ++$lid; } } - $tlid++; + ++$tlid; unset($lid); $table['fields'] = $fields; $GLOBALS['xoopsTpl']->append('tables_list', $table); @@ -131,9 +95,9 @@ } unset($tlid); unset($fields); - if ( $countTables > $limit ) { + if ( $tablesCount > $limit ) { include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new XoopsPageNav($countTables, $limit, $start, 'start', 'op=list&limit=' . $limit); + $pagenav = new XoopsPageNav($tablesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); } } else { @@ -278,26 +242,50 @@ break; case 'display': - // Fields Handler - $fields = $tdmcreate->getHandler('fields'); - // - foreach ($_POST['field_id'] as $key => $value) { - $fieldsObj =& $fields->get($value); - $fieldsObj->setVar('field_parent', (1 == $_REQUEST['field_parent'][$key]) ? 0 : 1); - $fieldsObj->setVar('field_inlist', (1 == $_REQUEST['field_inlist'][$key]) ? 0 : 1); - $fieldsObj->setVar('field_inform', (1 == $_REQUEST['field_inform'][$key]) ? 0 : 1); - $fieldsObj->setVar('field_admin', (1 == $_REQUEST['field_admin'][$key]) ? 0 : 1); - $fieldsObj->setVar('field_user', (1 == $_REQUEST['field_user'][$key]) ? 0 : 1); - $fieldsObj->setVar('field_block', (1 == $_REQUEST['field_block'][$key]) ? 0 : 1); - $fieldsObj->setVar('field_main', ($key == $_REQUEST['field_main']) ? 0 : 1); - $fieldsObj->setVar('field_search', (1 == $_REQUEST['field_search'][$key]) ? 0 : 1); - $fieldsObj->setVar('field_required', (1 == $_REQUEST['field_required'][$key]) ? 0 : 1); - } - if ($fieldsObj->insert($fieldsObj, true)) { - redirect_header('fields.php', 3, _AM_TDMCREATE_TOGGLE_SUCCESS); - } else { - redirect_header('fields.php', 3, _AM_TDMCREATE_TOGGLE_FAILED); - } + $fieldId = tdmcreate_CleanVars($_POST, 'field_id', 0, 'int'); + if ($fieldId > 0) { + $fieldsObj = $tdmcreate->getHandler('fields')->get($fieldId); + if (isset($_POST['field_parent'])) { + $field_parent = $fieldsObj->getVar('field_parent'); + $fieldsObj->setVar('field_parent', !$field_parent); + } + if (isset($_POST['field_inlist'])) { + $field_inlist = $fieldsObj->getVar('field_inlist'); + $fieldsObj->setVar('field_inlist', !$field_inlist); + } + if (isset($_POST['field_inform'])) { + $field_inform = $fieldsObj->getVar('field_inform'); + $fieldsObj->setVar('field_inform', !$field_inform); + } + if (isset($_POST['field_admin'])) { + $field_admin = $fieldsObj->getVar('field_admin'); + $fieldsObj->setVar('field_admin', !$field_admin); + } + if (isset($_POST['field_user'])) { + $field_user = $fieldsObj->getVar('field_user'); + $fieldsObj->setVar('field_user', !$field_user); + } + if (isset($_POST['field_block'])) { + $field_block = $fieldsObj->getVar('field_block'); + $fieldsObj->setVar('field_block', !$field_block); + } + if (isset($_POST['field_main'])) { + $field_main = $fieldsObj->getVar('field_main'); + $fieldsObj->setVar('field_main', !$field_main); + } + if (isset($_POST['field_search'])) { + $field_search = $fieldsObj->getVar('field_search'); + $fieldsObj->setVar('field_search', !$field_search); + } + if (isset($_POST['field_required'])) { + $field_required = $fieldsObj->getVar('field_required'); + $fieldsObj->setVar('field_required', !$field_required); + } + if ($tdmcreate->getHandler('fields')->insert($fieldsObj)) { + redirect_header('fields.php', 3, _AM_TDMCREATE_TOGGLE_SUCCESS); + } + $GLOBALS['xoopsTpl']->assign('error', $fieldsObj->getHtmlErrors()); + } break; } include __DIR__ . '/footer.php'; \ No newline at end of file diff --git a/admin/modules.php b/admin/modules.php index 2c05b5e8..8793a456 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -40,40 +40,22 @@ $GLOBALS['xoopsTpl']->assign('tdmc_upload_imgmod_url', TDMC_UPLOAD_IMGMOD_URL); $GLOBALS['xoopsTpl']->assign('modPathIcon16', $modPathIcon16); $GLOBALS['xoopsTpl']->assign('sysPathIcon32', $sysPathIcon32); - $criteria = new CriteriaCompo(); - $criteria->setStart($start); - $criteria->setLimit($limit); - $criteria->setSort('mod_id ASC, mod_name'); - $criteria->setOrder('ASC'); - $nb_modules = $tdmcreate->getHandler('modules')->getCount($criteria); - $mods_arr = $tdmcreate->getHandler('modules')->getAll($criteria); - unset($criteria); + $modulesCount = $tdmcreate->getHandler('modules')->getCountModules(); + $modulesAll = $tdmcreate->getHandler('modules')->getAllModules($start, $limit); // Redirect if there aren't modules - if (0 == $nb_modules) { + if (0 == $modulesCount) { redirect_header('modules.php?op=new', 2, _AM_TDMCREATE_NOTMODULES); } // Display modules list - if ($nb_modules > 0) { - foreach (array_keys($mods_arr) as $i) { - $mod['id'] = $i; - $mod['name'] = $mods_arr[$i]->getVar('mod_name'); - $mod['version'] = $mods_arr[$i]->getVar('mod_version'); - $mod['image'] = $mods_arr[$i]->getVar('mod_image'); - $mod['release'] = $mods_arr[$i]->getVar('mod_release'); - $mod['status'] = $mods_arr[$i]->getVar('mod_status'); - $mod['admin'] = $mods_arr[$i]->getVar('mod_admin'); - $mod['user'] = $mods_arr[$i]->getVar('mod_user'); - $mod['blocks'] = $mods_arr[$i]->getVar('mod_blocks'); - $mod['search'] = $mods_arr[$i]->getVar('mod_search'); - $mod['comments'] = $mods_arr[$i]->getVar('mod_comments'); - $mod['notifications'] = $mods_arr[$i]->getVar('mod_notifications'); - $mod['permissions'] = $mods_arr[$i]->getVar('mod_permissions'); - $GLOBALS['xoopsTpl']->append('modules_list', $mod); - unset($mod); + if ($modulesCount > 0) { + foreach (array_keys($modulesAll) as $i) { + $module = $modulesAll[$i]->getValues(); + $GLOBALS['xoopsTpl']->append('modules_list', $module); + unset($module); } - if ($nb_modules > $limit) { + if ($modulesCount > $limit) { include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new XoopsPageNav($nb_modules, $limit, $start, 'start', 'op=list&limit=' . $limit); + $pagenav = new XoopsPageNav($modulesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); } } else { @@ -205,48 +187,44 @@ } break; - case 'display': - //if ( $modId > 0 ) { - $mod_admin = XoopsRequest::getInt('mod_admin'); - $mod_user = XoopsRequest::getInt('mod_user'); - $mod_blocks = XoopsRequest::getInt('mod_blocks'); - $mod_search = XoopsRequest::getInt('mod_search'); - $mod_comments = XoopsRequest::getInt('mod_comments'); - $mod_notifications = XoopsRequest::getInt('mod_notifications'); - $mod_permissions = XoopsRequest::getInt('mod_permissions'); - - //foreach($_POST['mod_id'] as $key => $value) - //{ - /*$mod_admin = tdmcreate_CleanVars($_REQUEST, 'mod_admin'); - $mod_user = tdmcreate_CleanVars($_REQUEST, 'mod_user'); - $mod_blocks = tdmcreate_CleanVars($_REQUEST, 'mod_blocks'); - $mod_search = tdmcreate_CleanVars($_REQUEST, 'mod_search'); - $mod_comments = tdmcreate_CleanVars($_REQUEST, 'mod_comments'); - $mod_notifications = tdmcreate_CleanVars($_REQUEST, 'mod_notifications'); - $mod_permissions = tdmcreate_CleanVars($_REQUEST, 'mod_permissions'); */ - - $modulesObj =& $tdmcreate->getHandler('modules')->get($modId); - if (isset($mod_admin)) { - $modulesObj->setVar('mod_admin', $mod_admin); - } elseif (isset($mod_user)) { - $modulesObj->setVar('mod_user', $mod_user); - } elseif (isset($mod_blocks)) { - $modulesObj->setVar('mod_blocks', $mod_blocks); - } elseif (isset($mod_search)) { - $modulesObj->setVar('mod_search', $mod_search); - } elseif (isset($mod_comments)) { - $modulesObj->setVar('mod_comments', $mod_comments); - } elseif (isset($mod_notifications)) { - $modulesObj->setVar('mod_notifications', $mod_notifications); - } elseif (isset($mod_permissions)) { - $modulesObj->setVar('mod_permissions', $mod_permissions); - } - if ($tdmcreate->getHandler('modules')->insert($modulesObj, true)) { - redirect_header('modules.php', 1, _AM_TDMCREATE_TOGGLE_SUCCESS); - } else { - redirect_header('modules.php', 1, _AM_TDMCREATE_TOGGLE_FAILED); - } - //} + case 'display': + $id = tdmcreate_CleanVars($_POST, 'mod_id', 0, 'int'); + if ($id > 0) { + $modulesObj = $tdmcreate->getHandler('modules')->get($id); + if (isset($_POST['mod_admin'])) { + $mod_admin = $modulesObj->getVar('mod_admin'); + $modulesObj->setVar('mod_admin', !$mod_admin); + } + if (isset($_POST['mod_user'])) { + $mod_user = $modulesObj->getVar('mod_user'); + $modulesObj->setVar('mod_user', !$mod_user); + } + if (isset($_POST['mod_blocks'])) { + $mod_blocks = $modulesObj->getVar('mod_blocks'); + $modulesObj->setVar('mod_blocks', !$mod_blocks); + } + if (isset($_POST['mod_search'])) { + $mod_search = $modulesObj->getVar('mod_search'); + $modulesObj->setVar('mod_search', !$mod_search); + } + if (isset($_POST['mod_comments'])) { + $mod_comments = $modulesObj->getVar('mod_comments'); + $modulesObj->setVar('mod_comments', !$mod_comments); + } + if (isset($_POST['mod_notifications'])) { + $mod_notifications = $modulesObj->getVar('mod_notifications'); + $modulesObj->setVar('mod_notifications', !$mod_notifications); + } + if (isset($_POST['mod_permissions'])) { + $mod_permissions = $modulesObj->getVar('mod_permissions'); + $modulesObj->setVar('mod_permissions', !$mod_permissions); + } + if ($tdmcreate->getHandler('modules')->insert($modulesObj)) { + redirect_header('modules.php', 3, _AM_TDMCREATE_TOGGLE_SUCCESS); + } + $GLOBALS['xoopsTpl']->assign('error', $modulesObj->getHtmlErrors()); + } break; } + include __DIR__ . '/footer.php'; diff --git a/admin/tables.php b/admin/tables.php index 2386cf2e..d81b8695 100644 --- a/admin/tables.php +++ b/admin/tables.php @@ -51,78 +51,45 @@ $GLOBALS['xoopsTpl']->assign('modPathIcon16', $modPathIcon16); $GLOBALS['xoopsTpl']->assign('sysPathIcon32', $sysPathIcon32); // Get the list of modules - $criteria = new CriteriaCompo(); - $criteria->setStart($start); - $criteria->setLimit($limit); - $criteria->setSort('mod_id ASC, mod_name'); - $criteria->setOrder('ASC'); - $numbModules = $tdmcreate->getHandler('modules')->getCount($criteria); + $modulesCount = $tdmcreate->getHandler('modules')->getCountModules(); // Redirect if there aren't modules - if (0 == $numbModules) { + if (0 == $modulesCount) { redirect_header('modules.php?op=new', 10, _AM_TDMCREATE_NOTMODULES); } - $mods_arr = $tdmcreate->getHandler('modules')->getAll($criteria); - unset($criteria); - $numbTables = $tdmcreate->getHandler('tables')->getObjects(null); + $modulesAll = $tdmcreate->getHandler('modules')->getAllModules($start, $limit); + $tablesCount = $tdmcreate->getHandler('tables')->getObjects(null); // Redirect if there aren't tables - if (0 == $numbTables) { + if (0 == $tablesCount) { redirect_header('tables.php?op=new', 10, _AM_TDMCREATE_NOTTABLES); } - unset($numbTables); + unset($tablesCount); // Display modules list - if ($numbModules > 0) { - foreach (array_keys($mods_arr) as $i) { - $mod['id'] = $i; - $mod['name'] = $mods_arr[$i]->getVar('mod_name'); - $mod['image'] = $mods_arr[$i]->getVar('mod_image'); - $mod['admin'] = $mods_arr[$i]->getVar('mod_admin'); - $mod['user'] = $mods_arr[$i]->getVar('mod_user'); - $mod['blocks'] = $mods_arr[$i]->getVar('mod_blocks'); - $mod['search'] = $mods_arr[$i]->getVar('mod_search'); - $mod['comments'] = $mods_arr[$i]->getVar('mod_comments'); - $mod['notifications'] = $mods_arr[$i]->getVar('mod_notifications'); - $mod['permissions'] = $mods_arr[$i]->getVar('mod_permissions'); + if ($modulesCount > 0) { + foreach (array_keys($modulesAll) as $i) { + $module = $modulesAll[$i]->getValues(); // Get the list of tables - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('table_mid', $i)); - $criteria->setSort('table_order ASC, table_id ASC, table_name'); - $criteria->setOrder('ASC'); - $numbTables = $tdmcreate->getHandler('tables')->getCount($criteria); - $tables_arr = $tdmcreate->getHandler('tables')->getAll($criteria); - unset($criteria); + $tablesCount = $tdmcreate->getHandler('tables')->getCountTables(); + $tablesAll = $tdmcreate->getHandler('tables')->getAllTablesByModuleId($i); // Display tables list $tables = array(); $lid = 1; - if ($numbTables > 0) { - foreach (array_keys($tables_arr) as $t) { - $table['id'] = $t; - $table['lid'] = $lid; - $table['mid'] = $tables_arr[$t]->getVar('table_mid'); - $table['name'] = ucfirst($tables_arr[$t]->getVar('table_name')); - $table['image'] = $tables_arr[$t]->getVar('table_image'); - $table['nbfields'] = $tables_arr[$t]->getVar('table_nbfields'); - $table['order'] = $tables_arr[$t]->getVar('table_order'); - $table['blocks'] = $tables_arr[$t]->getVar('table_blocks'); - $table['admin'] = $tables_arr[$t]->getVar('table_admin'); - $table['user'] = $tables_arr[$t]->getVar('table_user'); - $table['submenu'] = $tables_arr[$t]->getVar('table_submenu'); - $table['search'] = $tables_arr[$t]->getVar('table_search'); - $table['comments'] = $tables_arr[$t]->getVar('table_comments'); - $table['notifications'] = $tables_arr[$t]->getVar('table_notifications'); - $table['permissions'] = $tables_arr[$t]->getVar('table_permissions'); - $tables[] = $table; - unset($table); + if ($tablesCount > 0) { + foreach (array_keys($tablesAll) as $t) { + $table = $tablesAll[$t]->getValues(); + $alid = array('lid' => $lid); + $tables[] = array_merge($table, $alid); + unset($table); ++$lid; } } unset($lid); - $mod['tables'] = $tables; - $GLOBALS['xoopsTpl']->append('modules_list', $mod); - unset($mod); + $module['tables'] = $tables; + $GLOBALS['xoopsTpl']->append('modules_list', $module); + unset($module); } - if ($numbModules > $limit) { + if ($modulesCount > $limit) { include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new XoopsPageNav($numbModules, $limit, $start, 'start', 'op=list&limit=' . $limit); + $pagenav = new XoopsPageNav($modulesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); } } else { @@ -155,11 +122,11 @@ // Checking if table name exist in the same module $criteria = new CriteriaCompo(); $criteria->add(new Criteria('table_mid', $tableMid)); - $table_name_search = $tables->getObjects($criteria); + $tableNameSearch = $tables->getObjects($criteria); unset($criteria); //unset($criteria); - foreach (array_keys($table_name_search) as $t) { - if ($table_name_search[$t]->getVar('table_name') === $_POST['table_name']) { + foreach (array_keys($tableNameSearch) as $t) { + if ($tableNameSearch[$t]->getVar('table_name') === $_POST['table_name']) { redirect_header('tables.php?op=new', 3, sprintf(_AM_TDMCREATE_ERROR_TABLE_NAME_EXIST, $_POST['table_name'])); } } @@ -194,7 +161,8 @@ } $tablesObj->setVars(array( 'table_autoincrement' => ((1 == $_REQUEST['table_autoincrement']) ? 1 : 0), - 'table_blocks' => ((1 == $_REQUEST['table_blocks']) ? 1 : 0), + 'table_index' => ((1 == $_REQUEST['table_index']) ? 1 : 0), + 'table_blocks' => ((1 == $_REQUEST['table_blocks']) ? 1 : 0), 'table_admin' => ((1 == $_REQUEST['table_admin']) ? 1 : 0), 'table_user' => ((1 == $_REQUEST['table_user']) ? 1 : 0), 'table_submenu' => ((1 == $_REQUEST['table_submenu']) ? 1 : 0), @@ -278,47 +246,80 @@ } break; - case 'display_modules': - $modules = $tdmcreate->getHandler('modules'); - foreach ($_POST['mod_id'] as $key => $value) { - if ($key > 0) { - $modulesObj =& $tdmcreate->getHandler('modules')->get($value); - $modulesObj->setVar('mod_admin', (1 == $_REQUEST['mod_admin'][$key]) ? 0 : 1); - $modulesObj->setVar('mod_user', (1 == $_REQUEST['mod_user'][$key]) ? 0 : 1); - $modulesObj->setVar('mod_blocks', (1 == $_REQUEST['mod_blocks'][$key]) ? 0 : 1); - $modulesObj->setVar('mod_search', (1 == $_REQUEST['mod_search'][$key]) ? 0 : 1); - $modulesObj->setVar('mod_comments', (1 == $_REQUEST['mod_comments'][$key]) ? 0 : 1); - $modulesObj->setVar('mod_notifications', (1 == $_REQUEST['mod_notifications'][$key]) ? 0 : 1); - $modulesObj->setVar('mod_permissions', (1 == $_REQUEST['mod_permissions'][$key]) ? 0 : 1); + case 'display': + $modId = tdmcreate_CleanVars($_POST, 'mod_id', 0, 'int'); + if ($modId > 0) { + $modulesObj = $tdmcreate->getHandler('modules')->get($modId); + if (isset($_POST['mod_admin'])) { + $mod_admin = $modulesObj->getVar('mod_admin'); + $modulesObj->setVar('mod_admin', !$mod_admin); + } + if (isset($_POST['mod_user'])) { + $mod_user = $modulesObj->getVar('mod_user'); + $modulesObj->setVar('mod_user', !$mod_user); + } + if (isset($_POST['mod_blocks'])) { + $mod_blocks = $modulesObj->getVar('mod_blocks'); + $modulesObj->setVar('mod_blocks', !$mod_blocks); + } + if (isset($_POST['mod_search'])) { + $mod_search = $modulesObj->getVar('mod_search'); + $modulesObj->setVar('mod_search', !$mod_search); + } + if (isset($_POST['mod_comments'])) { + $mod_comments = $modulesObj->getVar('mod_comments'); + $modulesObj->setVar('mod_comments', !$mod_comments); + } + if (isset($_POST['mod_notifications'])) { + $mod_notifications = $modulesObj->getVar('mod_notifications'); + $modulesObj->setVar('mod_notifications', !$mod_notifications); + } + if (isset($_POST['mod_permissions'])) { + $mod_permissions = $modulesObj->getVar('mod_permissions'); + $modulesObj->setVar('mod_permissions', !$mod_permissions); + } + if ($tdmcreate->getHandler('modules')->insert($modulesObj)) { + redirect_header('modules.php', 3, _AM_TDMCREATE_TOGGLE_SUCCESS); } + $GLOBALS['xoopsTpl']->assign('error', $modulesObj->getHtmlErrors()); } - if ($modules->insert($modulesObj, true)) { - redirect_header('modules.php', 1, _AM_TDMCREATE_TOGGLE_SUCCESS); - } else { - redirect_header('modules.php', 1, _AM_TDMCREATE_TOGGLE_FAILED); - } - break; - - case 'display_tables': - $tables = $tdmcreate->getHandler('tables'); - // - foreach ($_POST['table_id'] as $key => $value) { - if ($key > 0) { - $tablesObj =& $tables->get($value); - $tablesObj->setVar('table_admin', (1 == $_REQUEST['table_admin'][$key]) ? 0 : 1); - $tablesObj->setVar('table_user', (1 == $_REQUEST['table_user'][$key]) ? 0 : 1); - $tablesObj->setVar('table_blocks', (1 == $_REQUEST['table_blocks'][$key]) ? 0 : 1); - $tablesObj->setVar('table_submenu', (1 == $_REQUEST['table_submenu'][$key]) ? 0 : 1); - $tablesObj->setVar('table_search', (1 == $_REQUEST['table_search'][$key]) ? 0 : 1); - $tablesObj->setVar('table_comments', (1 == $_REQUEST['table_comments'][$key]) ? 0 : 1); - $tablesObj->setVar('table_notifications', (1 == $_REQUEST['table_notifications'][$key]) ? 0 : 1); + + $tableId = tdmcreate_CleanVars($_POST, 'table_id', 0, 'int'); + if ($tableId > 0) { + $tablesObj = $tdmcreate->getHandler('tables')->get($tableId); + if (isset($_POST['table_admin'])) { + $table_admin = $tablesObj->getVar('table_admin'); + $tablesObj->setVar('table_admin', !$table_admin); + } + if (isset($_POST['table_user'])) { + $table_user = $tablesObj->getVar('table_user'); + $tablesObj->setVar('table_user', !$table_user); + } + if (isset($_POST['table_blocks'])) { + $table_blocks = $tablesObj->getVar('table_blocks'); + $tablesObj->setVar('table_blocks', !$table_blocks); + } + if (isset($_POST['table_search'])) { + $table_search = $tablesObj->getVar('table_search'); + $tablesObj->setVar('table_search', !$table_search); + } + if (isset($_POST['table_comments'])) { + $table_comments = $tablesObj->getVar('table_comments'); + $tablesObj->setVar('table_comments', !$table_comments); + } + if (isset($_POST['table_notifications'])) { + $table_notifications = $tablesObj->getVar('table_notifications'); + $tablesObj->setVar('table_notifications', !$table_notifications); + } + if (isset($_POST['table_permissions'])) { + $table_permissions = $tablesObj->getVar('table_permissions'); + $tablesObj->setVar('table_permissions', !$table_permissions); + } + if ($tdmcreate->getHandler('tables')->insert($tablesObj)) { + redirect_header('tables.php', 3, _AM_TDMCREATE_TOGGLE_SUCCESS); } - } - if ($tables->insert($tablesObj, true)) { - redirect_header('tables.php', 1, _AM_TDMCREATE_TOGGLE_SUCCESS); - } else { - redirect_header('tables.php', 1, _AM_TDMCREATE_TOGGLE_FAILED); - } + $GLOBALS['xoopsTpl']->assign('error', $tablesObj->getHtmlErrors()); + } break; } include __DIR__ . '/footer.php'; diff --git a/assets/icons/16/rss.gif b/assets/icons/16/rss.gif new file mode 100644 index 0000000000000000000000000000000000000000..1176035a66e4e132bbb462b148ef1bb053b1075f GIT binary patch literal 1335 zcmV-71<3kGNk%w1VI%+$0QUd@zDOItOCQED1kySH!c85;QXI)v9?MuC%v&AIUK`9@ z9n4)G&R-tdLjl`H0^Lpl(NYiHQ3l#n2;Nf(-dqgSR}<7%6xdlG&|M+XT_Vq5AJt$7 z)nW_VX9V401Kwf?)?yjfY!lyT63<{D&0r(VVkOODC(dLk&Sx#oXD-oUAkkqZ(PSdl zW+2mPBhzXl(`zNvZ6eumBHDE+*n2J7e>B{CGTnSV;7ydW&q@21LR@^=Vt-sX#nSI3*~JN>RS_V$ZU^mZ0qtx6 z=x+?>Zy)7!5A1OR?Q;j}aSQKv4&-$a2wt6a~$e+80vW!?S2vO zeHQP28}V!a^lt$2Z~*gh1@LqN^m73Bb^!Er1onIc@^}mMdkgS<8RB*#<#sIKcqQd~ zBVhHXhdAPhJL-%#@q{Gvi#7C;Jk^Ix*?>pci&xxRw}|b!j_kUT z?YxomxPte*f%3eJ_`8Jbz?JsEiub^c^}vfiM2-}~dx`RCXC=F|G;+xY3%{pi;H>e>A5-u36; z_UhpD?Be+C;`r|7{qNxX?&S9J>-zBK`10)e_V4xg_4)Sl{QCC#`uY3(`}+R={rma; z{Q3U={r~^~A^8LW00930EC2ui03-kq000R80JSxGL9n2~g9s10Shz4oqiK#NM3_ji zqQ#359^~LL#7Gq@VD|X2vuH&H3n){nT*=acs7Y{wB$?6%PaZyjU|>jrf`o#f3QC|j zvEZkPp+yxOMS;TJJ$K76omrEoPai=nGEe{!3){DK+d_f3acx~TNn^{N1;KWfvUmI3 z{rYpqj~}cme0(_OkCrBK=0rq`rpaGC!GsNq`0yc)oIUBwx{|9OK4zz+ls|v!3KlG!YO(X@s|c=r!jvpA zz=F*aVg7V7jyhsE@kA@l@S~0!2PU}S6HhR~g(d9t1Iion%+tjW1*l*K6vOyai7Wm9 zhistory.go(-1); \ No newline at end of file diff --git a/assets/icons/24/next.png b/assets/icons/24/next.png new file mode 100644 index 0000000000000000000000000000000000000000..5698be5ea423ec23be6e57cab36ae05aaec8186e GIT binary patch literal 677 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjEa{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+AuIMnR~i8hE&{2`t$$4J+m&O1B0RA z1qlWgfwQ^{913hfO(*^quy|}_5GWQ%*5hDi5qN2L;#obvifG4178VAkjudVouE`P- zmwv1l&gOJrn3&Vp)WqbRQfI>KtRx>e4QPRb8V2#UGmT6XuOdXuj0t~&a>c%PY z4F+e*6`B*pX1YWf7_@v!;MHqjIJAM`Nz#)IZsrnc8Xi11)1w-H@$e|l068p-`=3#Q zxyX~O8Lty_X52YFT|dz+!@*b?6e8Sa+;v8Ons&?FochA#%p!69IDe7m_h{bAeTn7$MXjY;_oAK7PAGBCDG?7A^q^}xw5@89p| zaj0(iVK3r*?#W^zcMRM zKP0OL{n4{Y3%SQ!|PaHKN4O<0okn>CHmp@EU1%lo3*x($vSfa#3E)78&q Iol`;+0J(Mg%m4rY literal 0 HcmV?d00001 diff --git a/assets/icons/24/previous.png b/assets/icons/24/previous.png new file mode 100644 index 0000000000000000000000000000000000000000..fe11a3024db684edc25125ca109713305d7a1598 GIT binary patch literal 729 zcmV;~0w(>5P)GJ z7t{WWiHR}%`}dFG&;LIRq$X>C0AfVfz{to5XNO%%2fG|(`0wAp8Gilx#qj3M8!-Rx z-@h0M(O2%-%P48Sx9gDi!~f$)KU zV66r~d;y4GfH(jF#DdFkQBhH_;V{iG!>(Mp0`|$zpFiOkBxh`F%)kJ#Kms|A00M{! zTZF<4hXnv6>mKmcJ_uw%y#hKCOy!VO0@6dMgv15yjgS(p|81Q3P=Un(9; z?%cVP;r{*m7%m0{4a_$%m%}W;28fS8Ag6UK`aZxo00Bg(EP_}v|C8q3-#4#=(mXVr ze?Sd?K&Yqy2q0n#JBTGqK5IVt``|hQBWd*wKmZY2Tth5b{#g?o!PvtdD*y-}yoDVW zzyYlb1faq5f>4bH5J03_0JDSx>Wd$QEC2`~ax5UWt_KgetVar('field_id'); + $ret['mid'] = $this->getVar('field_mid'); + $ret['tid'] = $this->getVar('field_tid'); + $ret['order'] = $this->getVar('field_order'); + $ret['name'] = str_replace('_', ' ', ucfirst($this->getVar('field_name'))); + $ret['parent'] = $this->getVar('field_parent'); + $ret['inlist'] = $this->getVar('field_inlist'); + $ret['inform'] = $this->getVar('field_inform'); + $ret['admin'] = $this->getVar('field_admin'); + $ret['user'] = $this->getVar('field_user'); + $ret['block'] = $this->getVar('field_block'); + $ret['main'] = $this->getVar('field_main'); + $ret['search'] = $this->getVar('field_search'); + $ret['required'] = $this->getVar('field_required'); + + return $ret; + } } /* @@ -537,4 +561,45 @@ public function insert(&$field, $force = false) return true; } + + /** + * Get Count Fields + */ + public function getCountFields($start = 0, $limit = 0, $sort = 'field_id ASC, field_name', $order = 'ASC') + { + $criteria = new CriteriaCompo(); + $criteria->setSort($sort); + $criteria->setOrder($order); + $criteria->setStart($start); + $criteria->setLimit($limit); + return parent::getCount($criteria); + } + + /** + * Get All Fields + */ + public function getAllFields($start = 0, $limit = 0, $sort = 'field_id ASC, field_name', $order = 'ASC') + { + $criteria = new CriteriaCompo(); + $criteria->setSort($sort); + $criteria->setOrder($order); + $criteria->setStart($start); + $criteria->setLimit($limit); + return parent::getAll($criteria); + } + + /** + * Get All Fields By Module & Table Id + */ + public function getAllFieldsByModuleAndTableId($modId, $tabId, $start = 0, $limit = 0, $sort = 'field_id ASC, field_name', $order = 'ASC') + { + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('field_mid', $modId)); + $criteria->add(new Criteria('field_tid', $tabId)); + $criteria->setSort($sort); + $criteria->setOrder($order); + $criteria->setStart($start); + $criteria->setLimit($limit); + return parent::getAll($criteria); + } } diff --git a/class/files/TDMCreateArchitecture.php b/class/files/TDMCreateArchitecture.php index bcaaacac..0f49d335 100644 --- a/class/files/TDMCreateArchitecture.php +++ b/class/files/TDMCreateArchitecture.php @@ -273,8 +273,8 @@ public function createFilesToBuilding($module) if (1 == $tableUser) { // User Pages File $userPages = UserPages::getInstance(); - $userPages->write($module, $table); - $ret[] = $userPages->renderFile($tableName . '.php'); + $userPages->write($module, $table, $tableName . '.php'); + $ret[] = $userPages->renderFile(); // User Templates File $userTemplatesPages = TemplatesUserPages::getInstance(); $userTemplatesPages->write($module, $table); @@ -532,7 +532,7 @@ public function createFilesToBuilding($module) } // User Index File $userIndex = UserIndex::getInstance(); - $userIndex->write($module, 'index.php'); + $userIndex->write($module, $table, 'index.php'); $ret[] = $userIndex->render(); // Language Main File $languageMain = LanguageMain::getInstance(); diff --git a/class/files/admin/AdminObjects.php b/class/files/admin/AdminObjects.php index a9d33687..9ee5ac48 100644 --- a/class/files/admin/AdminObjects.php +++ b/class/files/admin/AdminObjects.php @@ -104,8 +104,8 @@ public function getUrlFileSetVar($moduleDirname, $tableName, $fieldName) \$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'][])) { - \$uploader->fetchMedia(\$_POST['xoops_upload_file'][]); + 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); @@ -133,9 +133,9 @@ public function getImageListSetVar($moduleDirname, $tableName, $fieldName) \$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'][])) { + if (\$uploader->fetchMedia(\$_POST['xoops_upload_file'][1])) { //\$uploader->setPrefix('{$fieldName}_'); - //\$uploader->fetchMedia(\$_POST['xoops_upload_file'][]); + //\$uploader->fetchMedia(\$_POST['xoops_upload_file'][1]); if (!\$uploader->upload()) { \$errors = \$uploader->getErrors(); redirect_header('javascript:history.go(-1)', 3, \$errors); @@ -156,7 +156,7 @@ public function getImageListSetVar($moduleDirname, $tableName, $fieldName) * @param string $fieldName * @return string */ - public function getUploadImageSetVar($moduleDirname, $tableName, $fieldName, $fpmf) + public function getUploadImageSetVar($moduleDirname, $tableName, $fieldName, $fieldMain) { $stuModuleDirname = strtoupper($moduleDirname); $ret = <<getConfig('mimetypes'), \${$moduleDirname}->getConfig('maxsize'), null, null); - if (\$uploader->fetchMedia(\$_POST['xoops_upload_file'][0])) { + if (\$uploader->fetchMedia(\$_POST['xoops_upload_file'][2])) { \$extension = preg_replace( '/^.+\.([^.]+)$/sU' , '' , \$_FILES['attachedfile']['name']); - \$imgName = str_replace(' ', '', \$_POST['{$fpmf}']).'.'.\$extension; + \$imgName = str_replace(' ', '', \$_POST['{$fieldMain}']).'.'.\$extension; \$uploader->setPrefix(\$imgName); - \$uploader->fetchMedia(\$_POST['xoops_upload_file'][0]); + \$uploader->fetchMedia(\$_POST['xoops_upload_file'][2]); if (!\$uploader->upload()) { \$errors = \$uploader->getErrors(); redirect_header('javascript:history.go(-1)', 3, \$errors); @@ -199,9 +199,9 @@ public function getUploadFileSetVar($moduleDirname, $tableName, $fieldName) \$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'][])) { + if (\$uploader->fetchMedia(\$_POST['xoops_upload_file'][3])) { //\$uploader->setPrefix('{$fieldName}_') ; - //\$uploader->fetchMedia(\$_POST['xoops_upload_file'][]); + //\$uploader->fetchMedia(\$_POST['xoops_upload_file'][3]); if (!\$uploader->upload()) { \$errors = \$uploader->getErrors(); redirect_header('javascript:history.go(-1)', 3, \$errors); diff --git a/class/files/admin/AdminPages.php b/class/files/admin/AdminPages.php index 0edd79ea..60aeabfe 100644 --- a/class/files/admin/AdminPages.php +++ b/class/files/admin/AdminPages.php @@ -136,7 +136,6 @@ public function getAdminPagesList($moduleDirname, $table, $language, $fields, $f $ret .= <<getCount{$ucfTableName}(); \${$tableName}All = \${$tableName}Handler->getAll{$ucfTableName}(\$start, \$limit); - unset(\$criteria); \$GLOBALS['xoopsTpl']->assign('{$tableName}_count', \${$tableName}Count); \$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_url', {$stuModuleDirname}_URL); \$GLOBALS['xoopsTpl']->assign('{$moduleDirname}_upload_url', {$stuModuleDirname}_UPLOAD_URL); @@ -146,7 +145,7 @@ public function getAdminPagesList($moduleDirname, $table, $language, $fields, $f foreach (array_keys(\${$tableName}All) as \$i) { \${$tableSoleName} = \${$tableName}All[\$i]->getValues(); - \$GLOBALS['xoopsTpl']->appendByRef('{$tableName}_list', \${$tableSoleName}); + \$GLOBALS['xoopsTpl']->append('{$tableName}_list', \${$tableSoleName}); unset(\${$tableSoleName}); } if ( \${$tableName}Count > \$limit ) { @@ -204,7 +203,7 @@ public function getAdminPagesSave($moduleDirname, $tableName, $language, $fields $ret = <<check() ) { - redirect_header('{$tableName}.php', 3, implode(',', \$GLOBALS['xoopsSecurity']->getErrors())); + redirect_header('{$tableName}.php', 3, implode(',', \$GLOBALS['xoopsSecurity']->getErrors())); } if (isset(\${$fieldId})) { \${$tableName}Obj =& \${$tableName}Handler->get(\${$fieldId}); @@ -249,7 +248,7 @@ public function getAdminPagesSave($moduleDirname, $tableName, $language, $fields $ret .= <<insert(\${$tableName}Obj)) { - redirect_header('{$tableName}.php?op=list', 2, {$language}FORMOK); + redirect_header('{$tableName}.php?op=list', 2, {$language}FORM_OK); } // Get Form \$GLOBALS['xoopsTpl']->assign('error', \${$tableName}Obj->getHtmlErrors()); diff --git a/class/files/cache/classpaths.cache b/class/files/cache/classpaths.cache new file mode 100644 index 00000000..c9644f17 --- /dev/null +++ b/class/files/cache/classpaths.cache @@ -0,0 +1 @@ +a:64:{s:18:"TDMCreateStructure";s:101:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\TDMCreateStructure.php";s:13:"TDMCreateFile";s:96:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\TDMCreateFile.php";s:10:"AdminPages";s:99:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\admin\AdminPages.php";s:12:"AdminObjects";s:101:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\admin\AdminObjects.php";s:19:"TemplatesAdminPages";s:118:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\templates\admin\TemplatesAdminPages.php";s:11:"BlocksFiles";s:101:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\blocks\BlocksFiles.php";s:15:"TemplatesBlocks";s:115:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\templates\blocks\TemplatesBlocks.php";s:10:"ClassFiles";s:101:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\classes\ClassFiles.php";s:9:"UserPages";s:97:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\user\UserPages.php";s:18:"TemplatesUserPages";s:116:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\templates\user\TemplatesUserPages.php";s:15:"LanguageModinfo";s:107:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\language\LanguageModinfo.php";s:11:"AdminHeader";s:100:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\admin\AdminHeader.php";s:10:"AdminIndex";s:99:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\admin\AdminIndex.php";s:9:"AdminMenu";s:98:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\admin\AdminMenu.php";s:10:"AdminAbout";s:99:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\admin\AdminAbout.php";s:11:"AdminFooter";s:100:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\admin\AdminFooter.php";s:19:"TemplatesAdminAbout";s:118:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\templates\admin\TemplatesAdminAbout.php";s:19:"TemplatesAdminIndex";s:118:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\templates\admin\TemplatesAdminIndex.php";s:20:"TemplatesAdminFooter";s:119:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\templates\admin\TemplatesAdminFooter.php";s:20:"TemplatesAdminHeader";s:119:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\templates\admin\TemplatesAdminHeader.php";s:13:"LanguageAdmin";s:105:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\language\LanguageAdmin.php";s:11:"ClassHelper";s:102:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\classes\ClassHelper.php";s:16:"IncludeFunctions";s:107:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\include\IncludeFunctions.php";s:14:"IncludeInstall";s:105:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\include\IncludeInstall.php";s:14:"LanguageBlocks";s:106:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\language\LanguageBlocks.php";s:7:"SqlFile";s:94:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\sql\SqlFile.php";s:13:"IncludeUpdate";s:104:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\include\IncludeUpdate.php";s:13:"IncludeSearch";s:104:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\include\IncludeSearch.php";s:18:"TemplatesUserIndex";s:116:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\templates\user\TemplatesUserIndex.php";s:19:"TemplatesUserFooter";s:117:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\templates\user\TemplatesUserFooter.php";s:19:"TemplatesUserHeader";s:117:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\templates\user\TemplatesUserHeader.php";s:10:"UserFooter";s:98:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\user\UserFooter.php";s:10:"UserHeader";s:98:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\user\UserHeader.php";s:9:"UserIndex";s:97:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\user\UserIndex.php";s:12:"LanguageMain";s:104:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\language\LanguageMain.php";s:9:"CssStyles";s:96:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\css\CssStyles.php";s:13:"IncludeCommon";s:104:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\include\IncludeCommon.php";s:13:"DocsChangelog";s:101:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\docs\DocsChangelog.php";s:12:"LanguageHelp";s:104:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\language\LanguageHelp.php";s:13:"IncludeJquery";s:104:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\include\IncludeJquery.php";s:16:"UserXoopsVersion";s:104:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\user\UserXoopsVersion.php";s:16:"AdminPermissions";s:105:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\admin\AdminPermissions.php";s:25:"TemplatesAdminPermissions";s:124:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\templates\admin\TemplatesAdminPermissions.php";s:20:"IncludeNotifications";s:111:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\include\IncludeNotifications.php";s:15:"LanguageMailTpl";s:107:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\language\LanguageMailTpl.php";s:15:"IncludeComments";s:106:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\include\IncludeComments.php";s:23:"IncludeCommentFunctions";s:114:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\include\IncludeCommentFunctions.php";s:22:"UserNotificationUpdate";s:110:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\user\UserNotificationUpdate.php";s:10:"UserBroken";s:98:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\user\UserBroken.php";s:19:"TemplatesUserBroken";s:117:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\templates\user\TemplatesUserBroken.php";s:9:"UserPrint";s:97:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\user\UserPrint.php";s:16:"TemplatesUserPdf";s:114:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\templates\user\TemplatesUserPdf.php";s:18:"TemplatesUserPrint";s:116:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\templates\user\TemplatesUserPrint.php";s:8:"UserRate";s:96:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\user\UserRate.php";s:17:"TemplatesUserRate";s:115:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\templates\user\TemplatesUserRate.php";s:7:"UserRss";s:95:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\user\UserRss.php";s:16:"TemplatesUserRss";s:114:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\templates\user\TemplatesUserRss.php";s:10:"UserSingle";s:98:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\user\UserSingle.php";s:19:"TemplatesUserSingle";s:117:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\templates\user\TemplatesUserSingle.php";s:10:"UserSubmit";s:98:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\user\UserSubmit.php";s:19:"TemplatesUserSubmit";s:117:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\templates\user\TemplatesUserSubmit.php";s:9:"UserVisit";s:97:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\user\UserVisit.php";s:11:"UserListTag";s:99:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\user\UserListTag.php";s:11:"UserViewTag";s:99:"D:\UwAmp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\tdmcreate\class\files\user\UserViewTag.php";} \ No newline at end of file diff --git a/class/files/classes/ClassFiles.php b/class/files/classes/ClassFiles.php index e54ecad0..dcf581ee 100644 --- a/class/files/classes/ClassFiles.php +++ b/class/files/classes/ClassFiles.php @@ -809,8 +809,9 @@ public function renderFile($filename) $fieldParentId = array(); $fieldElementId = array(); foreach (array_keys($fields) as $f) { - $fieldName = $fields[$f]->getVar('field_name'); - $fieldInForm[] = $fields[$f]->getVar('field_inform'); + $fieldName = $fields[$f]->getVar('field_name'); + $fieldInForm[] = $fields[$f]->getVar('field_inform'); + $fieldParentId[] = $fields[$f]->getVar('field_parent'); if ((0 == $f) && (1 == $table->getVar('table_autoincrement'))) { $fieldId = $fieldName; // $fieldId = fields parameter index field } @@ -818,7 +819,7 @@ public function renderFile($filename) $fieldMain = $fieldName; // $fieldMain = fields parameter main field } if (1 == $fields[$f]->getVar('field_parent')) { - $fieldParent = $fieldName; // $fieldParent = fields parameter parent field + $fieldParent = $fieldName; // $fieldParent = fields parameter parent field } $fieldElement = $fields[$f]->getVar('field_element'); // diff --git a/class/files/classes/ClassFormElements.php b/class/files/classes/ClassFormElements.php index 313162dc..87f3d682 100644 --- a/class/files/classes/ClassFormElements.php +++ b/class/files/classes/ClassFormElements.php @@ -303,7 +303,7 @@ private function getXoopsFormSelectFile($language, $moduleDirname, $fieldName, $ } /* - * @private function getXoopsFormTextFile + * @private function getXoopsFormUrlFile * @param string $language * @param string $moduleDirname * @param string $fieldName @@ -323,13 +323,13 @@ private function getXoopsFormSelectFile($language, $moduleDirname, $fieldName, $ private function getXoopsFormUrlFile($language, $moduleDirname, $fieldName, $fieldDefault, $fieldElement, $required = 'false') { $ret = <<
'); - \$field_text = \$this->isNew() ? '{$fieldDefault}' : \$this->getVar('{$fieldName}'); - \$formText = new XoopsFormText({$language}FORM_TEXT, '{$fieldName}', 75, 255, \$field_text); - \$formTextFile->addElement(\$formText{$required} ); - \$formTextFile->addElement(new XoopsFormFile({$language}FORM_UPLOAD , 'attachedfile', \$this->{$moduleDirname}->getConfig('maxsize')){$required}); - \$form->addElement(\$formTextFile);\n + // Form Url Text File + \$formUrlFile = new XoopsFormElementTray({$language}FORM_FILE,'

'); + \$formFile = \$this->isNew() ? '{$fieldDefault}' : \$this->getVar('{$fieldName}'); + \$formFormText = new XoopsFormText({$language}FORM_TEXT, '{$fieldName}', 75, 255, \$formFile); + \$formUrlFile->addElement(\$formFormText{$required} ); + \$formUrlFile->addElement(new XoopsFormFile({$language}FORM_UPLOAD , 'attachedfile', \$this->{$moduleDirname}->getConfig('maxsize')){$required}); + \$form->addElement(\$formUrlFile);\n EOT; return $ret; diff --git a/class/files/include/IncludeFunctions.php b/class/files/include/IncludeFunctions.php index 57b6f738..c757c87d 100644 --- a/class/files/include/IncludeFunctions.php +++ b/class/files/include/IncludeFunctions.php @@ -140,7 +140,7 @@ public function getFunctionCleanVars($moduleDirname) public function getFunctionMetaKeywords($moduleDirname) { $ret = <<getVar('table_solename'); $ret = << - +<{if {$tableName}_list}> +
\n EOT; $langHeadId = $language . strtoupper($tableSoleName) . '_ID'; if (1 == $table->getVar('table_autoincrement')) { $ret .= <<<{\$smarty.const.{$langHeadId}}>\n + \n EOT; } foreach (array_keys($fields) as $f) { @@ -120,14 +121,14 @@ private function getTemplatesAdminPagesBody($moduleDirname, $table, $fields, $la { $tableName = $table->getVar('table_name'); $ret = << - <{if {$tableName}_count}> + <{if {$tableName}_count}> + <{foreach item=list from=\${$tableName}_list}> \n EOT; if (1 == $table->getVar('table_autoincrement')) { $ret .= <<<{\$list.id}>\n + \n EOT; } foreach (array_keys($fields) as $f) { @@ -172,9 +173,9 @@ private function getTemplatesAdminPagesBody($moduleDirname, $table, $fields, $la - <{/foreach}> - <{/if}> + <{/foreach}> + <{/if}>
<{\$smarty.const.{$langHeadId}}>
<{\$list.id}>
\n EOT; @@ -193,14 +194,14 @@ private function getTemplatesAdminPagesBodyFieldnameEmpty($moduleDirname, $table { $tableName = $table->getVar('table_name'); $ret = << <{if {$tableName}_count}> + <{foreach item=list from=\${$tableName}_list}> \n EOT; if (1 == $table->getVar('table_autoincrement')) { $ret .= <<<{\$list.id}>\n + <{\$list.id}>\n EOT; } foreach (array_keys($fields) as $f) { @@ -244,9 +245,9 @@ private function getTemplatesAdminPagesBodyFieldnameEmpty($moduleDirname, $table - <{/foreach}> - <{/if}> + <{/foreach}> + <{/if}> \n EOT; @@ -266,6 +267,7 @@ private function getTemplatesAdminPagesFooter($moduleDirname)
<{\$pagenav}>
<{/if}> +<{/if}> <{if \$form}>
<{\$form}>
diff --git a/class/files/templates/user/TemplatesUserIndex.php b/class/files/templates/user/TemplatesUserIndex.php index 25c0f674..6b7860c5 100644 --- a/class/files/templates/user/TemplatesUserIndex.php +++ b/class/files/templates/user/TemplatesUserIndex.php @@ -70,29 +70,78 @@ public function write($module, $filename) } /* - * @public function render - * @param null + * @public function getTemplateUserIndexHeader + * @param $moduleDirname */ /** * @return bool|string */ - public function render() + public function getTemplateUserIndexHeader($moduleDirname) { - $module = $this->getModule(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $language = $this->getLanguage($moduleDirname, 'MA'); - $content = << +EOT; + + return $ret; + } + + /* + * @public function getTemplateUserIndexTable + * @param null + */ + /** + * @return bool|string + */ + public function getTemplateUserIndexTable($moduleDirname, $language) + { + $ret = << - - <{\$smarty.const.{$language}INDEX_DESC}> - + + <{\$smarty.const.{$language}INDEX_DESC}> + +EOT; + + return $ret; + } + + /* + * @public function getTemplateUserIndexFooter + * @param $moduleDirname + */ + /** + * @return bool|string + */ + public function getTemplateUserIndexFooter($moduleDirname) + { + $ret = << EOT; + + return $ret; + } + + /* + * @public function render + * @param null + */ + /** + * @return bool|string + */ + public function render() + { + $module = $this->getModule(); + $table = $this->getTable(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $tableCategory = $module->getVar('table_category'); + $language = $this->getLanguage($moduleDirname, 'MA'); + $content = $this->getTemplateUserIndexHeader($moduleDirname); + $content .= $this->getTemplateUserIndexTable($moduleDirname, $language); + $content .= $this->getTemplateUserIndexFooter($moduleDirname); + $this->tdmcfile->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); return $this->tdmcfile->renderFile(); diff --git a/class/files/user/UserIndex.php b/class/files/user/UserIndex.php index 75306b42..911426c1 100644 --- a/class/files/user/UserIndex.php +++ b/class/files/user/UserIndex.php @@ -23,7 +23,7 @@ /** * Class UserIndex */ -class UserIndex extends TDMCreateFile +class UserIndex extends UserObjects { /* * @public function constructor @@ -34,7 +34,9 @@ class UserIndex extends TDMCreateFile */ public function __construct() { - $this->tdmcfile = TDMCreateFile::getInstance(); + parent::__construct(); + $this->tdmcfile = TDMCreateFile::getInstance(); + $this->userobjects = UserObjects::getInstance(); } /* @@ -63,11 +65,157 @@ public static function &getInstance() * @param $module * @param $filename */ - public function write($module, $filename) + public function write($module, $table, $filename) { $this->setModule($module); + $this->setTable($table); $this->setFileName($filename); } + + /** + * @private function getIncludeHeaderFile + * + * @param null + * @return string + */ + private function getIncludeHeaderFile() + { + $ret = <<addStylesheet( \$style );\n +EOT; + + return $ret; + } + + /** + * @private function getBodyIndex + * + * @param $moduleDirname + * @param $language + * @return string + */ + private function getBodyIndex($moduleDirname, $table, $language) + { + $stuModuleDirname = strtoupper($moduleDirname); + $tableName = $table->getVar('table_name'); + $tableSoleName = $table->getVar('table_solename'); + $tableFieldname = $table->getVar('table_fieldname'); + $tableCategory = $table->getVar('table_category'); + $ucfTableName = ucfirst($tableName); + // Fields + $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); + foreach (array_keys($fields) as $f) { + $fieldName = $fields[$f]->getVar('field_name'); + if (0 == $f) { + $fieldId = $fieldName; // fieldMain = fields parameters main field + } + if (1 == $fields[$f]->getVar('field_parent')) { + $fieldParent = $fieldName; // fieldMain = fields parameters main field + } + if (1 == $fields[$f]->getVar('field_main')) { + $fieldMain = $fieldName; // fieldMain = fields parameters main field + } + } + $ret = ''; + if(1 == $tableCategory) { + $ret .= <<add(new Criteria('{$fieldName}', 0, '!='));\n +EOT; + } + if(1 == $tableCategory) { + $ret .= <<add(new Criteria('{$fieldId}', '(' . implode(',', \${$tableName}) . ')','IN')); +EOT; + } + $ret .= <<getCount(\$criteria); +\${$tableName}All = \${$tableName}Handler->getAll(\$criteria); +\$GLOBALS['xoopsTpl']->assign('lang_thereare', sprintf(_MD_{$stuModuleDirname}_INDEX_THEREARE, \${$tableName}Count)); +unset(\$criteria);\n +EOT; + if(1 == $tableCategory) { + $ret .= <<setSort('{$fieldId} ASC, {$fieldMain}'); +\$criteria->setOrder('ASC'); +\$criteria->add(new Criteria('{$fieldId}', '(' . implode(',', \${$tableName}) . ')','IN')); +\${$tableName}All = \${$tableName}Handler->getAll(\$criteria); +// +\$mytree = new XoopsObjectTree(\${$tableName}All, '{$fieldId}', '{$fieldParent}');\n +EOT; + } + $ret .= <<assign('numb_col', \${$moduleDirname}->getConfig('numb_col')); +\$count = 1;\n +EOT; + + return $ret; + } + + /** + * @private function getDefaultFunctions + * + * @param $moduleDirname + * @param $language + * @return string + */ + private function getDefaultFunctions($moduleDirname, $language) + { + $stuModuleDirname = strtoupper($moduleDirname); + $ret = <<getConfig('keywords')); +// description +{$moduleDirname}MetaDescription({$language}DESC); +// +\$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', {$stuModuleDirname}_URL.'/index.php');\n +EOT; + + return $ret; + } + + /** + * @private function getIncludeFooterFile + * + * @param null + * @return string + */ + private function getIncludeFooterFile() + { + $ret = <<getModule(); + $table = $this->getTable(); $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $stu_mod_name = strtoupper($moduleDirname); + $moduleDirname = $module->getVar('mod_dirname'); $language = $this->getLanguage($moduleDirname, 'MA'); $content = $this->getHeaderFilesComments($module, $filename); - $content .= <<addStylesheet( \$style ); -// keywords -{$moduleDirname}_meta_keywords(\${$moduleDirname}->getConfig('keywords')); -// description -{$moduleDirname}_meta_description({$language}DESC); -// -\$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', {$stu_mod_name}_URL.'/index.php'); -// -include __DIR__ . '/footer.php'; -EOT; - $this->tdmcfile->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $content .= $this->getIncludeHeaderFile(); + $content .= $this->getTemplateHeaderFile($moduleDirname); + $content .= $this->getBodyIndex($moduleDirname, $table, $language); + $content .= $this->getDefaultFunctions($moduleDirname, $language); + $content .= $this->getIncludeFooterFile(); + // + $this->tdmcfile->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); return $this->tdmcfile->renderFile(); } diff --git a/class/files/user/UserPages.php b/class/files/user/UserPages.php index 2aafdd0a..8e50e464 100644 --- a/class/files/user/UserPages.php +++ b/class/files/user/UserPages.php @@ -56,19 +56,18 @@ public static function &getInstance() return $instance; } - /* - * @public function write - * @param string $module - * @param string $table - */ /** + * @public function write + * * @param $module * @param $table + * @param $filename */ - public function write($module, $table) + public function write($module, $table, $filename) { $this->setModule($module); $this->setTable($table); + $this->setFileName($filename); } /* @@ -89,7 +88,7 @@ private function getUserPages($moduleDirname, $language) $tableFieldname = $table->getVar('table_fieldname'); $stuModuleDirname = strtoupper($moduleDirname); $stuTableName = strtoupper($tableName); - $stlTableName = strtolower($tableName); + $lcfTableName = lcfirst($tableName); $ucfTableName = ucfirst($tableName); $ret = <<assign('{$moduleDirname}_upload_url', {$stuModuleDirname}_UPLOAD_URL); // -\${$stlTableName}Count = \${$stlTableName}Handler->getCount{$ucfTableName}(); -\${$stlTableName}All = \${$stlTableName}Handler->getAll{$ucfTableName}(\$start, \$limit); +\${$lcfTableName}Count = \${$lcfTableName}Handler->getCount{$ucfTableName}(); +\${$lcfTableName}All = \${$lcfTableName}Handler->getAll{$ucfTableName}(\$start, \$limit); \$keywords = array(); -if (\${$stlTableName}Count > 0) { +if (\${$lcfTableName}Count > 0) { // Get All {$ucfTableName} - foreach (array_keys(\${$stlTableName}All) as \$i) + foreach (array_keys(\${$lcfTableName}All) as \$i) { \${$tableSoleName} = \${$tableName}All[\$i]->getValues(); - \$GLOBALS['xoopsTpl']->appendByRef('{$tableName}_list', \${$tableSoleName}); + \$GLOBALS['xoopsTpl']->append('{$tableName}_list', \${$tableSoleName}); unset(\${$tableSoleName});\n EOT; // Fields @@ -125,12 +124,12 @@ private function getUserPages($moduleDirname, $language) } } $ret .= <<getVar('{$fieldMain}'); + \$keywords[] = \${$lcfTableName}All[\$i]->getVar('{$fieldMain}'); } // Display Navigation - if (\${$stlTableName}Count > \$limit) { + if (\${$lcfTableName}Count > \$limit) { include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - \$nav = new XoopsPageNav(\${$stlTableName}Count, \$limit, \$start, 'start'); + \$nav = new XoopsPageNav(\${$lcfTableName}Count, \$limit, \$start, 'start'); \$GLOBALS['xoopsTpl']->assign('pagenav', \$nav->renderNav(4)); } } @@ -140,7 +139,7 @@ private function getUserPages($moduleDirname, $language) // description {$moduleDirname}_meta_description({$language}{$stuTableName}_DESC); // -\$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', {$stuModuleDirname}_URL.'/{$stlTableName}.php'); +\$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', {$stuModuleDirname}_URL.'/{$lcfTableName}.php'); // include __DIR__ . '/footer.php'; EOT; @@ -156,9 +155,10 @@ private function getUserPages($moduleDirname, $language) * @param $filename * @return bool|string */ - public function renderFile($filename) + public function renderFile() { $module = $this->getModule(); + $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); $language = $this->getLanguage($moduleDirname, 'MA'); $content = $this->getHeaderFilesComments($module, $filename); diff --git a/class/files/user/UserXoopsVersion.php b/class/files/user/UserXoopsVersion.php index 1dbbbef7..64631f80 100644 --- a/class/files/user/UserXoopsVersion.php +++ b/class/files/user/UserXoopsVersion.php @@ -112,6 +112,107 @@ public function getKeywords() { return $this->keywords; } + + /** + * @private function getModVersionHeaderComment + * + * @param $comment + * @return string + */ + private function getModVersionHeaderComment($comment) + { + $ret = <<getVar('mod_id'); + $ret['name'] = $this->getVar('mod_name'); + $ret['version'] = $this->getVar('mod_version'); + $ret['image'] = $this->getVar('mod_image'); + $ret['release'] = $this->getVar('mod_release'); + $ret['status'] = $this->getVar('mod_status'); + $ret['admin'] = $this->getVar('mod_admin'); + $ret['user'] = $this->getVar('mod_user'); + $ret['blocks'] = $this->getVar('mod_blocks'); + $ret['search'] = $this->getVar('mod_search'); + $ret['comments'] = $this->getVar('mod_comments'); + $ret['notifications'] = $this->getVar('mod_notifications'); + $ret['permissions'] = $this->getVar('mod_permissions'); + + return $ret; + } } /* @@ -505,4 +529,30 @@ public function &insert(&$field, $force = false) return true; } + + /** + * Get Count Modules + */ + public function getCountModules($start = 0, $limit = 0, $sort = 'mod_id ASC, mod_name', $order = 'ASC') + { + $criteria = new CriteriaCompo(); + $criteria->setSort($sort); + $criteria->setOrder($order); + $criteria->setStart($start); + $criteria->setLimit($limit); + return parent::getCount($criteria); + } + + /** + * Get All Modules + */ + public function getAllModules($start = 0, $limit = 0, $sort = 'mod_id ASC, mod_name', $order = 'ASC') + { + $criteria = new CriteriaCompo(); + $criteria->setSort($sort); + $criteria->setOrder($order); + $criteria->setStart($start); + $criteria->setLimit($limit); + return parent::getAll($criteria); + } } diff --git a/class/tables.php b/class/tables.php index f0d15373..9e35335e 100644 --- a/class/tables.php +++ b/class/tables.php @@ -58,7 +58,8 @@ public function __construct() $this->initVar('table_order', XOBJ_DTYPE_INT); $this->initVar('table_image', XOBJ_DTYPE_TXTBOX); $this->initVar('table_autoincrement', XOBJ_DTYPE_INT); - $this->initVar('table_blocks', XOBJ_DTYPE_INT); + $this->initVar('table_index', XOBJ_DTYPE_INT); + $this->initVar('table_blocks', XOBJ_DTYPE_INT); $this->initVar('table_admin', XOBJ_DTYPE_INT); $this->initVar('table_user', XOBJ_DTYPE_INT); $this->initVar('table_submenu', XOBJ_DTYPE_INT); @@ -211,6 +212,11 @@ public function getForm($action = false) $table_checkbox_all->setClass('xo-checkall'); $options_tray->addElement($table_checkbox_all); // + $table_index = $isNew ? 0 : $this->getVar('table_index'); + $check_table_index = new XoopsFormCheckBox(' ', 'table_index', $table_index); + $check_table_index->addOption(1, _AM_TDMCREATE_TABLE_INDEX); + $options_tray->addElement($check_table_index); + // $table_blocks = $isNew ? 0 : $this->getVar('table_blocks'); $check_table_blocks = new XoopsFormCheckBox(' ', 'table_blocks', $table_blocks); $check_table_blocks->addOption(1, _AM_TDMCREATE_TABLE_BLOCKS); @@ -327,6 +333,31 @@ public function getForm($action = false) return $form; } + + /** + * Get Values + */ + public function getValues($keys = null, $format = null, $maxDepth = null) + { + $ret = parent::getValues($keys, $format, $maxDepth); + // Values + $ret['id'] = $this->getVar('table_id'); + $ret['mid'] = $this->getVar('table_mid'); + $ret['name'] = ucfirst($this->getVar('table_name')); + $ret['image'] = $this->getVar('table_image'); + $ret['nbfields'] = $this->getVar('table_nbfields'); + $ret['order'] = $this->getVar('table_order'); + $ret['blocks'] = $this->getVar('table_blocks'); + $ret['admin'] = $this->getVar('table_admin'); + $ret['user'] = $this->getVar('table_user'); + $ret['submenu'] = $this->getVar('table_submenu'); + $ret['search'] = $this->getVar('table_search'); + $ret['comments'] = $this->getVar('table_comments'); + $ret['notifications'] = $this->getVar('table_notifications'); + $ret['permissions'] = $this->getVar('table_permissions'); + + return $ret; + } } /* @@ -401,4 +432,44 @@ public function &insert(&$field, $force = false) return true; } + + /** + * Get Count Modules + */ + public function getCountTables($start = 0, $limit = 0, $sort = 'table_id ASC, table_name', $order = 'ASC') + { + $criteria = new CriteriaCompo(); + $criteria->setSort($sort); + $criteria->setOrder($order); + $criteria->setStart($start); + $criteria->setLimit($limit); + return parent::getCount($criteria); + } + + /** + * Get All Modules + */ + public function getAllTables($start = 0, $limit = 0, $sort = 'table_id ASC, table_name', $order = 'ASC') + { + $criteria = new CriteriaCompo(); + $criteria->setSort($sort); + $criteria->setOrder($order); + $criteria->setStart($start); + $criteria->setLimit($limit); + return parent::getAll($criteria); + } + + /** + * Get All Tables By Module Id + */ + public function getAllTablesByModuleId($modId, $start = 0, $limit = 0, $sort = 'table_id ASC, table_name', $order = 'ASC') + { + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('table_mid', $modId)); + $criteria->setSort($sort); + $criteria->setOrder($order); + $criteria->setStart($start); + $criteria->setLimit($limit); + return parent::getAll($criteria); + } } diff --git a/sql/mysql.sql b/sql/mysql.sql index 9fe8875a..55930390 100644 --- a/sql/mysql.sql +++ b/sql/mysql.sql @@ -106,7 +106,7 @@ CREATE TABLE `tdmcreate_modules` ( )ENGINE =InnoDB; # -# Table structure for table `tdmcreate_tables` 27 +# Table structure for table `tdmcreate_tables` 28 # CREATE TABLE `tdmcreate_tables` ( @@ -119,7 +119,8 @@ CREATE TABLE `tdmcreate_tables` ( `table_nbfields` INT(5) UNSIGNED NOT NULL DEFAULT '0', `table_order` INT(5) UNSIGNED NOT NULL DEFAULT '0', `table_image` VARCHAR(150) NOT NULL DEFAULT '', - `table_autoincrement` TINYINT(1) NOT NULL DEFAULT '1', + `table_autoincrement` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1', + `table_index` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0', `table_blocks` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0', `table_admin` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1', `table_user` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0', diff --git a/templates/admin/tdmcreate_modules.tpl b/templates/admin/tdmcreate_modules.tpl index 2eb8aece..3d00ff6f 100644 --- a/templates/admin/tdmcreate_modules.tpl +++ b/templates/admin/tdmcreate_modules.tpl @@ -27,19 +27,19 @@ <{$module.release}> <{$module.status}> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> diff --git a/templates/admin/tdmcreate_tables.tpl b/templates/admin/tdmcreate_tables.tpl index 3d8a3ad2..83509b7b 100644 --- a/templates/admin/tdmcreate_tables.tpl +++ b/templates/admin/tdmcreate_tables.tpl @@ -30,20 +30,20 @@ <{$module.name}> 16 - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> Submenu - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> diff --git a/templates/admin/tdmcreate_tables_item.tpl b/templates/admin/tdmcreate_tables_item.tpl index 6ea54290..828cc774 100644 --- a/templates/admin/tdmcreate_tables_item.tpl +++ b/templates/admin/tdmcreate_tables_item.tpl @@ -7,21 +7,21 @@ <{$table.name}> <{$table.name}> <{$table.nbfields}> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}> + <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}> + <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}> + <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}> + <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}> + <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}> + <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}> + <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}> + <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}>