Share code for getting column params

Issue #13604

Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
Michal Čihař 2017-09-04 12:28:18 +02:00
parent aa75d66eec
commit 00485eb593

View File

@ -1298,9 +1298,7 @@ class DisplayResults
. '</div>';
// 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 .= '<input class="col_order" type="hidden" value="'
. implode(',', $col_order) . '" />';
}
$col_visib = $pmatable->getUiProp(Table::PROP_COLUMN_VISIB);
if ($col_visib) {
$data_html .= '<input class="col_visib" type="hidden" value="'
. implode(',', $col_visib) . '" />';