fixed: bugID = 3112614
[phpmyadmin/adnan.git] / navigation.php
blobd312a0c0a92e1594bbd3fe18b3c2d65bae8fd233
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * the navigation frame - displays server, db and table selection tree
6 * @package phpMyAdmin
7 * @uses $GLOBALS['pma']->databases
8 * @uses $GLOBALS['server']
9 * @uses $GLOBALS['db']
10 * @uses $GLOBALS['table']
11 * @uses $GLOBALS['available_languages']
12 * @uses $GLOBALS['lang']
13 * @uses $GLOBALS['text_dir']
14 * @uses $GLOBALS['charset']
15 * @uses $GLOBALS['pmaThemeImage']
16 * @uses $GLOBALS['cfg']['LeftFrameLight']
17 * @uses $GLOBALS['cfg']['ShowTooltip']
18 * @uses $GLOBALS['cfg']['ShowTooltipAliasDB']
19 * @uses $GLOBALS['cfg']['DefaultTabDatabase']
20 * @uses $GLOBALS['cfgRelation']['commwork']) {
21 * @uses PMA_List_Database::getSingleItem()
22 * @uses PMA_List_Database::getHtmlSelectGrouped()
23 * @uses PMA_List_Database::getGroupedDetails()
24 * @uses PMA_generate_common_url()
25 * @uses PMA_generate_common_hidden_inputs()
26 * @uses PMA_getDbComment();
27 * @uses PMA_getTableCount()
28 * @uses PMA_getTableList()
29 * @uses PMA_getRelationsParam()
30 * @uses PMA_outBufferPre()
31 * @uses strlen()
32 * @uses session_write_close()
33 * @uses is_array()
34 * @uses implode()
35 * @uses htmlspecialchars()
38 /**
39 * Gets a core script and starts output buffering work
41 require_once './libraries/common.inc.php';
43 /**
44 * finish and cleanup navigation.php script execution, only to be used in navigation.php
46 * @uses $GLOBALS['controllink'] to close it
47 * @uses $GLOBALS['userlink'] to close it
48 * @access private
50 function PMA_exitNavigationFrame()
52 $params = array('uniqid' => uniqid());
53 if (!empty($GLOBALS['db'])) {
54 $params['db'] = $GLOBALS['db'];
56 echo '<div id="reloadlink">' . "\n";
57 echo '<a href="navigation.php' . PMA_generate_common_url($params) . '" target="frame_navigation">';
58 if ($GLOBALS['cfg']['NavigationBarIconic']) {
59 echo '<img class="icon" src="'. $GLOBALS['pmaThemeImage'] . 's_reload.png"'
60 . ' title="' . __('Reload navigation frame') . '"'
61 . ' alt="' . __('Reload navigation frame') . '" />';
63 if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
64 echo __('Reload navigation frame');
66 echo '</a>';
67 echo '</div>' . "\n";
68 echo '</body></html>';
69 exit;
72 // keep the offset of the db list in session before closing it
73 if (! isset($_SESSION['tmp_user_values']['navi_limit_offset'])) {
74 $_SESSION['tmp_user_values']['navi_limit_offset'] = 0;
76 if (! isset($_SESSION['tmp_user_values']['table_limit_offset']) || $_SESSION['tmp_user_values']['table_limit_offset_db'] != $db) {
77 $_SESSION['tmp_user_values']['table_limit_offset'] = 0;
78 $_SESSION['tmp_user_values']['table_limit_offset_db'] = $db;
80 if (isset($_REQUEST['pos'])) {
81 if (isset($_REQUEST['tpos'])) {
82 $_SESSION['tmp_user_values']['table_limit_offset'] = (int) $_REQUEST['pos'];
84 else {
85 $_SESSION['tmp_user_values']['navi_limit_offset'] = (int) $_REQUEST['pos'];
88 $pos = $_SESSION['tmp_user_values']['navi_limit_offset'];
89 $tpos = $_SESSION['tmp_user_values']['table_limit_offset'];
90 // free the session file, for the other frames to be loaded
91 // but only if debugging is not enabled
92 if (empty($_SESSION['debug'])) {
93 session_write_close();
96 /**
97 * the output compression library
99 require_once './libraries/ob.lib.php';
101 PMA_outBufferPre();
104 * selects the database if there is only one on current server
106 if ($GLOBALS['server'] && ! strlen($GLOBALS['db'])) {
107 $GLOBALS['db'] = $GLOBALS['pma']->databases->getSingleItem();
110 $db_start = $GLOBALS['db'];
113 * the relation settings
115 $cfgRelation = PMA_getRelationsParam();
118 * For re-usability, moved http-headers to a seperate file.
119 * It can now be included by libraries/header.inc.php, querywindow.php.
121 require_once './libraries/header_http.inc.php';
124 * Displays the frame
126 // xml declaration moves IE into quirks mode, making much trouble with CSS
127 /* echo '<?xml version="1.0" encoding="' . $GLOBALS['charset'] . '"?>'; */
129 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
130 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
131 <html xmlns="http://www.w3.org/1999/xhtml"
132 xml:lang="<?php echo $available_languages[$lang][1]; ?>"
133 lang="<?php echo $available_languages[$lang][1]; ?>"
134 dir="<?php echo $GLOBALS['text_dir']; ?>">
136 <head>
137 <link rel="icon" href="./favicon.ico" type="image/x-icon" />
138 <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
139 <title>phpMyAdmin</title>
140 <meta http-equiv="Content-Type"
141 content="text/html; charset=<?php echo $GLOBALS['charset']; ?>" />
142 <base target="frame_content" />
143 <link rel="stylesheet" type="text/css"
144 href="phpmyadmin.css.php?<?php echo PMA_generate_common_url('', ''); ?>&amp;js_frame=left&amp;nocache=<?php echo $GLOBALS['PMA_Config']->getThemeUniqueValue(); ?>" />
145 <script src="./js/jquery/jquery-1.4.2.js" type="text/javascript"></script>
146 <script type="text/javascript" src="js/navigation.js"></script>
147 <script type="text/javascript" src="js/functions.js"></script>
148 <script type="text/javascript">
149 // <![CDATA[
150 var image_minus = '<?php echo $GLOBALS['pmaThemeImage']; ?>b_minus.png';
151 var image_plus = '<?php echo $GLOBALS['pmaThemeImage']; ?>b_plus.png';
153 // INIT PMA_setFrameSize
154 var onloadCnt = 0;
155 var onLoadHandler = window.onload;
156 var resizeHandler = window.onresize;
157 window.document.onresize = resizeHandler;
158 window.onload = function() {
159 if (onloadCnt == 0) {
160 if (typeof(onLoadHandler) == "function") {
161 onLoadHandler();
163 if (typeof(PMA_setFrameSize) != 'undefined' && typeof(PMA_setFrameSize) == 'function') {
164 PMA_setFrameSize();
166 onloadCnt++;
169 window.onresize = function() {
170 if (typeof(resizeHandler) == "function") {
171 resizeHandler();
173 if (typeof(PMA_saveFrameSize) != 'undefined' && typeof(PMA_saveFrameSize) == 'function') {
174 PMA_saveFrameSize();
177 // ]]>
178 </script>
179 <?php
181 * remove horizontal scroll bar bug in IE 6 by forcing a vertical scroll bar
184 <!--[if IE 6]>
185 <style type="text/css">
186 /* <![CDATA[ */
187 html {
188 overflow-y: scroll;
190 /* ]]> */
191 </style>
192 <![endif]-->
193 </head>
195 <body id="body_leftFrame">
196 <?php
197 require './libraries/navigation_header.inc.php';
198 if (! $GLOBALS['server']) {
199 // no server selected
200 PMA_exitNavigationFrame();
201 } elseif (! count($GLOBALS['pma']->databases)) {
202 // no database available, so we break here
203 echo '<p>' . __('No databases') . '</p>';
204 PMA_exitNavigationFrame();
205 } elseif ($GLOBALS['cfg']['LeftFrameLight'] && count($GLOBALS['pma']->databases) > 1) {
206 $list = $cfg['DisplayDatabasesList'];
207 if ($list === 'auto') {
208 if (empty($GLOBALS['db'])) {
209 $list = true;
210 } else {
211 $list = false;
214 if (!$list) {
215 // more than one database available and LeftFrameLight is true
216 // display db selectbox
218 // Light mode -> beginning of the select combo for databases
219 // Note: When javascript is active, the frameset will be changed from
220 // within navigation.php. With no JS (<noscript>) the whole frameset will
221 // be rebuilt with the new target frame.
224 <div id="databaseList">
225 <form method="post" action="index.php" target="_parent" id="left">
226 <?php
227 echo PMA_generate_common_hidden_inputs() . "\n";
228 echo $GLOBALS['pma']->databases->getHtmlSelectGrouped(true, $_SESSION['tmp_user_values']['navi_limit_offset'], $GLOBALS['cfg']['MaxDbList']) . "\n";
229 echo '<noscript>' . "\n"
230 .'<input type="submit" name="Go" value="' . __('Go') . '" />' . "\n"
231 .'</noscript>' . "\n"
232 .'</form>' . "\n"
233 . '</div>' . "\n";
234 } else {
235 echo $GLOBALS['pma']->databases->getHtmlListGrouped(true, $_SESSION['tmp_user_values']['navi_limit_offset'], $GLOBALS['cfg']['MaxDbList']) . "\n";
237 $_url_params = array('pos' => $pos);
238 PMA_listNavigator(count($GLOBALS['pma']->databases), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList']);
242 <div id="left_tableList">
243 <?php
244 // Don't display expansible/collapsible database info if:
245 // 1. $GLOBALS['server'] == 0 (no server selected)
246 // This is the case when there are multiple servers and
247 // '$GLOBALS['cfg']['ServerDefault'] = 0' is set. In that case, we want the welcome
248 // screen to appear with no database info displayed.
249 // 2. there is only one database available (ie either only one database exists
250 // or $GLOBALS['cfg']['Servers']['only_db'] is defined and is not an array)
251 // In this case, the database should not be collapsible/expandable
253 $img_plus = '<img class="icon" id="el%dImg" src="' . $pmaThemeImage . 'b_plus.png"'
254 .' width="9" height="9" alt="+" />';
255 $img_minus = '<img class="icon" id="el%dImg" src="' . $pmaThemeImage . 'b_minus.png"'
256 .' width="9" height="9" alt="-" />';
258 $href_left = '<a onclick="if (toggle(\'%d\')) return false;"'
259 .' href="navigation.php?%s" target="_self">';
261 $element_counter = 0;
264 if ($GLOBALS['cfg']['LeftFrameLight'] && strlen($GLOBALS['db'])) {
265 $table_list = PMA_getTableList($GLOBALS['db']);
266 $table_count = count($table_list);
268 // show selected databasename as link to DefaultTabDatabase-page
269 // with table count in ()
270 $common_url_query = PMA_generate_common_url($GLOBALS['db']);
272 $db_tooltip = '';
274 if ($GLOBALS['cfg']['ShowTooltip']
275 && $GLOBALS['cfgRelation']['commwork']) {
276 $_db_tooltip = PMA_getDbComment($GLOBALS['db']);
277 if ($_db_tooltip) {
278 $db_tooltip = $_db_tooltip;
282 $disp_name = $GLOBALS['db'];
283 if ($db_tooltip && $GLOBALS['cfg']['ShowTooltipAliasDB']) {
284 $disp_name = $db_tooltip;
285 $disp_name_cut = $db_tooltip;
286 $db_tooltip = $GLOBALS['db'];
289 if ($table_count >= $GLOBALS['cfg']['LeftDisplayTableFilterMinimum']) {
291 <span id="NavFilter">
292 <input type="text" name="fast_filter" id="fast_filter" title="<?php echo __('Filter'); ?>" value="<?php echo __('filter tables by name'); ?>" />
293 <span id="clear_fast_filter" title="<?php echo __('Clear'); ?>">X</span>
294 </span>
295 <?php
299 * This helps reducing the navi panel size; in the right panel,
300 * user can find a navigator to page thru all tables.
303 $table_list = array_slice($table_list, $tpos, $cfg['MaxTableList']);
304 if (! empty($table_list)) {
305 // upper table list paginator
306 if (count($table_list) <= $GLOBALS['cfg']['MaxTableList'] && $table_count > $GLOBALS['cfg']['MaxTableList']) {
307 $_url_params = array(
308 'tpos' => 'true',
309 'pos' => $tpos,
310 'db' => $GLOBALS['db']
312 PMA_listNavigator($table_count, $tpos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxTableList']);
314 PMA_displayTableList($table_list, true, '', $GLOBALS['db']);
315 // lower table list paginator
316 if (count($table_list) <= $GLOBALS['cfg']['MaxTableList'] && $table_count > $GLOBALS['cfg']['MaxTableList']) {
317 PMA_listNavigator($table_count, $tpos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxTableList']);
319 } else {
320 echo __('No tables found in database.');
322 unset($table_list);
323 echo '<ul id="newtable"><li><a target="frame_content" href="tbl_create.php' . PMA_generate_common_url(array('db' => $GLOBALS['db'])) . '">'
324 .'<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_snewtbl.png" id="icon_newtable" width="10" height="10" alt="' . _pgettext('short form', 'Create table') . '" />'
325 . _pgettext('short form', 'Create table') . '</a></li></ul>';
326 } elseif ($GLOBALS['cfg']['LeftFrameLight']) {
327 echo '<p>' . __('Please select a database') . '</p>';
328 } else {
329 echo '<div id="databaseList">' . "\n";
330 $_url_params = array('pos' => $pos);
331 PMA_listNavigator(count($GLOBALS['pma']->databases), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList']);
332 echo '</div>' . "\n";
334 $common_url_query = PMA_generate_common_url();
335 PMA_displayDbList($GLOBALS['pma']->databases->getGroupedDetails($_SESSION['tmp_user_values']['navi_limit_offset'],$GLOBALS['cfg']['MaxDbList']), $_SESSION['tmp_user_values']['navi_limit_offset'],$GLOBALS['cfg']['MaxDbList']);
339 * displays collapsable db list
341 * @uses $_REQUEST['dbgroup']
342 * @uses $GLOBALS['cfg']['DefaultTabDatabase']
343 * @uses strpos()
344 * @uses urlencode()
345 * @uses printf()
346 * @uses htmlspecialchars()
347 * @uses PMA_generate_common_url()
348 * @uses PMA_getTableList()
349 * @uses PMA_displayTableList()
350 * @global integer $element_counter
351 * @global string $img_minus
352 * @global string $img_plus
353 * @global string $href_left
354 * @global string $db_start
355 * @global string $common_url_query
356 * @param array $ext_dblist extended db list
357 * @param integer $offset
358 * @param integer $count
360 function PMA_displayDbList($ext_dblist, $offset, $count) {
361 global $element_counter, $img_minus, $img_plus, $href_left,
362 $db_start, $common_url_query;
364 // get table list, for all databases
365 // doing this in one step takes advantage of a single query with information_schema!
366 $tables_full = PMA_DBI_get_tables_full($GLOBALS['pma']->databases->getLimitedItems($offset, $count));
368 $url_dbgroup = '';
369 echo '<ul id="leftdatabaselist">';
370 $close_db_group = false;
371 foreach ($ext_dblist as $group => $db_group) {
372 if (count($GLOBALS['pma']->databases) > 1) {
373 if ($close_db_group) {
374 $url_dbgroup = '';
375 echo '</ul>';
376 echo '</li>';
377 $close_db_group = false;
379 if (count($db_group) > 1) {
380 $close_db_group = true;
381 $url_dbgroup = '&amp;dbgroup=' . urlencode($group);
382 $common_url_query = PMA_generate_common_url() . $url_dbgroup;
383 $element_counter++;
384 echo '<li class="dbgroup">';
385 if ((! empty($_REQUEST['dbgroup']) && $_REQUEST['dbgroup'] == $group)
386 || $db_start == $group || strpos($db_start, $group) === 0) {
387 // display + only if this db(group) is not preselected
388 printf($href_left, $element_counter, PMA_generate_common_url());
389 printf($img_minus, $element_counter);
390 } else {
391 printf($href_left, $element_counter, $common_url_query);
392 printf($img_plus, $element_counter);
394 echo '</a> ' . $group . "\n";
395 if ((! empty($_REQUEST['dbgroup']) && $_REQUEST['dbgroup'] == $group)
396 || $db_start == $group || strpos($db_start, $group) === 0) {
397 echo '<ul id="subel' . $element_counter . '">' . "\n";
398 } else {
399 echo '<ul id="subel' . $element_counter . '"'
400 .' style="display: none">' . "\n";
404 foreach ($db_group as $db) {
405 $common_url_query = PMA_generate_common_url($db['name']) . $url_dbgroup;
407 $element_counter++;
408 // Displays the database name
409 echo '<li>' . "\n";
411 if (count($GLOBALS['pma']->databases) > 1) {
412 // only with more than one db we need collapse ...
413 if ($db_start != $db['name'] || $db['num_tables'] < 1) {
414 // display + only if this db is not preselected
415 // or table count is 0
416 printf($href_left, $element_counter, $common_url_query);
417 printf($img_plus, $element_counter);
418 } else {
419 printf($href_left, $element_counter,
420 PMA_generate_common_url() . $url_dbgroup);
421 printf($img_minus, $element_counter);
423 echo '</a>';
425 // ... and we need to refresh both frames on db selection
427 <a class="item"
428 id="<?php echo htmlspecialchars($db['name']); ?>"
429 href="index.php?<?php echo $common_url_query; ?>"
430 target="_parent"
431 title="<?php echo htmlspecialchars($db['comment']); ?>"
432 onclick="
433 if (! toggle('<?php echo $element_counter; ?>', true))
434 window.parent.goTo('./navigation.php?<?php echo $common_url_query; ?>');
435 window.parent.goTo('./<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
436 . '?' . $common_url_query; ?>', 'main');
437 return false;">
438 <?php
439 if ($GLOBALS['text_dir'] === 'rtl') {
440 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
442 echo htmlspecialchars($db['disp_name']);
443 if ($GLOBALS['text_dir'] === 'ltr') {
444 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
447 </a>
448 <?php
449 } else {
450 // with only 1 db available we dont need to refresh left frame
451 // on db selection, only phpmain
453 <a href="<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
454 . '?' . $common_url_query; ?>"
455 id="<?php echo htmlspecialchars($db['name']); ?>"
456 title="<?php echo htmlspecialchars($db['comment']); ?>">
457 <?php
458 if ($GLOBALS['text_dir'] === 'rtl') {
459 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
461 echo htmlspecialchars($db['disp_name']);
462 if ($GLOBALS['text_dir'] === 'ltr') {
463 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
466 </a>
467 <?php
469 if ($db['num_tables']) {
470 if (isset($tables_full[$db['name']])) {
471 $tables = PMA_getTableList($db['name'], $tables_full[$db['name']]);
472 } elseif (isset($tables_full[strtolower($db['name'])])) {
473 // on windows with lower_case_table_names = 1
474 // MySQL returns
475 // with SHOW DATABASES or information_schema.SCHEMATA: `Test`
476 // but information_schema.TABLES gives `test`
477 // bug #1436171
478 // sf.net/tracker/?func=detail&aid=1436171&group_id=23067&atid=377408
479 $tables = PMA_getTableList($db['name'], $tables_full[strtolower($db['name'])]);
480 } else {
481 $tables = PMA_getTableList($db['name']);
483 $child_visible =
484 (bool) (count($GLOBALS['pma']->databases) === 1 || $db_start == $db['name']);
485 PMA_displayTableList($tables, $child_visible, '', $db['name']);
486 } elseif ($GLOBALS['cfg']['LeftFrameLight']) {
487 // no tables and LeftFrameLight:
488 // display message no tables in selected db
489 echo '<p>' . __('Please select a database') . '</p>' . "\n";
491 echo '</li>' . "\n";
492 } // end foreach db
493 } // end foreach group
495 if ($close_db_group) {
496 $url_dbgroup = '';
497 echo '</ul>';
498 echo '</li>';
499 $close_db_group = false;
502 echo '</ul>' . "\n";
506 * display unordered list of tables
507 * calls itself recursively if table in given list
508 * is a list itself
510 * @uses is_array()
511 * @uses count()
512 * @uses urlencode()
513 * @uses strpos()
514 * @uses printf()
515 * @uses htmlspecialchars()
516 * @uses strlen()
517 * @uses is_array()
518 * @uses PMA_displayTableList()
519 * @uses $_REQUEST['tbl_group']
520 * @uses $GLOBALS['common_url_query']
521 * @uses $GLOBALS['table']
522 * @uses $GLOBALS['pmaThemeImage']
523 * @uses $GLOBALS['cfg']['LeftFrameTableSeparator']
524 * @uses $GLOBALS['cfg']['DefaultTabDatabase']
525 * @uses $GLOBALS['cfg']['DefaultTabTable']
526 * @global integer the element counter
527 * @global string html code for '-' image
528 * @global string html code for '+' image
529 * @global string html code for self link
530 * @param array $tables array of tables/tablegroups
531 * @param boolean $visible whether the list is visible or not
532 * @param string $tab_group_full full tab group name
533 * @param string $table_db db of this table
535 function PMA_displayTableList($tables, $visible = false,
536 $tab_group_full = '', $table_db = '')
538 if (! is_array($tables) || count($tables) === 0) {
539 return;
542 global $element_counter, $img_minus, $img_plus, $href_left;
543 $sep = $GLOBALS['cfg']['LeftFrameTableSeparator'];
545 if ($visible) {
546 echo '<ul id="subel' . $element_counter . '">';
547 } else {
548 echo '<ul id="subel' . $element_counter . '" style="display: none">';
550 foreach ($tables as $group => $table) {
551 // only allow grouping if the group has more than 1 table
552 if (isset($table['is' . $sep . 'group']) && $table['tab' . $sep . 'count'] > 1) {
553 $common_url_query = $GLOBALS['common_url_query']
554 . '&amp;tbl_group=' . urlencode($tab_group_full . $group);
556 $element_counter++;
557 echo '<li>' . "\n";
558 if ($visible
559 && ((isset($_REQUEST['tbl_group'])
560 && (strpos($_REQUEST['tbl_group'], $group) === 0
561 || strpos($_REQUEST['tbl_group'], $sep . $group) !== false))
562 || strpos($GLOBALS['table'], $group) === 0)) {
563 printf($href_left, $element_counter,
564 $GLOBALS['common_url_query'] . '&amp;tbl_group=' . $tab_group_full);
565 printf($img_minus, $element_counter);
566 } else {
567 printf($href_left, $element_counter, $common_url_query);
568 printf($img_plus, $element_counter);
570 echo '</a>';
572 <a href="index.php?<?php echo $common_url_query; ?>"
573 target="_parent"
574 onclick="
575 if (! toggle('<?php echo $element_counter; ?>', true))
576 window.parent.goTo('./navigation.php?<?php echo $common_url_query; ?>');
577 window.parent.goTo('./<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
578 . '?' . $common_url_query; ?>', 'main');
579 return false;">
580 <?php
581 if ($GLOBALS['text_dir'] === 'rtl') {
582 echo ' <bdo dir="ltr">(' . $table['tab' . $sep . 'count'] . ')</bdo> ';
584 echo htmlspecialchars(substr($group, 0, strlen($group) - strlen($sep)));
585 if ($GLOBALS['text_dir'] === 'ltr') {
586 echo ' <bdo dir="ltr">(' . $table['tab' . $sep . 'count'] . ')</bdo> ';
589 </a>
590 <?php
592 unset($table['is' . $sep . 'group']);
593 unset($table['tab' . $sep . 'group']);
594 unset($table['tab' . $sep . 'count']);
596 if ($visible &&
597 ((isset($_REQUEST['tbl_group'])
598 && (strpos($_REQUEST['tbl_group'], $group) === 0
599 || strpos($_REQUEST['tbl_group'], $sep . $group) !== false))
600 || strpos($GLOBALS['table'], $group) === 0)) {
601 PMA_displayTableList($table, true,
602 $tab_group_full . $group, $table_db);
603 } else {
604 PMA_displayTableList($table, false, '', $table_db);
606 echo '</li>' . "\n";
607 } elseif (is_array($table)) {
608 // the table was not grouped because it is the only one with its prefix
609 while (isset($table['is' . $sep . 'group'])) {
610 // get the array with the actual table information
611 foreach ($table as $value) {
612 if(is_array($value)) {
613 $table = $value;
617 $link_title = PMA_getTitleForTarget($GLOBALS['cfg']['LeftDefaultTabTable']);
618 // quick access icon next to each table name
619 echo '<li>' . "\n";
620 echo '<a class="tableicon" title="'
621 . htmlspecialchars($link_title)
622 . ': ' . htmlspecialchars($table['Comment'])
623 .' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . __('Rows') . ')"'
624 .' id="quick_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"'
625 .' href="' . $GLOBALS['cfg']['LeftDefaultTabTable'] . '?'
626 . $GLOBALS['common_url_query']
627 .'&amp;table=' . urlencode($table['Name'])
628 .'&amp;goto=' . $GLOBALS['cfg']['LeftDefaultTabTable']
629 . '" >'
630 .'<img class="icon"';
631 if ('VIEW' === strtoupper($table['Comment'])) {
632 echo ' src="' . $GLOBALS['pmaThemeImage'] . 's_views.png"';
633 } else {
634 echo ' src="' . $GLOBALS['pmaThemeImage'] . 'b_sbrowse.png"';
636 echo ' id="icon_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"'
637 .' width="10" height="10" alt="' . htmlspecialchars($link_title) . '" /></a>' . "\n";
639 // link for the table name itself
640 $href = $GLOBALS['cfg']['DefaultTabTable'] . '?'
641 .$GLOBALS['common_url_query'] . '&amp;table='
642 .urlencode($table['Name']) . '&amp;pos=0';
643 echo '<a href="' . $href
644 . '" title="' . htmlspecialchars(PMA_getTitleForTarget($GLOBALS['cfg']['DefaultTabTable']) . ': ' . $table['Comment']
645 .' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . __('Rows')) . ')"'
646 .' id="' . htmlspecialchars($table_db . '.' . $table['Name']) . '">'
647 // preserve spaces in table name
648 . str_replace(' ', '&nbsp;', htmlspecialchars($table['disp_name'])) . '</a>';
649 echo '</li>' . "\n";
652 echo '</ul>';
655 echo '</div>' . "\n";
657 PMA_exitNavigationFrame();