PMA\libraries\DisplayResults::_getTableHeadersForColumns PHP Method

_getTableHeadersForColumns() private method

Get the headers of the results table, for all of the columns
See also: getTableHeaders()
private _getTableHeadersForColumns ( array $displayParts, array $analyzed_sql_results, array $sort_expression, array $sort_expression_nodirection, array $sort_direction, boolean $is_limited_display, string $unsorted_sql_query ) : string
$displayParts array which elements to display
$analyzed_sql_results array analyzed sql results
$sort_expression array sort expression
$sort_expression_nodirection array sort expression without direction
$sort_direction array sort direction
$is_limited_display boolean with limited operations or not
$unsorted_sql_query string query without the sort part
return string html content
    private function _getTableHeadersForColumns($displayParts, $analyzed_sql_results, $sort_expression, $sort_expression_nodirection, $sort_direction, $is_limited_display, $unsorted_sql_query)
    {
        $html = '';
        // required to generate sort links that will remember whether the
        // "Show all" button has been clicked
        $sql_md5 = md5($this->__get('sql_query'));
        $session_max_rows = $is_limited_display ? 0 : $_SESSION['tmpval']['query'][$sql_md5]['max_rows'];
        // Following variable are needed for use in isset/empty or
        // use with array indexes/safe use in the for loop
        $highlight_columns = $this->__get('highlight_columns');
        $fields_meta = $this->__get('fields_meta');
        // Prepare Display column comments if enabled
        // ($GLOBALS['cfg']['ShowBrowseComments']).
        $comments_map = $this->_getTableCommentsArray($analyzed_sql_results);
        list($col_order, $col_visib) = $this->_getColumnParams($analyzed_sql_results);
        // optimize: avoid calling a method on each iteration
        $number_of_columns = $this->__get('fields_cnt');
        for ($j = 0; $j < $number_of_columns; $j++) {
            // assign $i with the appropriate column order
            $i = $col_order ? $col_order[$j] : $j;
            //  See if this column should get highlight because it's used in the
            //  where-query.
            $name = $fields_meta[$i]->name;
            $condition_field = isset($highlight_columns[$name]) || isset($highlight_columns[Util::backquote($name)]) ? true : false;
            // Prepare comment-HTML-wrappers for each row, if defined/enabled.
            $comments = $this->_getCommentForRow($comments_map, $fields_meta[$i]);
            $display_params = $this->__get('display_params');
            if ($displayParts['sort_lnk'] == '1' && !$is_limited_display) {
                list($order_link, $sorted_header_html) = $this->_getOrderLinkAndSortedHeaderHtml($fields_meta[$i], $sort_expression, $sort_expression_nodirection, $i, $unsorted_sql_query, $session_max_rows, $comments, $sort_direction, $col_visib, $col_visib[$j]);
                $html .= $sorted_header_html;
                $display_params['desc'][] = '    <th ' . 'class="draggable' . ($condition_field ? ' condition' : '') . '" data-column="' . htmlspecialchars($fields_meta[$i]->name) . '">' . "\n" . $order_link . $comments . '    </th>' . "\n";
            } else {
                // Results can't be sorted
                $html .= $this->_getDraggableClassForNonSortableColumns($col_visib, $col_visib[$j], $condition_field, $fields_meta[$i], $comments);
                $display_params['desc'][] = '    <th ' . 'class="draggable' . ($condition_field ? ' condition"' : '') . '" data-column="' . htmlspecialchars($fields_meta[$i]->name) . '">' . '        ' . htmlspecialchars($fields_meta[$i]->name) . $comments . '    </th>';
            }
            // end else
            $this->__set('display_params', $display_params);
        }
        // end for
        return $html;
    }
DisplayResults