PMA\libraries\DisplayResults::_getOrderLinkAndSortedHeaderHtml PHP Method

_getOrderLinkAndSortedHeaderHtml() private method

Prepare parameters and html for sorted table header fields
See also: _getTableHeaders()
private _getOrderLinkAndSortedHeaderHtml ( array $fields_meta, array $sort_expression, array $sort_expression_nodirection, integer $column_index, string $unsorted_sql_query, integer $session_max_rows, string $comments, array $sort_direction, boolean $col_visib, string $col_visib_j ) : array
$fields_meta array set of field properties
$sort_expression array sort expression
$sort_expression_nodirection array sort expression without direction
$column_index integer the index of the column
$unsorted_sql_query string the unsorted sql query
$session_max_rows integer maximum rows resulted by sql
$comments string comment for row
$sort_direction array sort direction
$col_visib boolean column is visible(false) array column isn't visible(string array)
$col_visib_j string element of $col_visib array
return array 2 element array - $order_link, $sorted_header_html
    private function _getOrderLinkAndSortedHeaderHtml($fields_meta, $sort_expression, $sort_expression_nodirection, $column_index, $unsorted_sql_query, $session_max_rows, $comments, $sort_direction, $col_visib, $col_visib_j)
    {
        $sorted_header_html = '';
        // Checks if the table name is required; it's the case
        // for a query with a "JOIN" statement and if the column
        // isn't aliased, or in queries like
        // SELECT `1`.`master_field` , `2`.`master_field`
        // FROM `PMA_relation` AS `1` , `PMA_relation` AS `2`
        $sort_tbl = isset($fields_meta->table) && strlen($fields_meta->table) > 0 && $fields_meta->orgname == $fields_meta->name ? Util::backquote($fields_meta->table) . '.' : '';
        $name_to_use_in_sort = $fields_meta->name;
        // Generates the orderby clause part of the query which is part
        // of URL
        list($single_sort_order, $multi_sort_order, $order_img) = $this->_getSingleAndMultiSortUrls($sort_expression, $sort_expression_nodirection, $sort_tbl, $name_to_use_in_sort, $sort_direction, $fields_meta, $column_index);
        if (preg_match('@(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|' . 'LOCK IN SHARE MODE))@is', $unsorted_sql_query, $regs3)) {
            $single_sorted_sql_query = $regs3[1] . $single_sort_order . $regs3[2];
            $multi_sorted_sql_query = $regs3[1] . $multi_sort_order . $regs3[2];
        } else {
            $single_sorted_sql_query = $unsorted_sql_query . $single_sort_order;
            $multi_sorted_sql_query = $unsorted_sql_query . $multi_sort_order;
        }
        $_single_url_params = array('db' => $this->__get('db'), 'table' => $this->__get('table'), 'sql_query' => $single_sorted_sql_query, 'session_max_rows' => $session_max_rows, 'is_browse_distinct' => $this->__get('is_browse_distinct'));
        $_multi_url_params = array('db' => $this->__get('db'), 'table' => $this->__get('table'), 'sql_query' => $multi_sorted_sql_query, 'session_max_rows' => $session_max_rows, 'is_browse_distinct' => $this->__get('is_browse_distinct'));
        $single_order_url = 'sql.php' . URL::getCommon($_single_url_params);
        $multi_order_url = 'sql.php' . URL::getCommon($_multi_url_params);
        // Displays the sorting URL
        // enable sort order swapping for image
        $order_link = $this->_getSortOrderLink($order_img, $column_index, $fields_meta, $single_order_url, $multi_order_url);
        $sorted_header_html .= $this->_getDraggableClassForSortableColumns($col_visib, $col_visib_j, $fields_meta, $order_link, $comments);
        return array($order_link, $sorted_header_html);
    }
DisplayResults