mirror of
https://github.com/vrana/adminer.git
synced 2025-08-26 07:44:37 +02:00
Row descriptions in select
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@856 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
@@ -57,6 +57,15 @@ function adminer_select_query($query) {
|
||||
return call_adminer('select_query', "<p><code class='jush-sql'>" . htmlspecialchars($query) . "</code> <a href='" . htmlspecialchars($SELF) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a>\n", $query);
|
||||
}
|
||||
|
||||
/** Descriptions of selected data
|
||||
* @param array all data to print
|
||||
* @param array foreign keys
|
||||
* @return array
|
||||
*/
|
||||
function adminer_row_descriptions($rows, $foreign_keys) {
|
||||
return call_adminer('row_descriptions', $rows, $rows, $foreign_keys);
|
||||
}
|
||||
|
||||
/** Value printed in select table
|
||||
* @param string escaped value to print
|
||||
* @param string link to foreign key
|
||||
|
@@ -282,6 +282,7 @@ if (!$columns) {
|
||||
$foreign_keys[$val][] = $foreign_key;
|
||||
}
|
||||
}
|
||||
$descriptions = adminer_row_descriptions($rows, $foreign_keys);
|
||||
|
||||
//! Editor only
|
||||
$backward_keys = array();
|
||||
@@ -306,7 +307,7 @@ if (!$columns) {
|
||||
echo '<th><a href="' . htmlspecialchars(remove_from_uri('(order|desc)[^=]*') . '&order%5B0%5D=' . urlencode($key) . ($_GET["order"] == array($key) && !$_GET["desc"][0] ? '&desc%5B0%5D=1' : '')) . '">' . adminer_field_name($fields, $key) . '</a>';
|
||||
}
|
||||
echo ($backward_keys ? "<th>" . lang('Relations') : "") . "</thead>\n";
|
||||
foreach ($rows as $row) {
|
||||
foreach ($descriptions as $n => $row) {
|
||||
$unique_idf = implode('&', unique_idf($row, $indexes)); //! don't use aggregation functions
|
||||
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']) . '&' . $unique_idf . '">' . lang('edit') . '</a>');
|
||||
foreach ($row as $key => $val) {
|
||||
@@ -334,7 +335,7 @@ if (!$columns) {
|
||||
foreach ((array) $foreign_keys[$key] as $foreign_key) {
|
||||
if (count($foreign_keys[$key]) == 1 || count($foreign_key["source"]) == 1) {
|
||||
foreach ($foreign_key["source"] as $i => $source) {
|
||||
$link .= where_link($i, $foreign_key["target"][$i], $row[$source]);
|
||||
$link .= where_link($i, $foreign_key["target"][$i], $rows[$n][$source]);
|
||||
}
|
||||
$link = htmlspecialchars((strlen($foreign_key["db"]) ? preg_replace('~([?&]db=)[^&]+~', '\\1' . urlencode($foreign_key["db"]), $SELF) : $SELF) . 'select=' . urlencode($foreign_key["table"])) . $link; // InnoDB supports non-UNIQUE keys
|
||||
break;
|
||||
@@ -351,7 +352,7 @@ if (!$columns) {
|
||||
echo ' <a href="' . htmlspecialchars($SELF) . 'select=' . urlencode($table);
|
||||
$i = 0;
|
||||
foreach ($columns as $column => $val) {
|
||||
echo where_link($i, $column, $row[$val]);
|
||||
echo where_link($i, $column, $rows[$n][$val]);
|
||||
$i++;
|
||||
}
|
||||
echo '">' . htmlspecialchars($table) . '</a>'; //! adminer_table_name()
|
||||
|
Reference in New Issue
Block a user