display_tbl.lib.php

来自「phpMyAdmin图形界面化操作,我已经配置好了,只要把解要压缩后的文件放到站」· PHP 代码 · 共 1,349 行 · 第 1/5 页

PHP
1,349
字号
            $order_link_params = array();            if (isset($order_img) && $order_img!='') {                if (strstr($order_img, 'asc')) {                    $order_link_params['onmouseover'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';                    $order_link_params['onmouseout']  = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';                } elseif (strstr($order_img, 'desc')) {                    $order_link_params['onmouseover'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';                    $order_link_params['onmouseout']  = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';                }            }            if ($_SESSION['userconf']['disp_direction'] == 'horizontalflipped'             && $GLOBALS['cfg']['HeaderFlipType'] == 'css') {                $order_link_params['style'] = 'direction: ltr; writing-mode: tb-rl;';            }            $order_link_params['title'] = $GLOBALS['strSort'];            $order_link_content = ($_SESSION['userconf']['disp_direction'] == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'fake' ? PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), "<br />\n") : htmlspecialchars($fields_meta[$i]->name));            $order_link = PMA_linkOrButton($order_url, $order_link_content . $order_img, $order_link_params, false, true);            if ($_SESSION['userconf']['disp_direction'] == 'horizontal'             || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {                echo '<th';                if ($condition_field) {                    echo ' class="condition"';                }                if ($_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {                    echo ' valign="bottom"';                }                echo '>' . $order_link . $comments . '</th>';            }            $vertical_display['desc'][] = '    <th '                . ($condition_field ? ' class="condition"' : '') . '>' . "\n"                . $order_link . $comments . '    </th>' . "\n";        } // end if (2.1)        // 2.2 Results can't be sorted        else {            if ($_SESSION['userconf']['disp_direction'] == 'horizontal'             || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {                echo '<th';                if ($condition_field) {                    echo ' class="condition"';                }                if ($_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {                    echo ' valign="bottom"';                }                if ($_SESSION['userconf']['disp_direction'] == 'horizontalflipped'                 && $GLOBALS['cfg']['HeaderFlipType'] == 'css') {                    echo ' style="direction: ltr; writing-mode: tb-rl;"';                }                echo '>';                if ($_SESSION['userconf']['disp_direction'] == 'horizontalflipped'                 && $GLOBALS['cfg']['HeaderFlipType'] == 'fake') {                    echo PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), '<br />');                } else {                    echo htmlspecialchars($fields_meta[$i]->name);                }                echo "\n" . $comments . '</th>';            }            $vertical_display['desc'][] = '    <th '                . ($condition_field ? ' class="condition"' : '') . '>' . "\n"                . '        ' . htmlspecialchars($fields_meta[$i]->name) . "\n"                . $comments . '    </th>';        } // end else (2.2)    } // end for    // 3. Displays the needed checkboxes at the right    //    column of the result table header if possible and required...    if ($GLOBALS['cfg']['ModifyDeleteAtRight']        && ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn')        && $is_display['text_btn'] == '1') {        $vertical_display['emptyafter'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 3 : 1;        if ($_SESSION['userconf']['disp_direction'] == 'horizontal'         || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {            echo "\n";            ?><th <?php echo $colspan; ?>></th>            <?php        } // end horizontal/horizontalflipped mode        else {            $vertical_display['textbtn'] = '    <th ' . $rowspan . ' valign="middle">' . "\n"                                         . '        ' . "\n"                                         . '    </th>' . "\n";        } // end vertical mode    }    //     ... elseif no button, displays empty columns if required    // (unless coming from Browse mode print view)    elseif ($GLOBALS['cfg']['ModifyDeleteAtRight']             && ($is_display['edit_lnk'] == 'nn' && $is_display['del_lnk'] == 'nn')             && (!$GLOBALS['is_header_sent'])) {        $vertical_display['emptyafter'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 3 : 1;        if ($_SESSION['userconf']['disp_direction'] == 'horizontal'         || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {            echo "\n";            ?><td<?php echo $colspan; ?>></td>            <?php        } // end horizontal/horizontalflipped mode        else {            $vertical_display['textbtn'] = '    <td' . $rowspan . '></td>' . "\n";        } // end vertical mode    }    if ($_SESSION['userconf']['disp_direction'] == 'horizontal'     || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {        ?></tr></thead>        <?php    }    return true;} // end of the 'PMA_displayTableHeaders()' function/** * Displays the body of the results table * * @uses    $_SESSION['userconf']['disp_direction'] * @uses    $_SESSION['userconf']['repeat_cells'] * @uses    $_SESSION['userconf']['max_rows'] * @uses    $_SESSION['userconf']['display_text'] * @uses    $_SESSION['userconf']['display_binary'] * @uses    $_SESSION['userconf']['display_blob'] * @param   integer  the link id associated to the query which results have *                   to be displayed * @param   array    which elements to display * @param   array    the list of relations * @param   array    the analyzed query * * @return  boolean  always true * * @global  string   $db                the database name * @global  string   $table             the table name * @global  string   $goto              the URL to go back in case of errors * @global  string   $sql_query         the SQL query * @global  array    $fields_meta       the list of fields properties * @global  integer  $fields_cnt        the total number of fields returned by *                                      the SQL query * @global  array    $vertical_display  informations used with vertical display *                                      mode * @global  array    $highlight_columns column names to highlight * @global  array    $row               current row data * * @access  private * * @see     PMA_displayTable() */function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {    global $db, $table, $goto;    global $sql_query, $fields_meta, $fields_cnt;    global $vertical_display, $highlight_columns;    global $row; // mostly because of browser transformations, to make the row-data accessible in a plugin    $url_sql_query          = $sql_query;    // query without conditions to shorten URLs when needed, 200 is just    // guess, it should depend on remaining URL length    if (isset($analyzed_sql) && isset($analyzed_sql[0]) &&        isset($analyzed_sql[0]['querytype']) && $analyzed_sql[0]['querytype'] == 'SELECT' &&        strlen($sql_query) > 200) {        $url_sql_query = 'SELECT ';        if (isset($analyzed_sql[0]['queryflags']['distinct'])) {            $url_sql_query .= ' DISTINCT ';        }        $url_sql_query .= $analyzed_sql[0]['select_expr_clause'];        if (!empty($analyzed_sql[0]['from_clause'])) {            $url_sql_query .= ' FROM ' . $analyzed_sql[0]['from_clause'];        }    }    if (!is_array($map)) {        $map = array();    }    $row_no                         = 0;    $vertical_display['edit']       = array();    $vertical_display['delete']     = array();    $vertical_display['data']       = array();    $vertical_display['row_delete'] = array();    // Correction University of Virginia 19991216 in the while below    // Previous code assumed that all tables have keys, specifically that    // the phpMyAdmin GUI should support row delete/edit only for such    // tables.    // Although always using keys is arguably the prescribed way of    // defining a relational table, it is not required. This will in    // particular be violated by the novice.    // We want to encourage phpMyAdmin usage by such novices. So the code    // below has been changed to conditionally work as before when the    // table being displayed has one or more keys; but to display    // delete/edit options correctly for tables without keys.    $odd_row = true;    while ($row = PMA_DBI_fetch_row($dt_result)) {        // lem9: "vertical display" mode stuff        if ($row_no != 0 && $_SESSION['userconf']['repeat_cells'] != 0 && !($row_no % $_SESSION['userconf']['repeat_cells'])          && ($_SESSION['userconf']['disp_direction'] == 'horizontal'           || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped'))        {            echo '<tr>' . "\n";            if ($vertical_display['emptypre'] > 0) {                echo '    <th colspan="' . $vertical_display['emptypre'] . '">' . "\n"                    .'        &nbsp;</th>' . "\n";            }            foreach ($vertical_display['desc'] as $val) {                echo $val;            }            if ($vertical_display['emptyafter'] > 0) {                echo '    <th colspan="' . $vertical_display['emptyafter'] . '">' . "\n"                    .'        &nbsp;</th>' . "\n";            }            echo '</tr>' . "\n";        } // end if        $class = $odd_row ? 'odd' : 'even';        $odd_row = ! $odd_row;        if ($_SESSION['userconf']['disp_direction'] == 'horizontal'         || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {            // loic1: pointer code part            echo '    <tr class="' . $class . '">' . "\n";            $class = '';        }        // 1. Prepares the row (gets primary keys to use)        // 1.1 Results from a "SELECT" statement -> builds the        //     "primary" key to use in links        /**         * @todo $unique_condition could be empty, for example a table         *       with only one field and it's a BLOB; in this case,         *       avoid to display the delete and edit links         */        $unique_condition      = PMA_getUniqueCondition($dt_result, $fields_cnt, $fields_meta, $row);        $unique_condition_html = htmlspecialchars($unique_condition);        // 1.2 Defines the URLs for the modify/delete link(s)        if ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn') {            // We need to copy the value or else the == 'both' check will always return true            if ($GLOBALS['cfg']['PropertiesIconic'] === 'both') {                $iconic_spacer = '<div class="nowrap">';            } else {                $iconic_spacer = '';            }            // 1.2.1 Modify link(s)            if ($is_display['edit_lnk'] == 'ur') { // update row case                $_url_params = array(                    'db'            => $db,                    'table'         => $table,                    'primary_key'   => $unique_condition,                    'sql_query'     => $url_sql_query,                    'goto'          => 'sql.php',                );                $edit_url = 'tbl_change.php' . PMA_generate_common_url($_url_params);                $edit_str = PMA_getIcon('b_edit.png', $GLOBALS['strEdit'], true);            } // end if (1.2.1)            if (isset($GLOBALS['cfg']['Bookmark']['table']) && isset($GLOBALS['cfg']['Bookmark']['db']) && $table == $GLOBALS['cfg']['Bookmark']['table'] && $db == $GLOBALS['cfg']['Bookmark']['db'] && isset($row[1]) && isset($row[0])) {                $_url_params = array(                    'db'                    => $row[1],                    'id_bookmark'           => $row[0],

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?