Improve locales compiling
[phpmyadmin.git] / db_printview.php
blob137bdaaf789ecd9f38e102e8bee741f3be429096
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Print view of a database
6 * @package PhpMyAdmin
7 */
9 /**
12 require_once 'libraries/common.inc.php';
14 $response = PMA_Response::getInstance();
15 $header = $response->getHeader();
16 $header->enablePrintView();
18 PMA_Util::checkParameters(array('db'));
20 /**
21 * Defines the url to return to in case of error in a sql statement
23 $err_url = 'db_sql.php?' . PMA_URL_getCommon($db);
25 /**
26 * Settings for relations stuff
28 $cfgRelation = PMA_getRelationsParam();
30 /**
31 * If there is at least one table, displays the printer friendly view, else
32 * an error message
34 $tables = $GLOBALS['dbi']->getTablesFull($db);
35 $num_tables = count($tables);
37 echo '<br />';
39 // 1. No table
40 if ($num_tables == 0) {
41 echo __('No tables found in database.');
42 } else {
43 // 2. Shows table information
44 echo '<table>';
45 echo '<thead>';
46 echo '<tr>';
47 echo '<th>' . __('Table') . '</th>';
48 echo '<th>' . __('Rows') . '</th>';
49 echo '<th>' . __('Type') . '</th>';
50 if ($cfg['ShowStats']) {
51 echo '<th>' . __('Size') . '</th>';
53 echo '<th>' . __('Comments') . '</th>';
54 echo '</tr>';
55 echo '</thead>';
56 echo '<tbody>';
57 $sum_entries = $sum_size = 0;
58 $odd_row = true;
59 foreach ($tables as $sts_data) {
60 if (PMA_Table::isMerge($db, $sts_data['TABLE_NAME'])
61 || strtoupper($sts_data['ENGINE']) == 'FEDERATED'
62 ) {
63 $merged_size = true;
64 } else {
65 $merged_size = false;
67 $sum_entries += $sts_data['TABLE_ROWS'];
68 echo '<tr class="' . ($odd_row ? 'odd' : 'even') . '">';
69 echo '<th>';
70 echo htmlspecialchars($sts_data['TABLE_NAME']);
71 echo '</th>';
73 if (isset($sts_data['TABLE_ROWS'])) {
74 echo '<td class="right">';
75 if ($merged_size) {
76 echo '<i>';
77 echo PMA_Util::formatNumber($sts_data['TABLE_ROWS'], 0);
78 echo '</i>';
79 } else {
80 echo PMA_Util::formatNumber($sts_data['TABLE_ROWS'], 0);
82 echo '</td>';
83 echo '<td class="nowrap">';
84 echo $sts_data['ENGINE'];
85 echo '</td>';
86 if ($cfg['ShowStats']) {
87 $tblsize = $sts_data['Data_length'] + $sts_data['Index_length'];
88 $sum_size += $tblsize;
89 list($formated_size, $unit)
90 = PMA_Util::formatByteDown($tblsize, 3, 1);
91 echo '<td class="right nowrap">';
92 echo $formated_size . ' ' . $unit;
93 echo '</td>';
94 } // end if
95 } else {
96 echo '<td colspan="3" class="center">';
97 if (! PMA_Table::isView($db, $sts_data['TABLE_NAME'])) {
98 echo __('in use');
100 echo '</td>';
102 echo '<td>';
103 if (! empty($sts_data['Comment'])) {
104 echo htmlspecialchars($sts_data['Comment']);
105 $needs_break = '<br />';
106 } else {
107 $needs_break = '';
110 if (! empty($sts_data['Create_time'])
111 || ! empty($sts_data['Update_time'])
112 || ! empty($sts_data['Check_time'])
114 echo $needs_break;
115 echo '<table width="100%">';
117 if (! empty($sts_data['Create_time'])) {
118 echo '<tr>';
119 echo '<td class="right">' . __('Creation:') . '</td>';
120 echo '<td class="right">';
121 echo PMA_Util::localisedDate(strtotime($sts_data['Create_time']));
122 echo '</td>';
123 echo '</tr>';
126 if (! empty($sts_data['Update_time'])) {
127 echo '<tr>';
128 echo '<td class="right">' . __('Last update:') . '</td>';
129 echo '<td class="right">';
130 echo PMA_Util::localisedDate(strtotime($sts_data['Update_time']));
131 echo '</td>';
132 echo '</tr>';
135 if (! empty($sts_data['Check_time'])) {
136 echo '<tr>';
137 echo '<td class="right">' . __('Last check:') . '</td>';
138 echo '<td class="right">';
139 echo PMA_Util::localisedDate(strtotime($sts_data['Check_time']));
140 echo '</td>';
141 echo '</tr>';
143 echo '</table>';
145 echo '</td>';
146 echo '</tr>';
148 echo '<tr>';
149 echo '<th class="center">';
150 printf(
151 _ngettext('%s table', '%s tables', $num_tables),
152 PMA_Util::formatNumber($num_tables, 0)
154 echo '</th>';
155 echo '<th class="right nowrap">';
156 echo PMA_Util::formatNumber($sum_entries, 0);
157 echo '</th>';
158 echo '<th class="center">';
159 echo '--';
160 echo '</th>';
161 if ($cfg['ShowStats']) {
162 list($sum_formated, $unit)
163 = PMA_Util::formatByteDown($sum_size, 3, 1);
164 echo '<th class="right nowrap">';
165 echo $sum_formated . ' ' . $unit;
166 echo '</th>';
168 echo '<th></th>';
169 echo '</tr>';
170 echo '</tbody>';
171 echo '</table>';
175 * Displays the footer
177 echo PMA_Util::getButton();
179 echo "<div id='PMA_disable_floating_menubar'></div>\n";