module_creator improvement on column headers and findcols

This commit is contained in:
OpenXE 2023-03-02 09:52:36 +01:00
parent 2ffee66e00
commit cb8b2487d7
2 changed files with 7 additions and 2 deletions

View File

@ -17,6 +17,8 @@
* PLACEHOLDER_GET_INPUT * PLACEHOLDER_GET_INPUT
* PLACEHOLDER_SET_INPUT * PLACEHOLDER_SET_INPUT
* PLACEHOLDER_COLUMNS * PLACEHOLDER_COLUMNS
* PLACEHOLDER_ID_COLUMN
* PLACEHOLDER_HEADERS
* PLACEHOLDER_SET_TPL * PLACEHOLDER_SET_TPL
*/ */
@ -164,6 +166,7 @@ if ($argc >= 2) {
// Create php file // Create php file
$list_of_columns = implode(', ', $columns); $list_of_columns = implode(', ', $columns);
$list_of_columns_headers_in_quotes = "'" . implode('\', \'', array_map('ucfirst',$columns)) . "'";
$list_of_columns_in_quotes = "'" . implode('\', \'', $columns) . "'"; $list_of_columns_in_quotes = "'" . implode('\', \'', $columns) . "'";
$sql_list_of_columns = implode(', ', $sql_columns); $sql_list_of_columns = implode(', ', $sql_columns);
$sql_list_of_columns_in_quotes = "'" . 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_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_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_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_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"); $php_file = fopen($target_php_folder . $php_file_name, "w");

View File

@ -30,13 +30,13 @@ class PLACEHOLDER_MODULECLASSNAME {
switch ($name) { switch ($name) {
case "PLACEHOLDER_LIST": case "PLACEHOLDER_LIST":
$allowed['PLACEHOLDER_LIST'] = array('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 $width = array('1%','1%','10%'); // Fill out manually later
// columns that are aligned right (numbers etc) // columns that are aligned right (numbers etc)
// $alignright = array(4,5,6,7,8); // $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); $searchsql = array(PLACEHOLDER_SQL_COLUMNS);
$defaultorder = 1; $defaultorder = 1;