Translation update done using Pootle.
[phpmyadmin/dkf.git] / db_printview.php
bloba6d66f7b58ea1ee1fbbc063f3b4bd4b023c744b1
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 * @package phpMyAdmin
7 */
9 /**
12 require_once './libraries/common.inc.php';
14 /**
15 * Gets the variables sent or posted to this script, then displays headers
17 $print_view = true;
18 require_once './libraries/header.inc.php';
20 PMA_checkParameters(array('db'));
22 /**
23 * Defines the url to return to in case of error in a sql statement
25 $err_url = 'db_sql.php?' . PMA_generate_common_url($db);
27 /**
28 * Settings for relations stuff
30 require_once './libraries/relation.lib.php';
31 $cfgRelation = PMA_getRelationsParam();
33 /**
34 * Gets the list of the table in the current db and informations about these
35 * tables if possible
37 * @todo merge this speedup _optionaly_ into PMA_DBI_get_tables_full()
39 // speedup view on locked tables
40 // Special speedup for newer MySQL Versions (in 4.0 format changed)
41 if ($cfg['SkipLockedTables'] == true) {
42 $result = PMA_DBI_query('SHOW OPEN TABLES FROM ' . PMA_backquote($db) . ';');
43 // Blending out tables in use
44 if ($result != false && PMA_DBI_num_rows($result) > 0) {
45 while ($tmp = PMA_DBI_fetch_row($result)) {
46 // if in use memorize tablename
47 if (preg_match('@in_use=[1-9]+@i', $tmp[0])) {
48 $sot_cache[$tmp[0]] = true;
51 PMA_DBI_free_result($result);
53 if (isset($sot_cache)) {
54 $result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE);
55 if ($result != false && PMA_DBI_num_rows($result) > 0) {
56 while ($tmp = PMA_DBI_fetch_row($result)) {
57 if (!isset($sot_cache[$tmp[0]])) {
58 $sts_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\';');
59 $sts_tmp = PMA_DBI_fetch_assoc($sts_result);
60 $tables[] = $sts_tmp;
61 } else { // table in use
62 $tables[] = array('Name' => $tmp[0]);
65 PMA_DBI_free_result($result);
66 $sot_ready = true;
69 unset($tmp, $result);
73 if (! isset($sot_ready)) {
74 $result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ';');
75 if (PMA_DBI_num_rows($result) > 0) {
76 while ($sts_tmp = PMA_DBI_fetch_assoc($result)) {
77 $tables[] = $sts_tmp;
79 PMA_DBI_free_result($result);
80 unset($res);
85 /**
86 * If there is at least one table, displays the printer friendly view, else
87 * an error message
89 $tables = PMA_DBI_get_tables_full($db);
90 $num_tables = count($tables);
92 echo '<br />';
94 // 1. No table
95 if ($num_tables == 0) {
96 echo __('No tables found in database.');
98 // 2. Shows table informations on mysql >= 3.23.03
99 else {
101 <table>
102 <thead>
103 <tr>
104 <th><?php echo __('Table'); ?></th>
105 <th><?php echo __('Rows'); ?></th>
106 <th><?php echo __('Type'); ?></th>
107 <?php
108 if ($cfg['ShowStats']) {
109 echo '<th>' . __('Size') . '</th>';
112 <th><?php echo __('Comments'); ?></th>
113 </tr>
114 </thead>
115 <tbody>
116 <?php
117 $sum_entries = $sum_size = 0;
118 $odd_row = true;
119 foreach ($tables as $sts_data) {
120 if (PMA_Table::isMerge($db, $sts_data['TABLE_NAME'])
121 || strtoupper($sts_data['ENGINE']) == 'FEDERATED') {
122 $merged_size = true;
123 } else {
124 $merged_size = false;
126 $sum_entries += $sts_data['TABLE_ROWS'];
128 <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
129 <th>
130 <?php echo htmlspecialchars($sts_data['TABLE_NAME']); ?>
131 </th>
132 <?php
134 if (isset($sts_data['TABLE_ROWS'])) {
136 <td align="right">
137 <?php
138 if ($merged_size) {
139 echo '<i>' . PMA_formatNumber($sts_data['TABLE_ROWS'], 0) . '</i>' . "\n";
140 } else {
141 echo PMA_formatNumber($sts_data['TABLE_ROWS'], 0) . "\n";
144 </td>
145 <td nowrap="nowrap">
146 <?php echo $sts_data['ENGINE']; ?>
147 </td>
148 <?php
149 if ($cfg['ShowStats']) {
150 $tblsize = $sts_data['Data_length'] + $sts_data['Index_length'];
151 $sum_size += $tblsize;
152 list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, 1);
154 <td align="right" nowrap="nowrap">
155 <?php echo $formated_size . ' ' . $unit; ?>
156 </td>
157 <?php
158 } // end if
159 } else {
161 <td colspan="3" align="center">
162 <?php echo __('in use'); ?>
163 </td>
164 <?php
167 <td>
168 <?php
169 if (! empty($sts_data['Comment'])) {
170 echo htmlspecialchars($sts_data['Comment']);
171 $needs_break = '<br />';
172 } else {
173 $needs_break = '';
176 if (! empty($sts_data['Create_time'])
177 || ! empty($sts_data['Update_time'])
178 || ! empty($sts_data['Check_time'])) {
179 echo $needs_break;
181 <table width="100%">
182 <?php
184 if (! empty($sts_data['Create_time'])) {
186 <tr>
187 <td align="right"><?php echo __('Creation') . ': '; ?></td>
188 <td align="right"><?php echo PMA_localisedDate(strtotime($sts_data['Create_time'])); ?></td>
189 </tr>
190 <?php
193 if (! empty($sts_data['Update_time'])) {
195 <tr>
196 <td align="right"><?php echo __('Last update') . ': '; ?></td>
197 <td align="right"><?php echo PMA_localisedDate(strtotime($sts_data['Update_time'])); ?></td>
198 </tr>
199 <?php
202 if (! empty($sts_data['Check_time'])) {
204 <tr>
205 <td align="right"><?php echo __('Last check') . ': '; ?></td>
206 <td align="right"><?php echo PMA_localisedDate(strtotime($sts_data['Check_time'])); ?></td>
207 </tr>
208 <?php
211 </table>
212 <?php
215 </td>
216 </tr>
217 <?php
220 <tr>
221 <th align="center">
222 <?php echo sprintf(_ngettext('%s table', '%s tables', $num_tables), PMA_formatNumber($num_tables, 0)); ?>
223 </th>
224 <th align="right" nowrap="nowrap">
225 <?php echo PMA_formatNumber($sum_entries, 0); ?>
226 </th>
227 <th align="center">
229 </th>
230 <?php
231 if ($cfg['ShowStats']) {
232 list($sum_formated, $unit) = PMA_formatByteDown($sum_size, 3, 1);
234 <th align="right" nowrap="nowrap">
235 <?php echo $sum_formated . ' ' . $unit; ?>
236 </th>
237 <?php
240 <th></th>
241 </tr>
242 </tbody>
243 </table>
244 <?php
248 * Displays the footer
252 <script type="text/javascript">
253 //<![CDATA[
254 function printPage()
256 // Do print the page
257 if (typeof(window.print) != 'undefined') {
258 window.print();
261 //]]>
262 </script>
263 <br /><br />
265 <input type="button" class="print_ignore"
266 id="print" value="<?php echo __('Print'); ?>" onclick="printPage()" />
268 <?php
269 require_once './libraries/footer.inc.php';