Skip to content

Commit

Permalink
Remove odd CSS class handling from PHP code
Browse files Browse the repository at this point in the history
Odd class is no longer needed as it's now done with CSS.

Signed-off-by: Patric Gustafsson <patricjgustafsson@outlook.com>
  • Loading branch information
vosgus committed Aug 15, 2016
1 parent ea764e7 commit 80d625d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
9 changes: 3 additions & 6 deletions libraries/DbSearch.php
Expand Up @@ -273,7 +273,6 @@ public function getSearchResults()
. '</caption>';

$num_search_result_total = 0;
$odd_row = true;
// For each table selected as search criteria
foreach ($this->_criteriaTables as $each_table) {
// Gets the SQL statements
Expand All @@ -283,9 +282,8 @@ public function getSearchResults()
$num_search_result_total += $res_cnt;
// Gets the result row's HTML for a table
$html_output .= $this->_getResultsRow(
$each_table, $newsearchsqls, $odd_row, $res_cnt
$each_table, $newsearchsqls, $res_cnt
);
$odd_row = ! $odd_row;
} // end for
$html_output .= '</table>';
// Displays total number of matches
Expand All @@ -310,12 +308,11 @@ public function getSearchResults()
*
* @param string $each_table One of the tables on which search was performed
* @param array $newsearchsqls Contains SQL queries
* @param bool $odd_row For displaying contrasting table rows
* @param integer $res_cnt Number of results found
*
* @return string HTML row
*/
private function _getResultsRow($each_table, $newsearchsqls, $odd_row, $res_cnt)
private function _getResultsRow($each_table, $newsearchsqls, $res_cnt)
{
$this_url_params = array(
'db' => $GLOBALS['db'],
Expand All @@ -325,7 +322,7 @@ private function _getResultsRow($each_table, $newsearchsqls, $odd_row, $res_cnt)
'is_js_confirmed' => 0,
);
// Start forming search results row
$html_output = '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">';
$html_output = '<tr class="noclick">';
// Displays results count for a table
$html_output .= '<td>';
$html_output .= sprintf(
Expand Down
7 changes: 3 additions & 4 deletions test/classes/DbSearchTest.php
Expand Up @@ -121,22 +121,21 @@ public function testGetSearchResults()
*
* @param string $each_table Tables on which search is to be performed
* @param array $newsearchsqls Contains SQL queries
* @param bool $odd_row For displaying contrasting table rows
* @param string $output Expected HTML output
*
* @return void
*
* @dataProvider providerForTestGetResultsRow
*/
public function testGetResultsRow(
$each_table, $newsearchsqls, $odd_row, $output
$each_table, $newsearchsqls, $output
) {

$this->assertEquals(
$output,
$this->_callProtectedFunction(
'_getResultsRow',
array($each_table, $newsearchsqls, $odd_row, 2)
array($each_table, $newsearchsqls, 2)
)
);
}
Expand All @@ -159,7 +158,7 @@ public function providerForTestGetResultsRow()
'delete' => 'column2'
),
true,
'<tr class="noclick odd"><td>2 matches in <strong>table1</strong>'
'<tr class="noclick"><td>2 matches in <strong>table1</strong>'
. '</td><td><a name="browse_search" class="ajax" '
. 'href="sql.php?db=pma&amp;table'
. '=table1&amp;goto=db_sql.php&amp;pos=0&amp;is_js_confirmed=0&amp;'
Expand Down

0 comments on commit 80d625d

Please sign in to comment.