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">';
97 if (! PMA_Table
::isView($db, $sts_data['TABLE_NAME'])) {
103 if (! empty($sts_data['Comment'])) {
104 echo htmlspecialchars($sts_data['Comment']);
105 $needs_break = '<br />';
110 if (! empty($sts_data['Create_time'])
111 ||
! empty($sts_data['Update_time'])
112 ||
! empty($sts_data['Check_time'])
115 echo '<table width="100%">';
117 if (! empty($sts_data['Create_time'])) {
119 echo '<td class="right">' . __('Creation:') . '</td>';
120 echo '<td class="right">';
121 echo PMA_Util
::localisedDate(strtotime($sts_data['Create_time']));
126 if (! empty($sts_data['Update_time'])) {
128 echo '<td class="right">' . __('Last update:') . '</td>';
129 echo '<td class="right">';
130 echo PMA_Util
::localisedDate(strtotime($sts_data['Update_time']));
135 if (! empty($sts_data['Check_time'])) {
137 echo '<td class="right">' . __('Last check:') . '</td>';
138 echo '<td class="right">';
139 echo PMA_Util
::localisedDate(strtotime($sts_data['Check_time']));
149 echo '<th class="center">';
151 _ngettext('%s table', '%s tables', $num_tables),
152 PMA_Util
::formatNumber($num_tables, 0)
155 echo '<th class="right nowrap">';
156 echo PMA_Util
::formatNumber($sum_entries, 0);
158 echo '<th class="center">';
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;
175 * Displays the footer
177 echo PMA_Util
::getButton();
179 echo "<div id='PMA_disable_floating_menubar'></div>\n";