From cb8b2487d744eade8dfa2a3b19998944f8bbe597 Mon Sep 17 00:00:00 2001 From: OpenXE <> Date: Thu, 2 Mar 2023 09:52:36 +0100 Subject: [PATCH] module_creator improvement on column headers and findcols --- tools/module_creator/module_creator.php | 5 +++++ tools/module_creator/module_creator_php_template.txt | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/module_creator/module_creator.php b/tools/module_creator/module_creator.php index c015c7cf..82265d96 100644 --- a/tools/module_creator/module_creator.php +++ b/tools/module_creator/module_creator.php @@ -17,6 +17,8 @@ * PLACEHOLDER_GET_INPUT * PLACEHOLDER_SET_INPUT * PLACEHOLDER_COLUMNS + * PLACEHOLDER_ID_COLUMN + * PLACEHOLDER_HEADERS * PLACEHOLDER_SET_TPL */ @@ -164,6 +166,7 @@ if ($argc >= 2) { // Create php file $list_of_columns = implode(', ', $columns); + $list_of_columns_headers_in_quotes = "'" . implode('\', \'', array_map('ucfirst',$columns)) . "'"; $list_of_columns_in_quotes = "'" . implode('\', \'', $columns) . "'"; $sql_list_of_columns = implode(', ', $sql_columns); $sql_list_of_columns_in_quotes = "'" . implode('\', \'', $sql_columns) . "'"; @@ -194,6 +197,8 @@ if ($argc >= 2) { $php_file_contents = str_replace('PLACEHOLDER_GET_INPUT', $get_input, $php_file_contents); $php_file_contents = str_replace('PLACEHOLDER_SET_INPUT', $set_input, $php_file_contents); $php_file_contents = str_replace('PLACEHOLDER_COLUMNS', $list_of_columns_in_quotes, $php_file_contents); + $php_file_contents = str_replace('PLACEHOLDER_ID_COLUMN', $table_short_name.".id", $php_file_contents); + $php_file_contents = str_replace('PLACEHOLDER_HEADERS', $list_of_columns_headers_in_quotes, $php_file_contents); $php_file_contents = str_replace('PLACEHOLDER_SQL_COLUMNS', $sql_list_of_columns_in_quotes, $php_file_contents); $php_file = fopen($target_php_folder . $php_file_name, "w"); diff --git a/tools/module_creator/module_creator_php_template.txt b/tools/module_creator/module_creator_php_template.txt index d3af660d..4aad87da 100644 --- a/tools/module_creator/module_creator_php_template.txt +++ b/tools/module_creator/module_creator_php_template.txt @@ -30,13 +30,13 @@ class PLACEHOLDER_MODULECLASSNAME { switch ($name) { case "PLACEHOLDER_LIST": $allowed['PLACEHOLDER_LIST'] = array('list'); - $heading = array('','',PLACEHOLDER_COLUMNS, 'Menü'); + $heading = array('','',PLACEHOLDER_HEADERS, 'Menü'); $width = array('1%','1%','10%'); // Fill out manually later // columns that are aligned right (numbers etc) // $alignright = array(4,5,6,7,8); - $findcols = array(PLACEHOLDER_SQL_COLUMNS); + $findcols = array('PLACEHOLDER_ID_COLUMN','PLACEHOLDER_ID_COLUMN',PLACEHOLDER_SQL_COLUMNS); $searchsql = array(PLACEHOLDER_SQL_COLUMNS); $defaultorder = 1;