From 0db0ba0c55de3cafb1cbbbe69ebcdc5c2fab4e4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Sat, 27 Jan 2018 22:50:42 -0200 Subject: [PATCH] Use template for getContinueInsertionForm method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MaurĂ­cio Meneghini Fauth --- libraries/classes/InsertEdit.php | 43 ++++++++----------- .../table/insert/continue_insertion_form.twig | 19 ++++++++ 2 files changed, 36 insertions(+), 26 deletions(-) create mode 100644 templates/table/insert/continue_insertion_form.twig diff --git a/libraries/classes/InsertEdit.php b/libraries/classes/InsertEdit.php index 7bda46b844..2c53895410 100644 --- a/libraries/classes/InsertEdit.php +++ b/libraries/classes/InsertEdit.php @@ -14,6 +14,7 @@ use PhpMyAdmin\Plugins\TransformationsPlugin; use PhpMyAdmin\Relation; use PhpMyAdmin\Response; use PhpMyAdmin\Sanitize; +use PhpMyAdmin\Template; use PhpMyAdmin\Transformations; use PhpMyAdmin\Url; use PhpMyAdmin\Util; @@ -1448,32 +1449,22 @@ class InsertEdit * * @return string an html snippet */ - public static function getContinueInsertionForm($table, $db, array $where_clause_array, $err_url) - { - $html_output = '
' - . Url::getHiddenInputs($db, $table) - . '' - . '' - . ''; - - if (isset($_REQUEST['where_clause'])) { - foreach ($where_clause_array as $key_id => $where_clause) { - - $html_output .= '' . "\n"; - } - } - $tmp = '' . "\n"; - $tmp .= '' . "\n"; - $html_output .= "\n" . sprintf(__('Continue insertion with %s rows'), $tmp); - unset($tmp); - $html_output .= '
' . "\n"; - return $html_output; + public static function getContinueInsertionForm( + $table, + $db, + array $where_clause_array, + $err_url + ) { + return Template::get('table/insert/continue_insertion_form')->render([ + 'db' => $db, + 'table' => $table, + 'where_clause_array' => $where_clause_array, + 'err_url' => $err_url, + 'goto' => $GLOBALS['goto'], + 'sql_query' => isset($_POST['sql_query']) ? $_POST['sql_query'] : null, + 'has_where_clause' => isset($_REQUEST['where_clause']), + 'insert_rows_default' => $GLOBALS['cfg']['InsertRows'], + ]); } /** diff --git a/templates/table/insert/continue_insertion_form.twig b/templates/table/insert/continue_insertion_form.twig new file mode 100644 index 0000000000..c39a96f3e8 --- /dev/null +++ b/templates/table/insert/continue_insertion_form.twig @@ -0,0 +1,19 @@ +
+ {{ Url_getHiddenInputs(db, table) }} + + + + + {% if has_where_clause %} + {% for key_id, where_clause in where_clause_array %} + + {% endfor %} + {% endif %} + + {% set insert_rows %} + + {% endset %} + {{ 'Continue insertion with %s rows'|trans|format(insert_rows)|raw }} +