From 00485eb593e94b051c5839dd03c15aeb982fc32a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 4 Sep 2017 12:28:18 +0200 Subject: [PATCH] Share code for getting column params MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue #13604 Signed-off-by: Michal Čihař --- libraries/DisplayResults.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/libraries/DisplayResults.php b/libraries/DisplayResults.php index 2d734b8961..c0cf01e838 100644 --- a/libraries/DisplayResults.php +++ b/libraries/DisplayResults.php @@ -1298,9 +1298,7 @@ class DisplayResults . ''; // Output data needed for column reordering and show/hide column - if ($this->_isSelect($analyzed_sql_results)) { - $table_headers_html .= $this->_getDataForResettingColumnOrder(); - } + $table_headers_html .= $this->_getDataForResettingColumnOrder($analyzed_sql_results); $display_params['emptypre'] = 0; $display_params['emptyafter'] = 0; @@ -1641,28 +1639,32 @@ class DisplayResults /** * Prepare data for column restoring and show/hide * + * @param array $analyzed_sql_results analyzed sql results + * * @return string $data_html html content * * @access private * * @see _getTableHeaders() */ - private function _getDataForResettingColumnOrder() + private function _getDataForResettingColumnOrder($analyzed_sql_results) { - - $data_html = ''; + if (! $this->_isSelect($analyzed_sql_results)) { + return ''; + } // generate the column order, if it is set - $pmatable = new Table($this->__get('table'), $this->__get('db')); - $col_order = $pmatable->getUiProp(Table::PROP_COLUMN_ORDER); + list($col_order, $col_visib) = $this->_getColumnParams( + $analyzed_sql_results + ); + + $data_html = ''; if ($col_order) { $data_html .= ''; } - $col_visib = $pmatable->getUiProp(Table::PROP_COLUMN_VISIB); - if ($col_visib) { $data_html .= '';