';
$img_minus = '
![-](' . $pmaThemeImage . 'b_minus.png)
';
$href_left = '
';
$element_counter = 0;
if ($GLOBALS['cfg']['LeftFrameLight'] && isset($db) && strlen($db)) {
// show selected databasename as link to DefaultTabDatabase-page
// with table count in ()
$common_url_query = PMA_generate_common_url($db);
$db_tooltip = '';
if ($GLOBALS['cfg']['ShowTooltip']
&& $GLOBALS['cfgRelation']['commwork']) {
$_db_tooltip = PMA_getComments($db);
if (is_array($_db_tooltip)) {
$db_tooltip = implode(' ', $_db_tooltip);
}
}
$disp_name = $db;
if ($db_tooltip && $GLOBALS['cfg']['ShowTooltipAliasDB']) {
$disp_name = $db_tooltip;
$disp_name_cut = $db_tooltip;
$db_tooltip = $db;
}
?>
(' . PMA_getTableCount($db) . ') ';
}
echo htmlspecialchars($disp_name);
if ($GLOBALS['text_dir'] === 'ltr') {
echo ' (' . PMA_getTableCount($db) . ') ';
}
echo '
';
$table_list = PMA_getTableList($db);
if (count($table_list) > 0) {
PMA_displayTableList($table_list, true, '', $db);
} else {
echo $strNoTablesFound;
}
unset($table_list);
} elseif ($GLOBALS['cfg']['LeftFrameLight']) {
echo '' . $GLOBALS['strSelectADb'] . '
' . "\n";
} else {
$common_url_query = PMA_generate_common_url();
PMA_displayDbList(PMA_getDbList());
}
/**
* 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 $num_dbs
* @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, $num_dbs,
$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['dblist']);
$url_dbgroup = '';
echo '';
$close_db_group = false;
foreach ($ext_dblist as $group => $db_group) {
if ($num_dbs > 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 $element_counter
* @global $img_minus
* @global $img_plus
* @global $href_left
* @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 '
';
}
?>