Patch #2984893 - InnoDB storage page emits warning
[phpmyadmin/last10db.git] / libraries / db_structure.lib.php
blob63e146effed815d4d9cf33535a7d2d927bdd784b
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 * @package phpMyAdmin
7 */
8 if (! defined('PHPMYADMIN')) {
9 exit;
12 // Display function
13 /**
14 * void PMA_TableHeader([bool $db_is_information_schema = false])
15 * display table header (<table><thead>...</thead><tbody>)
17 * @uses PMA_showHint()
18 * @uses $GLOBALS['cfg']['PropertiesNumColumns']
19 * @uses $GLOBALS['is_show_stats']
20 * @uses $GLOBALS['strTable']
21 * @uses $GLOBALS['strAction']
22 * @uses $GLOBALS['strRecords']
23 * @uses $GLOBALS['strApproximateCount']
24 * @uses $GLOBALS['strType']
25 * @uses $GLOBALS['strCollation']
26 * @uses $GLOBALS['strSize']
27 * @uses $GLOBALS['strOverhead']
28 * @uses $GLOBALS['structure_tbl_col_cnt']
29 * @uses PMA_SortableTableHeader()
30 * @param boolean $db_is_information_schema
31 * @param boolean $replication
33 function PMA_TableHeader($db_is_information_schema = false, $replication = false)
35 $cnt = 0; // Let's count the columns...
37 if ($db_is_information_schema) {
38 $action_colspan = 3;
39 } else {
40 $action_colspan = 6;
43 echo '<table class="data" style="float: left;">' . "\n"
44 .'<thead>' . "\n"
45 .'<tr><th></th>' . "\n"
46 .' <th>' . PMA_SortableTableHeader($GLOBALS['strTable'], 'table') . '</th>' . "\n";
47 if ($replication) {
48 echo ' <th>' . "\n"
49 .' ' . $GLOBALS['strReplication'] . "\n"
50 .' </th>';
52 echo ' <th colspan="' . $action_colspan . '">' . "\n"
53 .' ' . $GLOBALS['strAction'] . "\n"
54 .' </th>'
55 // larger values are more interesting so default sort order is DESC
56 .' <th>' . PMA_SortableTableHeader($GLOBALS['strRecords'], 'records', 'DESC')
57 .PMA_showHint(PMA_sanitize($GLOBALS['strApproximateCount'])) . "\n"
58 .' </th>' . "\n";
59 if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) {
60 echo ' <th>' . PMA_SortableTableHeader($GLOBALS['strType'], 'type') . '</th>' . "\n";
61 $cnt++;
62 echo ' <th>' . PMA_SortableTableHeader($GLOBALS['strCollation'], 'collation') . '</th>' . "\n";
63 $cnt++;
65 if ($GLOBALS['is_show_stats']) {
66 // larger values are more interesting so default sort order is DESC
67 echo ' <th>' . PMA_SortableTableHeader($GLOBALS['strSize'], 'size', 'DESC') . '</th>' . "\n"
68 // larger values are more interesting so default sort order is DESC
69 . ' <th>' . PMA_SortableTableHeader($GLOBALS['strOverhead'], 'overhead', 'DESC') . '</th>' . "\n";
70 $cnt += 2;
72 echo '</tr>' . "\n";
73 echo '</thead>' . "\n";
74 echo '<tbody>' . "\n";
75 $GLOBALS['structure_tbl_col_cnt'] = $cnt + $action_colspan + 3;
76 } // end function PMA_TableHeader()
79 /**
80 * Creates a clickable column header for table information
82 * @param string title to use for the link
83 * @param string corresponds to sortable data name mapped in libraries/db_info.inc.php
84 * @param string initial sort order
85 * @returns string link to be displayed in the table header
87 function PMA_SortableTableHeader($title, $sort, $initial_sort_order = 'ASC')
89 // Set some defaults
90 $requested_sort = 'table';
91 $requested_sort_order = $future_sort_order = $initial_sort_order;
93 // If the user requested a sort
94 if (isset($_REQUEST['sort'])) {
95 $requested_sort = $_REQUEST['sort'];
97 if (isset($_REQUEST['sort_order'])) {
98 $requested_sort_order = $_REQUEST['sort_order'];
102 $order_img = '';
103 $order_link_params = array();
104 $order_link_params['title'] = $GLOBALS['strSort'];
106 // If this column was requested to be sorted.
107 if ($requested_sort == $sort) {
108 if ($requested_sort_order == 'ASC') {
109 $future_sort_order = 'DESC';
110 // current sort order is ASC
111 $order_img = ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 's_asc.png" width="11" height="9" alt="'. $GLOBALS['strAscending'] . '" title="'. $GLOBALS['strAscending'] . '" id="sort_arrow" />';
112 // but on mouse over, show the reverse order (DESC)
113 $order_link_params['onmouseover'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';
114 // on mouse out, show current sort order (ASC)
115 $order_link_params['onmouseout'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';
116 } else {
117 $future_sort_order = 'ASC';
118 // current sort order is DESC
119 $order_img = ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 's_desc.png" width="11" height="9" alt="'. $GLOBALS['strDescending'] . '" title="'. $GLOBALS['strDescending'] . '" id="sort_arrow" />';
120 // but on mouse over, show the reverse order (ASC)
121 $order_link_params['onmouseover'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';
122 // on mouse out, show current sort order (DESC)
123 $order_link_params['onmouseout'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';
127 $_url_params = array(
128 'db' => $_REQUEST['db'],
131 $url = 'db_structure.php'.PMA_generate_common_url($_url_params);
132 // We set the position back to 0 every time they sort.
133 $url .= "&amp;pos=0&amp;sort=$sort&amp;sort_order=$future_sort_order";
135 return PMA_linkOrButton($url, $title . $order_img, $order_link_params);
136 } // end function PMA_SortableTableHeader()