PMA\libraries\DisplayResults::_getTableNavigation PHP Method

_getTableNavigation() private method

Get a navigation bar to browse among the results of a SQL query
See also: _getTable()
private _getTableNavigation ( integer $pos_next, integer $pos_prev, boolean $is_innodb, string $sort_by_key_html ) : string
$pos_next integer the offset for the "next" page
$pos_prev integer the offset for the "previous" page
$is_innodb boolean whether its InnoDB or not
$sort_by_key_html string the sort by key dialog
return string html content
    private function _getTableNavigation($pos_next, $pos_prev, $is_innodb, $sort_by_key_html)
    {
        $table_navigation_html = '';
        // here, using htmlentities() would cause problems if the query
        // contains accented characters
        $html_sql_query = htmlspecialchars($this->__get('sql_query'));
        // Navigation bar
        $table_navigation_html .= '<table class="navigation nospacing nopadding print_ignore">' . '<tr>' . '<td class="navigation_separator"></td>';
        // Move to the beginning or to the previous page
        if ($_SESSION['tmpval']['pos'] && $_SESSION['tmpval']['max_rows'] != self::ALL_ROWS) {
            $table_navigation_html .= $this->_getMoveBackwardButtonsForTableNavigation($html_sql_query, $pos_prev);
        }
        // end move back
        $nbTotalPage = 1;
        //page redirection
        // (unless we are showing all records)
        if ($_SESSION['tmpval']['max_rows'] != self::ALL_ROWS) {
            list($table_navigation_html, $nbTotalPage) = $this->_getHtmlPageSelector($table_navigation_html);
        }
        $showing_all = false;
        if ($_SESSION['tmpval']['max_rows'] == self::ALL_ROWS) {
            $showing_all = true;
        }
        // Move to the next page or to the last one
        $endpos = $_SESSION['tmpval']['pos'] + $_SESSION['tmpval']['max_rows'];
        if ($this->__get('unlim_num_rows') === false || $endpos < $this->__get('unlim_num_rows') && $this->__get('num_rows') >= $_SESSION['tmpval']['max_rows'] && $_SESSION['tmpval']['max_rows'] != self::ALL_ROWS) {
            $table_navigation_html .= $this->_getMoveForwardButtonsForTableNavigation($html_sql_query, $pos_next, $is_innodb);
        }
        // end move toward
        // show separator if pagination happen
        if ($nbTotalPage > 1) {
            $table_navigation_html .= '<td><div class="navigation_separator">|</div></td>';
        }
        // Display the "Show all" button if allowed
        if ($GLOBALS['cfg']['ShowAll'] || $this->__get('unlim_num_rows') <= 500) {
            $table_navigation_html .= $this->_getShowAllCheckboxForTableNavigation($showing_all, $html_sql_query);
            $table_navigation_html .= '<td><div class="navigation_separator">|</div></td>';
        }
        // end show all
        $table_navigation_html .= '<td>' . '<div class="save_edited hide">' . '<input type="submit" value="' . __('Save edited data') . '" />' . '<div class="navigation_separator">|</div>' . '</div>' . '</td>' . '<td>' . '<div class="restore_column hide">' . '<input type="submit" value="' . __('Restore column order') . '" />' . '<div class="navigation_separator">|</div>' . '</div>' . '</td>';
        // if displaying a VIEW, $unlim_num_rows could be zero because
        // of $cfg['MaxExactCountViews']; in this case, avoid passing
        // the 5th parameter to checkFormElementInRange()
        // (this means we can't validate the upper limit
        $table_navigation_html .= '<td class="navigation_goto">';
        $table_navigation_html .= '<form action="sql.php" method="post" ' . 'onsubmit="return ' . '(checkFormElementInRange(' . 'this, ' . '\'session_max_rows\', ' . '\'' . str_replace('\'', '\\\'', __('%d is not valid row number.')) . '\', ' . '1)' . ' &amp;&amp; ' . 'checkFormElementInRange(' . 'this, ' . '\'pos\', ' . '\'' . str_replace('\'', '\\\'', __('%d is not valid row number.')) . '\', ' . '0' . ($this->__get('unlim_num_rows') > 0 ? ', ' . ($this->__get('unlim_num_rows') - 1) : '') . ')' . ')' . '">';
        $table_navigation_html .= URL::getHiddenInputs($this->__get('db'), $this->__get('table'));
        $table_navigation_html .= $this->_getAdditionalFieldsForTableNavigation($html_sql_query);
        $table_navigation_html .= '</form>' . '</td>' . '<td class="navigation_separator"></td>' . '<td>' . '<span>' . __('Filter rows') . ':</span>' . '<input type="text" class="filter_rows"' . ' placeholder="' . __('Search this table') . '"' . ' data-for="' . $this->__get('unique_id') . '" />' . '</td>';
        $table_navigation_html .= '<td>' . $sort_by_key_html . '</td>';
        $table_navigation_html .= '<td class="navigation_separator"></td>' . '</tr>' . '</table>';
        return $table_navigation_html;
    }
DisplayResults