From 9e27e02688f4bb5e425fc2a9819fdbc3f55f82c9 Mon Sep 17 00:00:00 2001 From: Deven Bansod Date: Mon, 28 Nov 2016 10:16:11 +0530 Subject: [PATCH 1/2] Refactor intials row to use template Signed-off-by: Deven Bansod --- libraries/server_privileges.lib.php | 34 +++++-------------------- templates/privileges/initials_row.phtml | 28 ++++++++++++++++++++ 2 files changed, 34 insertions(+), 28 deletions(-) create mode 100644 templates/privileges/initials_row.phtml diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php index 2e15d52902..4d0da96332 100644 --- a/libraries/server_privileges.lib.php +++ b/libraries/server_privileges.lib.php @@ -3713,34 +3713,12 @@ function PMA_getHtmlForInitials($array_initials) uksort($array_initials, "strnatcasecmp"); - $html_output = '' - . ''; - foreach ($array_initials as $tmp_initial => $initial_was_found) { - if ($tmp_initial === null) { - continue; - } - - if (!$initial_was_found) { - $html_output .= ''; - continue; - } - - $html_output .= '' . "\n"; - } - $html_output .= '' . "\n"; - $html_output .= '
' . $tmp_initial . '' - . '' . $tmp_initial - . '' - . '' - . '' . __('Show all') . '
'; + $html_output = Template::get('privileges/initials_row') + ->render( + array( + 'array_initials' => $array_initials + ) + ); return $html_output; } diff --git a/templates/privileges/initials_row.phtml b/templates/privileges/initials_row.phtml new file mode 100644 index 0000000000..500375cda7 --- /dev/null +++ b/templates/privileges/initials_row.phtml @@ -0,0 +1,28 @@ + + + $initial_was_found) : ?> + + + + + + + + + + + + + +
+ + $tmp_initial)); ?> + + + + + +
From 0a56073acd6d934f5c498bffbd9ce3701c81b06f Mon Sep 17 00:00:00 2001 From: Deven Bansod Date: Mon, 28 Nov 2016 10:27:17 +0530 Subject: [PATCH 2/2] Adjust tests Signed-off-by: Deven Bansod --- test/libraries/PMA_server_privileges_test.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/libraries/PMA_server_privileges_test.php b/test/libraries/PMA_server_privileges_test.php index 83f67726fd..01a3872bea 100644 --- a/test/libraries/PMA_server_privileges_test.php +++ b/test/libraries/PMA_server_privileges_test.php @@ -2426,13 +2426,13 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase $this->assertContains('A', $actual); $this->assertContains('Z', $actual); $this->assertContains( - '-', + . 'collation_connection">-', $actual ); $this->assertContains( - '"', $actual