Translation update done using Pootle.
[phpmyadmin.git] / db_printview.php
blob5512fa6391434b7c3a3e6742b07786707fea07c7
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @package PhpMyAdmin
6 */
8 /**
11 require_once './libraries/common.inc.php';
13 /**
14 * Gets the variables sent or posted to this script, then displays headers
16 $print_view = true;
17 require_once './libraries/header.inc.php';
19 PMA_checkParameters(array('db'));
21 /**
22 * Defines the url to return to in case of error in a sql statement
24 $err_url = 'db_sql.php?' . PMA_generate_common_url($db);
26 /**
27 * Settings for relations stuff
29 $cfgRelation = PMA_getRelationsParam();
31 /**
32 * Gets the list of the table in the current db and informations about these
33 * tables if possible
35 * @todo merge this speedup _optionaly_ into PMA_DBI_get_tables_full()
37 // speedup view on locked tables
38 // Special speedup for newer MySQL Versions (in 4.0 format changed)
39 if ($cfg['SkipLockedTables'] == true) {
40 $result = PMA_DBI_query('SHOW OPEN TABLES FROM ' . PMA_backquote($db) . ';');
41 // Blending out tables in use
42 if ($result != false && PMA_DBI_num_rows($result) > 0) {
43 while ($tmp = PMA_DBI_fetch_row($result)) {
44 // if in use memorize tablename
45 if (preg_match('@in_use=[1-9]+@i', $tmp[0])) {
46 $sot_cache[$tmp[0]] = true;
49 PMA_DBI_free_result($result);
51 if (isset($sot_cache)) {
52 $result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE);
53 if ($result != false && PMA_DBI_num_rows($result) > 0) {
54 while ($tmp = PMA_DBI_fetch_row($result)) {
55 if (! isset($sot_cache[$tmp[0]])) {
56 $sts_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . PMA_sqlAddSlashes($tmp[0], true) . '\';');
57 $sts_tmp = PMA_DBI_fetch_assoc($sts_result);
58 $tables[] = $sts_tmp;
59 } else { // table in use
60 $tables[] = array('Name' => $tmp[0]);
63 PMA_DBI_free_result($result);
64 $sot_ready = true;
67 unset($tmp, $result);
71 if (! isset($sot_ready)) {
72 $result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ';');
73 if (PMA_DBI_num_rows($result) > 0) {
74 while ($sts_tmp = PMA_DBI_fetch_assoc($result)) {
75 $tables[] = $sts_tmp;
77 PMA_DBI_free_result($result);
78 unset($res);
83 /**
84 * If there is at least one table, displays the printer friendly view, else
85 * an error message
87 $tables = PMA_DBI_get_tables_full($db);
88 $num_tables = count($tables);
90 echo '<br />';
92 // 1. No table
93 if ($num_tables == 0) {
94 echo __('No tables found in database.');
95 } else {
96 // 2. Shows table information
98 <table>
99 <thead>
100 <tr>
101 <th><?php echo __('Table'); ?></th>
102 <th><?php echo __('Rows'); ?></th>
103 <th><?php echo __('Type'); ?></th>
104 <?php
105 if ($cfg['ShowStats']) {
106 echo '<th>' . __('Size') . '</th>';
109 <th><?php echo __('Comments'); ?></th>
110 </tr>
111 </thead>
112 <tbody>
113 <?php
114 $sum_entries = $sum_size = 0;
115 $odd_row = true;
116 foreach ($tables as $sts_data) {
117 if (PMA_Table::isMerge($db, $sts_data['TABLE_NAME'])
118 || strtoupper($sts_data['ENGINE']) == 'FEDERATED') {
119 $merged_size = true;
120 } else {
121 $merged_size = false;
123 $sum_entries += $sts_data['TABLE_ROWS'];
125 <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
126 <th>
127 <?php echo htmlspecialchars($sts_data['TABLE_NAME']); ?>
128 </th>
129 <?php
131 if (isset($sts_data['TABLE_ROWS'])) {
133 <td align="right">
134 <?php
135 if ($merged_size) {
136 echo '<i>' . PMA_formatNumber($sts_data['TABLE_ROWS'], 0) . '</i>' . "\n";
137 } else {
138 echo PMA_formatNumber($sts_data['TABLE_ROWS'], 0) . "\n";
141 </td>
142 <td nowrap="nowrap">
143 <?php echo $sts_data['ENGINE']; ?>
144 </td>
145 <?php
146 if ($cfg['ShowStats']) {
147 $tblsize = $sts_data['Data_length'] + $sts_data['Index_length'];
148 $sum_size += $tblsize;
149 list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, 1);
151 <td align="right" nowrap="nowrap">
152 <?php echo $formated_size . ' ' . $unit; ?>
153 </td>
154 <?php
155 } // end if
156 } else {
158 <td colspan="3" align="center">
159 <?php echo __('in use'); ?>
160 </td>
161 <?php
164 <td>
165 <?php
166 if (! empty($sts_data['Comment'])) {
167 echo htmlspecialchars($sts_data['Comment']);
168 $needs_break = '<br />';
169 } else {
170 $needs_break = '';
173 if (! empty($sts_data['Create_time'])
174 || ! empty($sts_data['Update_time'])
175 || ! empty($sts_data['Check_time'])) {
176 echo $needs_break;
178 <table width="100%">
179 <?php
181 if (! empty($sts_data['Create_time'])) {
183 <tr>
184 <td align="right"><?php echo __('Creation') . ': '; ?></td>
185 <td align="right"><?php echo PMA_localisedDate(strtotime($sts_data['Create_time'])); ?></td>
186 </tr>
187 <?php
190 if (! empty($sts_data['Update_time'])) {
192 <tr>
193 <td align="right"><?php echo __('Last update') . ': '; ?></td>
194 <td align="right"><?php echo PMA_localisedDate(strtotime($sts_data['Update_time'])); ?></td>
195 </tr>
196 <?php
199 if (! empty($sts_data['Check_time'])) {
201 <tr>
202 <td align="right"><?php echo __('Last check') . ': '; ?></td>
203 <td align="right"><?php echo PMA_localisedDate(strtotime($sts_data['Check_time'])); ?></td>
204 </tr>
205 <?php
208 </table>
209 <?php
212 </td>
213 </tr>
214 <?php
217 <tr>
218 <th align="center">
219 <?php echo sprintf(_ngettext('%s table', '%s tables', $num_tables), PMA_formatNumber($num_tables, 0)); ?>
220 </th>
221 <th align="right" nowrap="nowrap">
222 <?php echo PMA_formatNumber($sum_entries, 0); ?>
223 </th>
224 <th align="center">
226 </th>
227 <?php
228 if ($cfg['ShowStats']) {
229 list($sum_formated, $unit) = PMA_formatByteDown($sum_size, 3, 1);
231 <th align="right" nowrap="nowrap">
232 <?php echo $sum_formated . ' ' . $unit; ?>
233 </th>
234 <?php
237 <th></th>
238 </tr>
239 </tbody>
240 </table>
241 <?php
245 * Displays the footer
247 PMA_printButton();
249 echo "<div id='PMA_disable_floating_menubar'></div>\n";
251 require './libraries/footer.inc.php';