Merge remote branch 'origin/master'
[phpmyadmin/dkf.git] / navigation.php
blob909bc0054c5d14a70b96432057b663b6ac145550
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 * @version $Id$
7 * @package phpMyAdmin
8 * @uses $GLOBALS['pma']->databases
9 * @uses $GLOBALS['server']
10 * @uses $GLOBALS['db']
11 * @uses $GLOBALS['table']
12 * @uses $GLOBALS['available_languages']
13 * @uses $GLOBALS['lang']
14 * @uses $GLOBALS['text_dir']
15 * @uses $GLOBALS['charset']
16 * @uses $GLOBALS['pmaThemeImage']
17 * @uses __('No databases')
18 * @uses __('Database')
19 * @uses __('Go')
20 * @uses __('Please select a database')
21 * @uses __('No tables found in database.')
22 * @uses $GLOBALS['cfg']['LeftFrameLight']
23 * @uses $GLOBALS['cfg']['ShowTooltip']
24 * @uses $GLOBALS['cfg']['ShowTooltipAliasDB']
25 * @uses $GLOBALS['cfg']['DefaultTabDatabase']
26 * @uses $GLOBALS['cfgRelation']['commwork']) {
27 * @uses PMA_List_Database::getSingleItem()
28 * @uses PMA_List_Database::getHtmlSelectGrouped()
29 * @uses PMA_List_Database::getGroupedDetails()
30 * @uses PMA_generate_common_url()
31 * @uses PMA_generate_common_hidden_inputs()
32 * @uses PMA_getDbComment();
33 * @uses PMA_getTableCount()
34 * @uses PMA_getTableList()
35 * @uses PMA_getRelationsParam()
36 * @uses PMA_outBufferPre()
37 * @uses strlen()
38 * @uses session_write_close()
39 * @uses is_array()
40 * @uses implode()
41 * @uses htmlspecialchars()
44 /**
45 * Gets a core script and starts output buffering work
47 require_once './libraries/common.inc.php';
49 /**
50 * finish and cleanup navigation.php script execution, only to be used in navigation.php
52 * @uses $GLOBALS['controllink'] to close it
53 * @uses $GLOBALS['userlink'] to close it
54 * @access private
56 function PMA_exitNavigationFrame()
58 $params = array('uniqid' => uniqid());
59 if (!empty($GLOBALS['db'])) {
60 $params['db'] = $GLOBALS['db'];
62 echo '<div id="reloadlink">' . "\n";
63 echo '<a href="navigation.php' . PMA_generate_common_url($params) . '" target="frame_navigation">';
64 if ($GLOBALS['cfg']['NavigationBarIconic']) {
65 echo '<img class="icon" src="'. $GLOBALS['pmaThemeImage'] . 's_reload.png"'
66 . ' title="' . __('Reload navigation frame') . '"'
67 . ' alt="' . __('Reload navigation frame') . '" />';
69 if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
70 echo __('Reload navigation frame');
72 echo '</a>';
73 echo '</div>' . "\n";
74 echo '</body></html>';
75 exit;
78 // keep the offset of the db list in session before closing it
79 if (! isset($_SESSION['tmp_user_values']['navi_limit_offset'])) {
80 $_SESSION['tmp_user_values']['navi_limit_offset'] = 0;
82 if (! isset($_SESSION['tmp_user_values']['table_limit_offset']) || $_SESSION['tmp_user_values']['table_limit_offset_db'] != $db) {
83 $_SESSION['tmp_user_values']['table_limit_offset'] = 0;
84 $_SESSION['tmp_user_values']['table_limit_offset_db'] = $db;
86 if (isset($_REQUEST['pos'])) {
87 if (isset($_REQUEST['tpos'])) {
88 $_SESSION['tmp_user_values']['table_limit_offset'] = (int) $_REQUEST['pos'];
90 else {
91 $_SESSION['tmp_user_values']['navi_limit_offset'] = (int) $_REQUEST['pos'];
94 $pos = $_SESSION['tmp_user_values']['navi_limit_offset'];
95 $tpos = $_SESSION['tmp_user_values']['table_limit_offset'];
96 // free the session file, for the other frames to be loaded
97 // but only if debugging is not enabled
98 if (empty($_SESSION['debug'])) {
99 session_write_close();
103 * the output compression library
105 require_once './libraries/ob.lib.php';
107 PMA_outBufferPre();
110 * selects the database if there is only one on current server
112 if ($GLOBALS['server'] && ! strlen($GLOBALS['db'])) {
113 $GLOBALS['db'] = $GLOBALS['pma']->databases->getSingleItem();
116 $db_start = $GLOBALS['db'];
119 * the relation library
121 require_once './libraries/relation.lib.php';
122 $cfgRelation = PMA_getRelationsParam();
125 * For re-usability, moved http-headers to a seperate file.
126 * It can now be included by libraries/header.inc.php, querywindow.php.
128 require_once './libraries/header_http.inc.php';
131 * Displays the frame
133 // xml declaration moves IE into quirks mode, making much trouble with CSS
134 /* echo '<?xml version="1.0" encoding="' . $GLOBALS['charset'] . '"?>'; */
136 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
137 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
138 <html xmlns="http://www.w3.org/1999/xhtml"
139 xml:lang="<?php echo $available_languages[$lang][1]; ?>"
140 lang="<?php echo $available_languages[$lang][1]; ?>"
141 dir="<?php echo $GLOBALS['text_dir']; ?>">
143 <head>
144 <link rel="icon" href="./favicon.ico" type="image/x-icon" />
145 <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
146 <title>phpMyAdmin</title>
147 <meta http-equiv="Content-Type"
148 content="text/html; charset=<?php echo $GLOBALS['charset']; ?>" />
149 <base target="frame_content" />
150 <link rel="stylesheet" type="text/css"
151 href="phpmyadmin.css.php?<?php echo PMA_generate_common_url('', ''); ?>&amp;js_frame=left&amp;nocache=<?php echo $GLOBALS['PMA_Config']->getThemeUniqueValue(); ?>" />
152 <script src="./js/jquery/jquery-1.4.2.js" type="text/javascript"></script>
153 <script type="text/javascript" src="js/navigation.js"></script>
154 <script type="text/javascript" src="js/functions.js"></script>
155 <script type="text/javascript">
156 // <![CDATA[
157 var image_minus = '<?php echo $GLOBALS['pmaThemeImage']; ?>b_minus.png';
158 var image_plus = '<?php echo $GLOBALS['pmaThemeImage']; ?>b_plus.png';
160 // INIT PMA_setFrameSize
161 var onloadCnt = 0;
162 var onLoadHandler = window.onload;
163 var resizeHandler = window.onresize;
164 window.document.onresize = resizeHandler;
165 window.onload = function() {
166 if (onloadCnt == 0) {
167 if (typeof(onLoadHandler) == "function") {
168 onLoadHandler();
170 if (typeof(PMA_setFrameSize) != 'undefined' && typeof(PMA_setFrameSize) == 'function') {
171 PMA_setFrameSize();
173 onloadCnt++;
176 window.onresize = function() {
177 if (typeof(resizeHandler) == "function") {
178 resizeHandler();
180 if (typeof(PMA_saveFrameSize) != 'undefined' && typeof(PMA_saveFrameSize) == 'function') {
181 PMA_saveFrameSize();
184 // ]]>
185 </script>
186 <?php
188 * remove horizontal scroll bar bug in IE 6 by forcing a vertical scroll bar
191 <!--[if IE 6]>
192 <style type="text/css">
193 /* <![CDATA[ */
194 html {
195 overflow-y: scroll;
197 /* ]]> */
198 </style>
199 <![endif]-->
200 </head>
202 <body id="body_leftFrame">
203 <?php
204 require './libraries/navigation_header.inc.php';
205 if (! $GLOBALS['server']) {
206 // no server selected
207 PMA_exitNavigationFrame();
208 } elseif (! count($GLOBALS['pma']->databases)) {
209 // no database available, so we break here
210 echo '<p>' . __('No databases') . '</p>';
211 PMA_exitNavigationFrame();
212 } elseif ($GLOBALS['cfg']['LeftFrameLight'] && count($GLOBALS['pma']->databases) > 1) {
213 $list = $cfg['DisplayDatabasesList'];
214 if ($list === 'auto') {
215 if (empty($GLOBALS['db'])) {
216 $list = true;
217 } else {
218 $list = false;
221 if (!$list) {
222 // more than one database available and LeftFrameLight is true
223 // display db selectbox
225 // Light mode -> beginning of the select combo for databases
226 // Note: When javascript is active, the frameset will be changed from
227 // within navigation.php. With no JS (<noscript>) the whole frameset will
228 // be rebuilt with the new target frame.
231 <div id="databaseList">
232 <form method="post" action="index.php" target="_parent" id="left">
233 <?php
234 echo PMA_generate_common_hidden_inputs() . "\n";
235 echo $GLOBALS['pma']->databases->getHtmlSelectGrouped(true, $_SESSION['tmp_user_values']['navi_limit_offset'], $GLOBALS['cfg']['MaxDbList']) . "\n";
236 echo '<noscript>' . "\n"
237 .'<input type="submit" name="Go" value="' . __('Go') . '" />' . "\n"
238 .'</noscript>' . "\n"
239 .'</form>' . "\n";
240 } else {
241 if (! empty($db)) {
242 echo '<div id="databaseList">' . "\n";
244 echo $GLOBALS['pma']->databases->getHtmlListGrouped(true, $_SESSION['tmp_user_values']['navi_limit_offset'], $GLOBALS['cfg']['MaxDbList']) . "\n";
246 $_url_params = array('pos' => $pos);
247 PMA_listNavigator(count($GLOBALS['pma']->databases), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList']);
248 if (! empty($db)) {
249 echo '</div>' . "\n";
254 <div id="left_tableList">
255 <?php
256 // Don't display expansible/collapsible database info if:
257 // 1. $GLOBALS['server'] == 0 (no server selected)
258 // This is the case when there are multiple servers and
259 // '$GLOBALS['cfg']['ServerDefault'] = 0' is set. In that case, we want the welcome
260 // screen to appear with no database info displayed.
261 // 2. there is only one database available (ie either only one database exists
262 // or $GLOBALS['cfg']['Servers']['only_db'] is defined and is not an array)
263 // In this case, the database should not be collapsible/expandable
265 $img_plus = '<img class="icon" id="el%dImg" src="' . $pmaThemeImage . 'b_plus.png"'
266 .' width="9" height="9" alt="+" />';
267 $img_minus = '<img class="icon" id="el%dImg" src="' . $pmaThemeImage . 'b_minus.png"'
268 .' width="9" height="9" alt="-" />';
270 $href_left = '<a onclick="if (toggle(\'%d\')) return false;"'
271 .' href="navigation.php?%s" target="_self">';
273 $element_counter = 0;
276 if ($GLOBALS['cfg']['LeftFrameLight'] && strlen($GLOBALS['db'])) {
277 $table_list = PMA_getTableList($GLOBALS['db']);
278 $table_count = count($table_list);
280 // show selected databasename as link to DefaultTabDatabase-page
281 // with table count in ()
282 $common_url_query = PMA_generate_common_url($GLOBALS['db']);
284 $db_tooltip = '';
286 if ($GLOBALS['cfg']['ShowTooltip']
287 && $GLOBALS['cfgRelation']['commwork']) {
288 $_db_tooltip = PMA_getDbComment($GLOBALS['db']);
289 if ($_db_tooltip) {
290 $db_tooltip = $_db_tooltip;
294 $disp_name = $GLOBALS['db'];
295 if ($db_tooltip && $GLOBALS['cfg']['ShowTooltipAliasDB']) {
296 $disp_name = $db_tooltip;
297 $disp_name_cut = $db_tooltip;
298 $db_tooltip = $GLOBALS['db'];
301 if ($table_count) {
303 <span id="NavFilter">
304 <input type="text" name="fast_filter" id="fast_filter" title="<?php echo __('Filter'); ?>" />
305 <span id="clear_fast_filter" title="<?php echo __('Clear'); ?>">X</span>
306 </span>
307 <?php
311 * This helps reducing the navi panel size; in the right panel,
312 * user can find a navigator to page thru all tables.
315 $table_list = array_slice($table_list, $tpos, $cfg['MaxTableList']);
316 if (! empty($table_list)) {
317 // upper table list paginator
318 if (count($table_list) <= $GLOBALS['cfg']['MaxTableList'] && $table_count > $GLOBALS['cfg']['MaxTableList']) {
319 $_url_params = array(
320 'tpos' => 'true',
321 'pos' => $tpos,
322 'db' => $GLOBALS['db']
324 PMA_listNavigator($table_count, $tpos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxTableList']);
326 PMA_displayTableList($table_list, true, '', $GLOBALS['db']);
327 // lower table list paginator
328 if (count($table_list) <= $GLOBALS['cfg']['MaxTableList'] && $table_count > $GLOBALS['cfg']['MaxTableList']) {
329 PMA_listNavigator($table_count, $tpos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxTableList']);
331 } else {
332 echo __('No tables found in database.');
334 unset($table_list);
335 echo '<ul id="newtable"><li><a target="frame_content" href="tbl_create.php' . PMA_generate_common_url(array('db' => $GLOBALS['db'])) . '">'
336 .'<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_snewtbl.png" id="icon_newtable" width="10" height="10" alt="' . _pgettext('short form', 'Create table') . '" />'
337 . _pgettext('short form', 'Create table') . '</a></li></ul>';
338 } elseif ($GLOBALS['cfg']['LeftFrameLight']) {
339 echo '<p>' . __('Please select a database') . '</p>';
340 } else {
341 echo '<div id="databaseList">' . "\n";
342 $_url_params = array('pos' => $pos);
343 PMA_listNavigator(count($GLOBALS['pma']->databases), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList']);
344 echo '</div>' . "\n";
346 $common_url_query = PMA_generate_common_url();
347 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']);
351 * displays collapsable db list
353 * @uses $_REQUEST['dbgroup']
354 * @uses $GLOBALS['cfg']['DefaultTabDatabase']
355 * @uses __('Please select a database')
356 * @uses strpos()
357 * @uses urlencode()
358 * @uses printf()
359 * @uses htmlspecialchars()
360 * @uses PMA_generate_common_url()
361 * @uses PMA_getTableList()
362 * @uses PMA_displayTableList()
363 * @global integer $element_counter
364 * @global string $img_minus
365 * @global string $img_plus
366 * @global string $href_left
367 * @global string $db_start
368 * @global string $common_url_query
369 * @param array $ext_dblist extended db list
370 * @param integer $offset
371 * @param integer $count
373 function PMA_displayDbList($ext_dblist, $offset, $count) {
374 global $element_counter, $img_minus, $img_plus, $href_left,
375 $db_start, $common_url_query;
377 // get table list, for all databases
378 // doing this in one step takes advantage of a single query with information_schema!
379 $tables_full = PMA_DBI_get_tables_full($GLOBALS['pma']->databases->getLimitedItems($offset, $count));
381 $url_dbgroup = '';
382 echo '<ul id="leftdatabaselist">';
383 $close_db_group = false;
384 foreach ($ext_dblist as $group => $db_group) {
385 if (count($GLOBALS['pma']->databases) > 1) {
386 if ($close_db_group) {
387 $url_dbgroup = '';
388 echo '</ul>';
389 echo '</li>';
390 $close_db_group = false;
392 if (count($db_group) > 1) {
393 $close_db_group = true;
394 $url_dbgroup = '&amp;dbgroup=' . urlencode($group);
395 $common_url_query = PMA_generate_common_url() . $url_dbgroup;
396 $element_counter++;
397 echo '<li class="dbgroup">';
398 if ((! empty($_REQUEST['dbgroup']) && $_REQUEST['dbgroup'] == $group)
399 || $db_start == $group || strpos($db_start, $group) === 0) {
400 // display + only if this db(group) is not preselected
401 printf($href_left, $element_counter, PMA_generate_common_url());
402 printf($img_minus, $element_counter);
403 } else {
404 printf($href_left, $element_counter, $common_url_query);
405 printf($img_plus, $element_counter);
407 echo '</a> ' . $group . "\n";
408 if ((! empty($_REQUEST['dbgroup']) && $_REQUEST['dbgroup'] == $group)
409 || $db_start == $group || strpos($db_start, $group) === 0) {
410 echo '<ul id="subel' . $element_counter . '">' . "\n";
411 } else {
412 echo '<ul id="subel' . $element_counter . '"'
413 .' style="display: none">' . "\n";
417 foreach ($db_group as $db) {
418 $common_url_query = PMA_generate_common_url($db['name']) . $url_dbgroup;
420 $element_counter++;
421 // Displays the database name
422 echo '<li>' . "\n";
424 if (count($GLOBALS['pma']->databases) > 1) {
425 // only with more than one db we need collapse ...
426 if ($db_start != $db['name'] || $db['num_tables'] < 1) {
427 // display + only if this db is not preselected
428 // or table count is 0
429 printf($href_left, $element_counter, $common_url_query);
430 printf($img_plus, $element_counter);
431 } else {
432 printf($href_left, $element_counter,
433 PMA_generate_common_url() . $url_dbgroup);
434 printf($img_minus, $element_counter);
436 echo '</a>';
438 // ... and we need to refresh both frames on db selection
440 <a class="item"
441 id="<?php echo htmlspecialchars($db['name']); ?>"
442 href="index.php?<?php echo $common_url_query; ?>"
443 target="_parent"
444 title="<?php echo htmlspecialchars($db['comment']); ?>"
445 onclick="
446 if (! toggle('<?php echo $element_counter; ?>', true))
447 window.parent.goTo('./navigation.php?<?php echo $common_url_query; ?>');
448 window.parent.goTo('./<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
449 . '?' . $common_url_query; ?>', 'main');
450 return false;">
451 <?php
452 if ($GLOBALS['text_dir'] === 'rtl') {
453 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
455 echo htmlspecialchars($db['disp_name']);
456 if ($GLOBALS['text_dir'] === 'ltr') {
457 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
460 </a>
461 <?php
462 } else {
463 // with only 1 db available we dont need to refresh left frame
464 // on db selection, only phpmain
466 <a href="<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
467 . '?' . $common_url_query; ?>"
468 id="<?php echo htmlspecialchars($db['name']); ?>"
469 title="<?php echo htmlspecialchars($db['comment']); ?>">
470 <?php
471 if ($GLOBALS['text_dir'] === 'rtl') {
472 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
474 echo htmlspecialchars($db['disp_name']);
475 if ($GLOBALS['text_dir'] === 'ltr') {
476 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
479 </a>
480 <?php
482 if ($db['num_tables']) {
483 if (isset($tables_full[$db['name']])) {
484 $tables = PMA_getTableList($db['name'], $tables_full[$db['name']]);
485 } elseif (isset($tables_full[strtolower($db['name'])])) {
486 // on windows with lower_case_table_names = 1
487 // MySQL returns
488 // with SHOW DATABASES or information_schema.SCHEMATA: `Test`
489 // but information_schema.TABLES gives `test`
490 // bug #1436171
491 // sf.net/tracker/?func=detail&aid=1436171&group_id=23067&atid=377408
492 $tables = PMA_getTableList($db['name'], $tables_full[strtolower($db['name'])]);
493 } else {
494 $tables = PMA_getTableList($db['name']);
496 $child_visible =
497 (bool) (count($GLOBALS['pma']->databases) === 1 || $db_start == $db['name']);
498 PMA_displayTableList($tables, $child_visible, '', $db['name']);
499 } elseif ($GLOBALS['cfg']['LeftFrameLight']) {
500 // no tables and LeftFrameLight:
501 // display message no tables in selected db
502 echo '<p>' . __('Please select a database') . '</p>' . "\n";
504 echo '</li>' . "\n";
505 } // end foreach db
506 } // end foreach group
508 if ($close_db_group) {
509 $url_dbgroup = '';
510 echo '</ul>';
511 echo '</li>';
512 $close_db_group = false;
515 echo '</ul>' . "\n";
519 * display unordered list of tables
520 * calls itself recursively if table in given list
521 * is a list itself
523 * @uses is_array()
524 * @uses count()
525 * @uses urlencode()
526 * @uses strpos()
527 * @uses printf()
528 * @uses htmlspecialchars()
529 * @uses strlen()
530 * @uses is_array()
531 * @uses PMA_displayTableList()
532 * @uses $_REQUEST['tbl_group']
533 * @uses $GLOBALS['common_url_query']
534 * @uses $GLOBALS['table']
535 * @uses $GLOBALS['pmaThemeImage']
536 * @uses $GLOBALS['cfg']['LeftFrameTableSeparator']
537 * @uses $GLOBALS['cfg']['DefaultTabDatabase']
538 * @uses $GLOBALS['cfg']['DefaultTabTable']
539 * @uses __('Rows')
540 * @uses __('Browse')
541 * @global integer the element counter
542 * @global string html code for '-' image
543 * @global string html code for '+' image
544 * @global string html code for self link
545 * @param array $tables array of tables/tablegroups
546 * @param boolean $visible whether the list is visible or not
547 * @param string $tab_group_full full tab group name
548 * @param string $table_db db of this table
550 function PMA_displayTableList($tables, $visible = false,
551 $tab_group_full = '', $table_db = '')
553 if (! is_array($tables) || count($tables) === 0) {
554 return;
557 global $element_counter, $img_minus, $img_plus, $href_left;
558 $sep = $GLOBALS['cfg']['LeftFrameTableSeparator'];
560 if ($visible) {
561 echo '<ul id="subel' . $element_counter . '">';
562 } else {
563 echo '<ul id="subel' . $element_counter . '" style="display: none">';
565 foreach ($tables as $group => $table) {
566 // only allow grouping if the group has more than 1 table
567 if (isset($table['is' . $sep . 'group']) && $table['tab' . $sep . 'count'] > 1) {
568 $common_url_query = $GLOBALS['common_url_query']
569 . '&amp;tbl_group=' . urlencode($tab_group_full . $group);
571 $element_counter++;
572 echo '<li>' . "\n";
573 if ($visible
574 && ((isset($_REQUEST['tbl_group'])
575 && (strpos($_REQUEST['tbl_group'], $group) === 0
576 || strpos($_REQUEST['tbl_group'], $sep . $group) !== false))
577 || strpos($GLOBALS['table'], $group) === 0)) {
578 printf($href_left, $element_counter,
579 $GLOBALS['common_url_query'] . '&amp;tbl_group=' . $tab_group_full);
580 printf($img_minus, $element_counter);
581 } else {
582 printf($href_left, $element_counter, $common_url_query);
583 printf($img_plus, $element_counter);
585 echo '</a>';
587 <a href="index.php?<?php echo $common_url_query; ?>"
588 target="_parent"
589 onclick="
590 if (! toggle('<?php echo $element_counter; ?>', true))
591 window.parent.goTo('./navigation.php?<?php echo $common_url_query; ?>');
592 window.parent.goTo('./<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
593 . '?' . $common_url_query; ?>', 'main');
594 return false;">
595 <?php
596 if ($GLOBALS['text_dir'] === 'rtl') {
597 echo ' <bdo dir="ltr">(' . $table['tab' . $sep . 'count'] . ')</bdo> ';
599 echo htmlspecialchars(substr($group, 0, strlen($group) - strlen($sep)));
600 if ($GLOBALS['text_dir'] === 'ltr') {
601 echo ' <bdo dir="ltr">(' . $table['tab' . $sep . 'count'] . ')</bdo> ';
604 </a>
605 <?php
607 unset($table['is' . $sep . 'group']);
608 unset($table['tab' . $sep . 'group']);
609 unset($table['tab' . $sep . 'count']);
611 if ($visible &&
612 ((isset($_REQUEST['tbl_group'])
613 && (strpos($_REQUEST['tbl_group'], $group) === 0
614 || strpos($_REQUEST['tbl_group'], $sep . $group) !== false))
615 || strpos($GLOBALS['table'], $group) === 0)) {
616 PMA_displayTableList($table, true,
617 $tab_group_full . $group, $table_db);
618 } else {
619 PMA_displayTableList($table, false, '', $table_db);
621 echo '</li>' . "\n";
622 } elseif (is_array($table)) {
623 // the table was not grouped because it is the only one with its prefix
624 if (isset($table['is' . $sep . 'group'])) {
625 // get the array with the actual table information
626 foreach ($table as $value) {
627 if(is_array($value)) {
628 $table = $value;
632 $link_title = PMA_getTitleForTarget($GLOBALS['cfg']['LeftDefaultTabTable']);
633 // quick access icon next to each table name
634 echo '<li>' . "\n";
635 echo '<a class="tableicon" title="'
636 . htmlspecialchars($link_title)
637 . ': ' . htmlspecialchars($table['Comment'])
638 .' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . __('Rows') . ')"'
639 .' id="quick_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"'
640 .' href="' . $GLOBALS['cfg']['LeftDefaultTabTable'] . '?'
641 . $GLOBALS['common_url_query']
642 .'&amp;table=' . urlencode($table['Name'])
643 .'&amp;goto=' . $GLOBALS['cfg']['LeftDefaultTabTable']
644 . '" >'
645 .'<img class="icon"';
646 if ('VIEW' === strtoupper($table['Comment'])) {
647 echo ' src="' . $GLOBALS['pmaThemeImage'] . 's_views.png"';
648 } else {
649 echo ' src="' . $GLOBALS['pmaThemeImage'] . 'b_sbrowse.png"';
651 echo ' id="icon_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"'
652 .' width="10" height="10" alt="' . htmlspecialchars($link_title) . '" /></a>' . "\n";
654 // link for the table name itself
655 $href = $GLOBALS['cfg']['DefaultTabTable'] . '?'
656 .$GLOBALS['common_url_query'] . '&amp;table='
657 .urlencode($table['Name']) . '&amp;pos=0';
658 echo '<a href="' . $href
659 . '" title="' . htmlspecialchars(PMA_getTitleForTarget($GLOBALS['cfg']['DefaultTabTable']) . ': ' . $table['Comment']
660 .' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . __('Rows')) . ')"'
661 .' id="' . htmlspecialchars($table_db . '.' . $table['Name']) . '">'
662 // preserve spaces in table name
663 . str_replace(' ', '&nbsp;', htmlspecialchars($table['disp_name'])) . '</a>';
664 echo '</li>' . "\n";
667 echo '</ul>';
670 echo '</div>' . "\n";
672 PMA_exitNavigationFrame();