Hide empty table names in Relations

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@933 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2009-07-28 15:28:29 +00:00
parent fd6004fd3f
commit 8f525c4ac5

View file

@ -169,7 +169,7 @@ if (!$columns) {
$backward_keys = $adminer->backwardKeys($_GET["select"]); $backward_keys = $adminer->backwardKeys($_GET["select"]);
$table_names = array_keys($backward_keys); $table_names = array_keys($backward_keys);
if ($table_names) { if ($table_names) {
$table_names = array_combine($table_names, array_map(array($adminer, 'tableName'), array_map('table_status', $table_names))); $table_names = array_filter(array_combine($table_names, array_map(array($adminer, 'tableName'), array_map('table_status', $table_names))), 'strlen');
} }
echo "<table cellspacing='0' class='nowrap'>\n"; echo "<table cellspacing='0' class='nowrap'>\n";
@ -188,7 +188,7 @@ if (!$columns) {
} }
next($select); next($select);
} }
echo ($backward_keys ? "<th>" . lang('Relations') : "") . "</thead>\n"; echo ($table_names ? "<th>" . lang('Relations') : "") . "</thead>\n";
foreach ($descriptions as $n => $row) { foreach ($descriptions as $n => $row) {
$unique_idf = implode('&amp;', unique_idf($rows[$n], $indexes)); $unique_idf = implode('&amp;', unique_idf($rows[$n], $indexes));
echo '<tr' . odd() . '><td><input type="checkbox" name="check[]" value="' . $unique_idf . '" onclick="this.form[\'all\'].checked = false; form_uncheck(\'all-page\');">' . (count($select) != count($group) || information_schema($_GET["db"]) ? '' : ' <a href="' . htmlspecialchars($SELF) . 'edit=' . urlencode($_GET['select']) . '&amp;' . $unique_idf . '">' . lang('edit') . '</a>'); echo '<tr' . odd() . '><td><input type="checkbox" name="check[]" value="' . $unique_idf . '" onclick="this.form[\'all\'].checked = false; form_uncheck(\'all-page\');">' . (count($select) != count($group) || information_schema($_GET["db"]) ? '' : ' <a href="' . htmlspecialchars($SELF) . 'edit=' . urlencode($_GET['select']) . '&amp;' . $unique_idf . '">' . lang('edit') . '</a>');
@ -231,17 +231,17 @@ if (!$columns) {
echo "<td>$val"; echo "<td>$val";
} }
} }
if ($backward_keys) { if ($table_names) {
echo "<td>"; echo "<td>";
foreach ($backward_keys as $table => $keys) { foreach ($table_names as $table => $name) {
foreach ($keys as $columns) { foreach ($backward_keys[$table] as $columns) {
echo ' <a href="' . htmlspecialchars($SELF) . 'select=' . urlencode($table); echo ' <a href="' . htmlspecialchars($SELF) . 'select=' . urlencode($table);
$i = 0; $i = 0;
foreach ($columns as $column => $val) { foreach ($columns as $column => $val) {
echo where_link($i, $column, $rows[$n][$val]); echo where_link($i, $column, $rows[$n][$val]);
$i++; $i++;
} }
echo "\">$table_names[$table]</a>"; echo "\">$name</a>";
} }
} }
} }