2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Print view of a database
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'));
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);
26 * Settings for relations stuff
28 $cfgRelation = PMA_getRelationsParam();
31 * If there is at least one table, displays the printer friendly view, else
34 $tables = $GLOBALS['dbi']->getTablesFull($db);
35 $num_tables = count($tables);
40 if ($num_tables == 0) {
41 echo __('No tables found in database.');
43 // 2. Shows table information
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>';
57 $sum_entries = $sum_size = 0;
59 foreach ($tables as $sts_data) {
60 if (PMA_Table
::isMerge($db, $sts_data['TABLE_NAME'])
61 ||
strtoupper($sts_data['ENGINE']) == 'FEDERATED'
67 $sum_entries +
= $sts_data['TABLE_ROWS'];
68 echo '<tr class="' . ($odd_row ?
'odd' : 'even') . '">';
70 echo htmlspecialchars($sts_data['TABLE_NAME']);
73 if (isset($sts_data['TABLE_ROWS'])) {
74 echo '<td class="right">';
77 echo PMA_Util
::formatNumber($sts_data['TABLE_ROWS'], 0);
80 echo PMA_Util
::formatNumber($sts_data['TABLE_ROWS'], 0);
83 echo '<td class="nowrap">';
84 echo $sts_data['ENGINE'];
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;
96 echo '<td colspan="3" class="center">';
101 if (! empty($sts_data['Comment'])) {
102 echo htmlspecialchars($sts_data['Comment']);
103 $needs_break = '<br />';
108 if (! empty($sts_data['Create_time'])
109 ||
! empty($sts_data['Update_time'])
110 ||
! empty($sts_data['Check_time'])
113 echo '<table width="100%">';
115 if (! empty($sts_data['Create_time'])) {
117 echo '<td class="right">' . __('Creation:') . '</td>';
118 echo '<td class="right">';
119 echo PMA_Util
::localisedDate(strtotime($sts_data['Create_time']));
124 if (! empty($sts_data['Update_time'])) {
126 echo '<td class="right">' . __('Last update:') . '</td>';
127 echo '<td class="right">';
128 echo PMA_Util
::localisedDate(strtotime($sts_data['Update_time']));
133 if (! empty($sts_data['Check_time'])) {
135 echo '<td class="right">' . __('Last check:') . '</td>';
136 echo '<td class="right">';
137 echo PMA_Util
::localisedDate(strtotime($sts_data['Check_time']));
147 echo '<th class="center">';
149 _ngettext('%s table', '%s tables', $num_tables),
150 PMA_Util
::formatNumber($num_tables, 0)
153 echo '<th class="right nowrap">';
154 echo PMA_Util
::formatNumber($sum_entries, 0);
156 echo '<th class="center">';
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;
173 * Displays the footer
175 echo PMA_Util
::getButton();
177 echo "<div id='PMA_disable_floating_menubar'></div>\n";