Refactored ConfigFile class so that it is no longer a singleton
[phpmyadmin.git] / db_printview.php
blob92f70024b94c76845e3cbd5e384f9cc4de8e8cac
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 echo __('in use');
98 echo '</td>';
100 echo '<td>';
101 if (! empty($sts_data['Comment'])) {
102 echo htmlspecialchars($sts_data['Comment']);
103 $needs_break = '<br />';
104 } else {
105 $needs_break = '';
108 if (! empty($sts_data['Create_time'])
109 || ! empty($sts_data['Update_time'])
110 || ! empty($sts_data['Check_time'])
112 echo $needs_break;
113 echo '<table width="100%">';
115 if (! empty($sts_data['Create_time'])) {
116 echo '<tr>';
117 echo '<td class="right">' . __('Creation:') . '</td>';
118 echo '<td class="right">';
119 echo PMA_Util::localisedDate(strtotime($sts_data['Create_time']));
120 echo '</td>';
121 echo '</tr>';
124 if (! empty($sts_data['Update_time'])) {
125 echo '<tr>';
126 echo '<td class="right">' . __('Last update:') . '</td>';
127 echo '<td class="right">';
128 echo PMA_Util::localisedDate(strtotime($sts_data['Update_time']));
129 echo '</td>';
130 echo '</tr>';
133 if (! empty($sts_data['Check_time'])) {
134 echo '<tr>';
135 echo '<td class="right">' . __('Last check:') . '</td>';
136 echo '<td class="right">';
137 echo PMA_Util::localisedDate(strtotime($sts_data['Check_time']));
138 echo '</td>';
139 echo '</tr>';
141 echo '</table>';
143 echo '</td>';
144 echo '</tr>';
146 echo '<tr>';
147 echo '<th class="center">';
148 printf(
149 _ngettext('%s table', '%s tables', $num_tables),
150 PMA_Util::formatNumber($num_tables, 0)
152 echo '</th>';
153 echo '<th class="right nowrap">';
154 echo PMA_Util::formatNumber($sum_entries, 0);
155 echo '</th>';
156 echo '<th class="center">';
157 echo '--';
158 echo '</th>';
159 if ($cfg['ShowStats']) {
160 list($sum_formated, $unit)
161 = PMA_Util::formatByteDown($sum_size, 3, 1);
162 echo '<th class="right nowrap">';
163 echo $sum_formated . ' ' . $unit;
164 echo '</th>';
166 echo '<th></th>';
167 echo '</tr>';
168 echo '</tbody>';
169 echo '</table>';
173 * Displays the footer
175 echo PMA_Util::getButton();
177 echo "<div id='PMA_disable_floating_menubar'></div>\n";