';
$img_minus = '
';
$href_left = '
';
$element_counter = 0;
if ($GLOBALS['cfg']['LeftFrameLight'] && isset($GLOBALS['db']) && strlen($GLOBALS['db'])) {
// show selected databasename as link to DefaultTabDatabase-page
// with table count in ()
$common_url_query = PMA_generate_common_url($GLOBALS['db']);
$db_tooltip = '';
if ($GLOBALS['cfg']['ShowTooltip']
&& $GLOBALS['cfgRelation']['commwork']) {
$_db_tooltip = PMA_getComments($GLOBALS['db']);
if (is_array($_db_tooltip)) {
$db_tooltip = implode(' ', $_db_tooltip);
}
}
$disp_name = $GLOBALS['db'];
if ($db_tooltip && $GLOBALS['cfg']['ShowTooltipAliasDB']) {
$disp_name = $db_tooltip;
$disp_name_cut = $db_tooltip;
$db_tooltip = $GLOBALS['db'];
}
?>
(' . PMA_getTableCount($GLOBALS['db']) . ') ';
}
echo htmlspecialchars($disp_name);
if ($GLOBALS['text_dir'] === 'ltr') {
echo ' (' . PMA_getTableCount($GLOBALS['db']) . ') ';
}
echo '
';
$table_list = PMA_getTableList($GLOBALS['db']);
if (count($table_list) > 0) {
PMA_displayTableList($table_list, true, '', $GLOBALS['db']);
} else {
echo $GLOBALS['strNoTablesFound'];
}
unset($table_list);
} elseif ($GLOBALS['cfg']['LeftFrameLight']) {
echo '' . $GLOBALS['strSelectADb'] . '
' . "\n";
} else {
$common_url_query = PMA_generate_common_url();
PMA_displayDbList($GLOBALS['PMA_List_Database']->getGroupedDetails());
}
/**
* displays collapsable db list
*
* @uses $_REQUEST['dbgroup']
* @uses $GLOBALS['cfg']['DefaultTabDatabase']
* @uses $GLOBALS['strSelectADb']
* @uses strpos()
* @uses urlencode()
* @uses printf()
* @uses htmlspecialchars()
* @uses PMA_generate_common_url()
* @uses PMA_getTableList()
* @uses PMA_displayTableList()
* @global $element_counter
* @global $img_minus
* @global $img_plus
* @global $href_left
* @global $db_start
* @global $common_url_query
* @param array $ext_dblist extended db list
*/
function PMA_displayDbList($ext_dblist) {
global $element_counter, $img_minus, $img_plus, $href_left,
$db_start, $common_url_query;
// get table list, for all databases
// doing this in one step takes advantage of a single query with information_schema!
$tables_full = PMA_DBI_get_tables_full($GLOBALS['PMA_List_Database']->items);
$url_dbgroup = '';
echo '';
$close_db_group = false;
foreach ($ext_dblist as $group => $db_group) {
if ($GLOBALS['PMA_List_Database']->count() > 1) {
if ($close_db_group) {
$url_dbgroup = '';
echo '
';
echo '';
$close_db_group = false;
}
if (count($db_group) > 1) {
$close_db_group = true;
$url_dbgroup = '&dbgroup=' . urlencode($group);
$common_url_query = PMA_generate_common_url() . $url_dbgroup;
$element_counter++;
echo '';
if ((! empty($_REQUEST['dbgroup']) && $_REQUEST['dbgroup'] == $group)
|| $db_start == $group || strpos($db_start, $group) === 0) {
// display + only if this db(group) is not preselected
printf($href_left, $element_counter, PMA_generate_common_url());
printf($img_minus, $element_counter);
} else {
printf($href_left, $element_counter, $common_url_query);
printf($img_plus, $element_counter);
}
echo ' ' . $group . "\n";
if ((! empty($_REQUEST['dbgroup']) && $_REQUEST['dbgroup'] == $group)
|| $db_start == $group || strpos($db_start, $group) === 0) {
echo '
' . "\n";
} else {
echo '';
echo '';
$close_db_group = false;
}
echo '
' . "\n";
}
/**
* display unordered list of tables
* calls itself recursively if table in given list
* is a list itself
*
* @uses is_array()
* @uses count()
* @uses urlencode()
* @uses strpos()
* @uses printf()
* @uses htmlspecialchars()
* @uses strlen()
* @uses is_array()
* @uses PMA_displayTableList()
* @uses $_REQUEST['tbl_group']
* @uses $GLOBALS['common_url_query']
* @uses $GLOBALS['table']
* @uses $GLOBALS['pmaThemeImage']
* @uses $GLOBALS['cfg']['LeftFrameTableSeparator']
* @uses $GLOBALS['cfg']['DefaultTabDatabase']
* @uses $GLOBALS['cfg']['DefaultTabTable']
* @uses $GLOBALS['strRows']
* @uses $GLOBALS['strBrowse']
* @global integer the element counter
* @global string html code for '-' image
* @global string html code for '+' image
* @global string html code for self link
* @param array $tables array of tables/tablegroups
* @param boolean $visible wether the list is visible or not
* @param string $tab_group_full full tab group name
* @param string $table_db db of this table
*/
function PMA_displayTableList($tables, $visible = false,
$tab_group_full = '', $table_db = '')
{
if (! is_array($tables) || count($tables) === 0) {
return;
}
global $element_counter, $img_minus, $img_plus, $href_left;
$sep = $GLOBALS['cfg']['LeftFrameTableSeparator'];
if ($visible) {
echo '
';
} else {
echo '';
}
foreach ($tables as $group => $table) {
if (isset($table['is' . $sep . 'group'])) {
$common_url_query = $GLOBALS['common_url_query']
. '&tbl_group=' . urlencode($tab_group_full . $group);
$element_counter++;
echo '- ' . "\n";
if ($visible &&
((isset($_REQUEST['tbl_group'])
&& (strpos($_REQUEST['tbl_group'], $group) === 0
|| strpos($_REQUEST['tbl_group'], $sep . $group) !== false))
||
(isset($GLOBALS['table'])
&& strpos($GLOBALS['table'], $group) === 0))) {
printf($href_left, $element_counter,
$GLOBALS['common_url_query'] . '&tbl_group=' . $tab_group_full);
printf($img_minus, $element_counter);
} else {
printf($href_left, $element_counter, $common_url_query);
printf($img_plus, $element_counter);
}
echo '';
?>
(' . $table['tab' . $sep . 'count'] . ') ';
}
echo htmlspecialchars(substr($group, 0, strlen($group) - strlen($sep)));
if ($GLOBALS['text_dir'] === 'ltr') {
echo ' (' . $table['tab' . $sep . 'count'] . ') ';
}
?>
' . "\n";
} elseif (is_array($table)) {
$href = $GLOBALS['cfg']['DefaultTabTable'] . '?'
.$GLOBALS['common_url_query'] . '&table='
.urlencode($table['Name']);
echo '
- ' . "\n";
echo ''
.'' . "\n"
.''
. htmlspecialchars($table['disp_name']) . '';
echo '
' . "\n";
}
}
echo '
';
}
echo '
';
PMA_exitNavigationFrame();
?>