diff --git a/libraries/classes/Database/MultiTableQuery.php b/libraries/classes/Database/MultiTableQuery.php index f52c3af33b..9259116207 100644 --- a/libraries/classes/Database/MultiTableQuery.php +++ b/libraries/classes/Database/MultiTableQuery.php @@ -42,45 +42,12 @@ class MultiTableQuery private function getColumnsHTML() { $tables = $GLOBALS['dbi']->getTables($this->_db); - $html_output = '
'; - for ($i = 0; $i < count($tables); $i++) - { - $html_output .= ''; - } - - $html_output .= ''; - - for ($i = 1; $i <= $this->_default_no_of_columns; $i++) - { - $html_output .= Template::get('database/multi_table_query/new_column')->render(array( - 'id' => $i, - 'tables' => $tables - )); - } - $html_output .= '
'; - $html_output .= ''; - $html_output .= '
 '; - $html_output .= '
'; - - $html_output .= '
'; - $html_output .= ''; - $html_output .= '
'; - - $html_output .= '
'; - - return $html_output; + return Template::get('database/multi_table_query/columns')->render([ + 'tables' => $tables, + 'dbi' => $GLOBALS['dbi'], + 'db' => $this->_db, + 'default_no_of_columns' => $this->_default_no_of_columns, + ]); } public function getFormHTML() diff --git a/templates/database/multi_table_query/columns.twig b/templates/database/multi_table_query/columns.twig new file mode 100644 index 0000000000..c17c4114ea --- /dev/null +++ b/templates/database/multi_table_query/columns.twig @@ -0,0 +1,34 @@ +
+ {% set tables_count = tables|length - 1 %} + {% for i in 0..tables_count %} + + {% endfor %} + + + + {% for i in 1..default_no_of_columns %} + {% include 'database/multi_table_query/new_column.twig' with { + 'id': i, + 'tables': tables + } only %} + {% endfor %} +
+ +
  +
+ +
+ +
+