Merge remote branch 'pootle/master'
[phpmyadmin/lorilee.git] / navigation.php
blobcd9ca7d31b0640e3e058f72b85139f1e9c298e3c
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 } else {
234 if (! empty($db)) {
235 echo '<div id="databaseList">' . "\n";
237 echo $GLOBALS['pma']->databases->getHtmlListGrouped(true, $_SESSION['tmp_user_values']['navi_limit_offset'], $GLOBALS['cfg']['MaxDbList']) . "\n";
239 $_url_params = array('pos' => $pos);
240 PMA_listNavigator(count($GLOBALS['pma']->databases), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList']);
241 if (! empty($db)) {
242 echo '</div>' . "\n";
247 <div id="left_tableList">
248 <?php
249 // Don't display expansible/collapsible database info if:
250 // 1. $GLOBALS['server'] == 0 (no server selected)
251 // This is the case when there are multiple servers and
252 // '$GLOBALS['cfg']['ServerDefault'] = 0' is set. In that case, we want the welcome
253 // screen to appear with no database info displayed.
254 // 2. there is only one database available (ie either only one database exists
255 // or $GLOBALS['cfg']['Servers']['only_db'] is defined and is not an array)
256 // In this case, the database should not be collapsible/expandable
258 $img_plus = '<img class="icon" id="el%dImg" src="' . $pmaThemeImage . 'b_plus.png"'
259 .' width="9" height="9" alt="+" />';
260 $img_minus = '<img class="icon" id="el%dImg" src="' . $pmaThemeImage . 'b_minus.png"'
261 .' width="9" height="9" alt="-" />';
263 $href_left = '<a onclick="if (toggle(\'%d\')) return false;"'
264 .' href="navigation.php?%s" target="_self">';
266 $element_counter = 0;
269 if ($GLOBALS['cfg']['LeftFrameLight'] && strlen($GLOBALS['db'])) {
270 $table_list = PMA_getTableList($GLOBALS['db']);
271 $table_count = count($table_list);
273 // show selected databasename as link to DefaultTabDatabase-page
274 // with table count in ()
275 $common_url_query = PMA_generate_common_url($GLOBALS['db']);
277 $db_tooltip = '';
279 if ($GLOBALS['cfg']['ShowTooltip']
280 && $GLOBALS['cfgRelation']['commwork']) {
281 $_db_tooltip = PMA_getDbComment($GLOBALS['db']);
282 if ($_db_tooltip) {
283 $db_tooltip = $_db_tooltip;
287 $disp_name = $GLOBALS['db'];
288 if ($db_tooltip && $GLOBALS['cfg']['ShowTooltipAliasDB']) {
289 $disp_name = $db_tooltip;
290 $disp_name_cut = $db_tooltip;
291 $db_tooltip = $GLOBALS['db'];
294 if ($table_count) {
296 <span id="NavFilter">
297 <input type="text" name="fast_filter" id="fast_filter" title="<?php echo __('Filter'); ?>" />
298 <span id="clear_fast_filter" title="<?php echo __('Clear'); ?>">X</span>
299 </span>
300 <?php
304 * This helps reducing the navi panel size; in the right panel,
305 * user can find a navigator to page thru all tables.
308 $table_list = array_slice($table_list, $tpos, $cfg['MaxTableList']);
309 if (! empty($table_list)) {
310 // upper table list paginator
311 if (count($table_list) <= $GLOBALS['cfg']['MaxTableList'] && $table_count > $GLOBALS['cfg']['MaxTableList']) {
312 $_url_params = array(
313 'tpos' => 'true',
314 'pos' => $tpos,
315 'db' => $GLOBALS['db']
317 PMA_listNavigator($table_count, $tpos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxTableList']);
319 PMA_displayTableList($table_list, true, '', $GLOBALS['db']);
320 // lower table list paginator
321 if (count($table_list) <= $GLOBALS['cfg']['MaxTableList'] && $table_count > $GLOBALS['cfg']['MaxTableList']) {
322 PMA_listNavigator($table_count, $tpos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxTableList']);
324 } else {
325 echo __('No tables found in database.');
327 unset($table_list);
328 echo '<ul id="newtable"><li><a target="frame_content" href="tbl_create.php' . PMA_generate_common_url(array('db' => $GLOBALS['db'])) . '">'
329 .'<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_snewtbl.png" id="icon_newtable" width="10" height="10" alt="' . _pgettext('short form', 'Create table') . '" />'
330 . _pgettext('short form', 'Create table') . '</a></li></ul>';
331 } elseif ($GLOBALS['cfg']['LeftFrameLight']) {
332 echo '<p>' . __('Please select a database') . '</p>';
333 } else {
334 echo '<div id="databaseList">' . "\n";
335 $_url_params = array('pos' => $pos);
336 PMA_listNavigator(count($GLOBALS['pma']->databases), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList']);
337 echo '</div>' . "\n";
339 $common_url_query = PMA_generate_common_url();
340 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']);
344 * displays collapsable db list
346 * @uses $_REQUEST['dbgroup']
347 * @uses $GLOBALS['cfg']['DefaultTabDatabase']
348 * @uses strpos()
349 * @uses urlencode()
350 * @uses printf()
351 * @uses htmlspecialchars()
352 * @uses PMA_generate_common_url()
353 * @uses PMA_getTableList()
354 * @uses PMA_displayTableList()
355 * @global integer $element_counter
356 * @global string $img_minus
357 * @global string $img_plus
358 * @global string $href_left
359 * @global string $db_start
360 * @global string $common_url_query
361 * @param array $ext_dblist extended db list
362 * @param integer $offset
363 * @param integer $count
365 function PMA_displayDbList($ext_dblist, $offset, $count) {
366 global $element_counter, $img_minus, $img_plus, $href_left,
367 $db_start, $common_url_query;
369 // get table list, for all databases
370 // doing this in one step takes advantage of a single query with information_schema!
371 $tables_full = PMA_DBI_get_tables_full($GLOBALS['pma']->databases->getLimitedItems($offset, $count));
373 $url_dbgroup = '';
374 echo '<ul id="leftdatabaselist">';
375 $close_db_group = false;
376 foreach ($ext_dblist as $group => $db_group) {
377 if (count($GLOBALS['pma']->databases) > 1) {
378 if ($close_db_group) {
379 $url_dbgroup = '';
380 echo '</ul>';
381 echo '</li>';
382 $close_db_group = false;
384 if (count($db_group) > 1) {
385 $close_db_group = true;
386 $url_dbgroup = '&amp;dbgroup=' . urlencode($group);
387 $common_url_query = PMA_generate_common_url() . $url_dbgroup;
388 $element_counter++;
389 echo '<li class="dbgroup">';
390 if ((! empty($_REQUEST['dbgroup']) && $_REQUEST['dbgroup'] == $group)
391 || $db_start == $group || strpos($db_start, $group) === 0) {
392 // display + only if this db(group) is not preselected
393 printf($href_left, $element_counter, PMA_generate_common_url());
394 printf($img_minus, $element_counter);
395 } else {
396 printf($href_left, $element_counter, $common_url_query);
397 printf($img_plus, $element_counter);
399 echo '</a> ' . $group . "\n";
400 if ((! empty($_REQUEST['dbgroup']) && $_REQUEST['dbgroup'] == $group)
401 || $db_start == $group || strpos($db_start, $group) === 0) {
402 echo '<ul id="subel' . $element_counter . '">' . "\n";
403 } else {
404 echo '<ul id="subel' . $element_counter . '"'
405 .' style="display: none">' . "\n";
409 foreach ($db_group as $db) {
410 $common_url_query = PMA_generate_common_url($db['name']) . $url_dbgroup;
412 $element_counter++;
413 // Displays the database name
414 echo '<li>' . "\n";
416 if (count($GLOBALS['pma']->databases) > 1) {
417 // only with more than one db we need collapse ...
418 if ($db_start != $db['name'] || $db['num_tables'] < 1) {
419 // display + only if this db is not preselected
420 // or table count is 0
421 printf($href_left, $element_counter, $common_url_query);
422 printf($img_plus, $element_counter);
423 } else {
424 printf($href_left, $element_counter,
425 PMA_generate_common_url() . $url_dbgroup);
426 printf($img_minus, $element_counter);
428 echo '</a>';
430 // ... and we need to refresh both frames on db selection
432 <a class="item"
433 id="<?php echo htmlspecialchars($db['name']); ?>"
434 href="index.php?<?php echo $common_url_query; ?>"
435 target="_parent"
436 title="<?php echo htmlspecialchars($db['comment']); ?>"
437 onclick="
438 if (! toggle('<?php echo $element_counter; ?>', true))
439 window.parent.goTo('./navigation.php?<?php echo $common_url_query; ?>');
440 window.parent.goTo('./<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
441 . '?' . $common_url_query; ?>', 'main');
442 return false;">
443 <?php
444 if ($GLOBALS['text_dir'] === 'rtl') {
445 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
447 echo htmlspecialchars($db['disp_name']);
448 if ($GLOBALS['text_dir'] === 'ltr') {
449 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
452 </a>
453 <?php
454 } else {
455 // with only 1 db available we dont need to refresh left frame
456 // on db selection, only phpmain
458 <a href="<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
459 . '?' . $common_url_query; ?>"
460 id="<?php echo htmlspecialchars($db['name']); ?>"
461 title="<?php echo htmlspecialchars($db['comment']); ?>">
462 <?php
463 if ($GLOBALS['text_dir'] === 'rtl') {
464 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
466 echo htmlspecialchars($db['disp_name']);
467 if ($GLOBALS['text_dir'] === 'ltr') {
468 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
471 </a>
472 <?php
474 if ($db['num_tables']) {
475 if (isset($tables_full[$db['name']])) {
476 $tables = PMA_getTableList($db['name'], $tables_full[$db['name']]);
477 } elseif (isset($tables_full[strtolower($db['name'])])) {
478 // on windows with lower_case_table_names = 1
479 // MySQL returns
480 // with SHOW DATABASES or information_schema.SCHEMATA: `Test`
481 // but information_schema.TABLES gives `test`
482 // bug #1436171
483 // sf.net/tracker/?func=detail&aid=1436171&group_id=23067&atid=377408
484 $tables = PMA_getTableList($db['name'], $tables_full[strtolower($db['name'])]);
485 } else {
486 $tables = PMA_getTableList($db['name']);
488 $child_visible =
489 (bool) (count($GLOBALS['pma']->databases) === 1 || $db_start == $db['name']);
490 PMA_displayTableList($tables, $child_visible, '', $db['name']);
491 } elseif ($GLOBALS['cfg']['LeftFrameLight']) {
492 // no tables and LeftFrameLight:
493 // display message no tables in selected db
494 echo '<p>' . __('Please select a database') . '</p>' . "\n";
496 echo '</li>' . "\n";
497 } // end foreach db
498 } // end foreach group
500 if ($close_db_group) {
501 $url_dbgroup = '';
502 echo '</ul>';
503 echo '</li>';
504 $close_db_group = false;
507 echo '</ul>' . "\n";
511 * display unordered list of tables
512 * calls itself recursively if table in given list
513 * is a list itself
515 * @uses is_array()
516 * @uses count()
517 * @uses urlencode()
518 * @uses strpos()
519 * @uses printf()
520 * @uses htmlspecialchars()
521 * @uses strlen()
522 * @uses is_array()
523 * @uses PMA_displayTableList()
524 * @uses $_REQUEST['tbl_group']
525 * @uses $GLOBALS['common_url_query']
526 * @uses $GLOBALS['table']
527 * @uses $GLOBALS['pmaThemeImage']
528 * @uses $GLOBALS['cfg']['LeftFrameTableSeparator']
529 * @uses $GLOBALS['cfg']['DefaultTabDatabase']
530 * @uses $GLOBALS['cfg']['DefaultTabTable']
531 * @global integer the element counter
532 * @global string html code for '-' image
533 * @global string html code for '+' image
534 * @global string html code for self link
535 * @param array $tables array of tables/tablegroups
536 * @param boolean $visible whether the list is visible or not
537 * @param string $tab_group_full full tab group name
538 * @param string $table_db db of this table
540 function PMA_displayTableList($tables, $visible = false,
541 $tab_group_full = '', $table_db = '')
543 if (! is_array($tables) || count($tables) === 0) {
544 return;
547 global $element_counter, $img_minus, $img_plus, $href_left;
548 $sep = $GLOBALS['cfg']['LeftFrameTableSeparator'];
550 if ($visible) {
551 echo '<ul id="subel' . $element_counter . '">';
552 } else {
553 echo '<ul id="subel' . $element_counter . '" style="display: none">';
555 foreach ($tables as $group => $table) {
556 // only allow grouping if the group has more than 1 table
557 if (isset($table['is' . $sep . 'group']) && $table['tab' . $sep . 'count'] > 1) {
558 $common_url_query = $GLOBALS['common_url_query']
559 . '&amp;tbl_group=' . urlencode($tab_group_full . $group);
561 $element_counter++;
562 echo '<li>' . "\n";
563 if ($visible
564 && ((isset($_REQUEST['tbl_group'])
565 && (strpos($_REQUEST['tbl_group'], $group) === 0
566 || strpos($_REQUEST['tbl_group'], $sep . $group) !== false))
567 || strpos($GLOBALS['table'], $group) === 0)) {
568 printf($href_left, $element_counter,
569 $GLOBALS['common_url_query'] . '&amp;tbl_group=' . $tab_group_full);
570 printf($img_minus, $element_counter);
571 } else {
572 printf($href_left, $element_counter, $common_url_query);
573 printf($img_plus, $element_counter);
575 echo '</a>';
577 <a href="index.php?<?php echo $common_url_query; ?>"
578 target="_parent"
579 onclick="
580 if (! toggle('<?php echo $element_counter; ?>', true))
581 window.parent.goTo('./navigation.php?<?php echo $common_url_query; ?>');
582 window.parent.goTo('./<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
583 . '?' . $common_url_query; ?>', 'main');
584 return false;">
585 <?php
586 if ($GLOBALS['text_dir'] === 'rtl') {
587 echo ' <bdo dir="ltr">(' . $table['tab' . $sep . 'count'] . ')</bdo> ';
589 echo htmlspecialchars(substr($group, 0, strlen($group) - strlen($sep)));
590 if ($GLOBALS['text_dir'] === 'ltr') {
591 echo ' <bdo dir="ltr">(' . $table['tab' . $sep . 'count'] . ')</bdo> ';
594 </a>
595 <?php
597 unset($table['is' . $sep . 'group']);
598 unset($table['tab' . $sep . 'group']);
599 unset($table['tab' . $sep . 'count']);
601 if ($visible &&
602 ((isset($_REQUEST['tbl_group'])
603 && (strpos($_REQUEST['tbl_group'], $group) === 0
604 || strpos($_REQUEST['tbl_group'], $sep . $group) !== false))
605 || strpos($GLOBALS['table'], $group) === 0)) {
606 PMA_displayTableList($table, true,
607 $tab_group_full . $group, $table_db);
608 } else {
609 PMA_displayTableList($table, false, '', $table_db);
611 echo '</li>' . "\n";
612 } elseif (is_array($table)) {
613 // the table was not grouped because it is the only one with its prefix
614 if (isset($table['is' . $sep . 'group'])) {
615 // get the array with the actual table information
616 foreach ($table as $value) {
617 if(is_array($value)) {
618 $table = $value;
622 $link_title = PMA_getTitleForTarget($GLOBALS['cfg']['LeftDefaultTabTable']);
623 // quick access icon next to each table name
624 echo '<li>' . "\n";
625 echo '<a class="tableicon" title="'
626 . htmlspecialchars($link_title)
627 . ': ' . htmlspecialchars($table['Comment'])
628 .' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . __('Rows') . ')"'
629 .' id="quick_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"'
630 .' href="' . $GLOBALS['cfg']['LeftDefaultTabTable'] . '?'
631 . $GLOBALS['common_url_query']
632 .'&amp;table=' . urlencode($table['Name'])
633 .'&amp;goto=' . $GLOBALS['cfg']['LeftDefaultTabTable']
634 . '" >'
635 .'<img class="icon"';
636 if ('VIEW' === strtoupper($table['Comment'])) {
637 echo ' src="' . $GLOBALS['pmaThemeImage'] . 's_views.png"';
638 } else {
639 echo ' src="' . $GLOBALS['pmaThemeImage'] . 'b_sbrowse.png"';
641 echo ' id="icon_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"'
642 .' width="10" height="10" alt="' . htmlspecialchars($link_title) . '" /></a>' . "\n";
644 // link for the table name itself
645 $href = $GLOBALS['cfg']['DefaultTabTable'] . '?'
646 .$GLOBALS['common_url_query'] . '&amp;table='
647 .urlencode($table['Name']) . '&amp;pos=0';
648 echo '<a href="' . $href
649 . '" title="' . htmlspecialchars(PMA_getTitleForTarget($GLOBALS['cfg']['DefaultTabTable']) . ': ' . $table['Comment']
650 .' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . __('Rows')) . ')"'
651 .' id="' . htmlspecialchars($table_db . '.' . $table['Name']) . '">'
652 // preserve spaces in table name
653 . str_replace(' ', '&nbsp;', htmlspecialchars($table['disp_name'])) . '</a>';
654 echo '</li>' . "\n";
657 echo '</ul>';
660 echo '</div>' . "\n";
662 PMA_exitNavigationFrame();