2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Print view of a database
12 require_once 'libraries/common.inc.php';
13 require_once 'libraries/db_printview.lib.php';
15 $response = PMA_Response
::getInstance();
16 $header = $response->getHeader();
17 $header->enablePrintView();
19 PMA_Util
::checkParameters(array('db'));
22 * Defines the url to return to in case of error in a sql statement
24 $err_url = 'db_sql.php' . PMA_URL_getCommon(array('db' => $db));
27 * Settings for relations stuff
29 $cfgRelation = PMA_getRelationsParam();
32 * If there is at least one table, displays the printer friendly view, else
35 $tables = $GLOBALS['dbi']->getTablesFull($db);
36 $num_tables = count($tables);
41 if ($num_tables == 0) {
42 echo __('No tables found in database.');
44 // 2. Shows table information
48 echo '<th>' . __('Table') . '</th>';
49 echo '<th>' . __('Rows') . '</th>';
50 echo '<th>' . __('Type') . '</th>';
51 if ($cfg['ShowStats']) {
52 echo '<th>' . __('Size') . '</th>';
54 echo '<th>' . __('Comments') . '</th>';
58 $sum_entries = $sum_size = 0;
60 foreach ($tables as $sts_data) {
61 if (PMA_Table
::isMerge($db, $sts_data['TABLE_NAME'])
62 ||
/*overload*/mb_strtoupper($sts_data['ENGINE']) == 'FEDERATED'
68 $sum_entries +
= $sts_data['TABLE_ROWS'];
69 echo '<tr class="' . ($odd_row ?
'odd' : 'even') . '">';
71 echo htmlspecialchars($sts_data['TABLE_NAME']);
74 if (isset($sts_data['TABLE_ROWS'])) {
75 echo '<td class="right">';
78 echo PMA_Util
::formatNumber($sts_data['TABLE_ROWS'], 0);
81 echo PMA_Util
::formatNumber($sts_data['TABLE_ROWS'], 0);
84 echo '<td class="nowrap">';
85 echo $sts_data['ENGINE'];
87 if ($cfg['ShowStats']) {
88 $tblsize = $sts_data['Data_length'] +
$sts_data['Index_length'];
89 $sum_size +
= $tblsize;
90 list($formated_size, $unit)
91 = PMA_Util
::formatByteDown($tblsize, 3, 1);
92 echo '<td class="right nowrap">';
93 echo $formated_size . ' ' . $unit;
97 echo '<td colspan="3" class="center">';
98 if (! PMA_Table
::isView($db, $sts_data['TABLE_NAME'])) {
104 if (! empty($sts_data['Comment'])) {
105 echo htmlspecialchars($sts_data['Comment']);
106 $needs_break = '<br />';
111 if (! empty($sts_data['Create_time'])
112 ||
! empty($sts_data['Update_time'])
113 ||
! empty($sts_data['Check_time'])
116 echo '<table width="100%">';
118 if (! empty($sts_data['Create_time'])) {
119 echo PMA_getHtmlForOneDate(
121 $sts_data['Create_time']
125 if (! empty($sts_data['Update_time'])) {
126 echo PMA_getHtmlForOneDate(
128 $sts_data['Update_time']
132 if (! empty($sts_data['Check_time'])) {
133 echo PMA_getHtmlForOneDate(
135 $sts_data['Check_time']
144 echo '<th class="center">';
146 _ngettext('%s table', '%s tables', $num_tables),
147 PMA_Util
::formatNumber($num_tables, 0)
150 echo '<th class="right nowrap">';
151 echo PMA_Util
::formatNumber($sum_entries, 0);
153 echo '<th class="center">';
156 if ($cfg['ShowStats']) {
157 list($sum_formated, $unit)
158 = PMA_Util
::formatByteDown($sum_size, 3, 1);
159 echo '<th class="right nowrap">';
160 echo $sum_formated . ' ' . $unit;
170 * Displays the footer
172 echo PMA_Util
::getButton();
174 echo "<div id='PMA_disable_floating_menubar'></div>\n";