Move the column count obtaining logic to a separate method

Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
This commit is contained in:
Madhura Jayaratne 2015-06-12 18:24:47 +05:30
parent ab9a8bdd25
commit 8dacdd198e

View File

@ -422,14 +422,7 @@ class PMA_DbQbe
*/
private function _getSortOrderSelectCell($columnNumber, $sortOrder)
{
$totalColumnCount = $this->_criteria_column_count;
if (! empty($this->_criteriaColumnInsert)) {
$totalColumnCount += count($this->_criteriaColumnInsert);
}
if (! empty($this->_criteriaColumnDelete)) {
$totalColumnCount -= count($this->_criteriaColumnDelete);
}
$totalColumnCount = $this->_getNewColumnCount();
$html_output = '<td class="center">';
$html_output .= '<select name="criteriaSortOrder[' . $columnNumber . ']">';
$html_output .= '<option value="1000">'
@ -446,6 +439,23 @@ class PMA_DbQbe
return $html_output;
}
/**
* Returns the new column count after adding and removing columns as instructed
*
* @return int new column count
*/
private function _getNewColumnCount()
{
$totalColumnCount = $this->_criteria_column_count;
if (! empty($this->_criteriaColumnInsert)) {
$totalColumnCount += count($this->_criteriaColumnInsert);
}
if (! empty($this->_criteriaColumnDelete)) {
$totalColumnCount -= count($this->_criteriaColumnDelete);
}
return $totalColumnCount;
}
/**
* Provides search form's row containing column select options
*