$match) { $table_pos[$match[1]] = array($match[2], $match[3]); $table_pos_js[] = "\n\t'" . js_escape($match[1]) . "': [ $match[2], $match[3] ]"; } $top = 0; $base_left = -1; $schema = array(); // table => array("fields" => array(name => field), "pos" => array(top, left), "references" => array(table => array(left => array(source, target)))) $referenced = array(); // target_table => array(table => array(left => target_column)) $lefts = array(); // float => bool foreach (table_status('', true) as $table => $table_status) { if (is_view($table_status)) { continue; } $pos = 0; $schema[$table]["fields"] = array(); foreach (fields($table) as $name => $field) { $pos += 1.25; $field["pos"] = $pos; $schema[$table]["fields"][$name] = $field; } $schema[$table]["pos"] = ($table_pos[$table] ? $table_pos[$table] : array($top, 0)); foreach ($adminer->foreignKeys($table) as $val) { if (!$val["db"]) { $left = $base_left; if ($table_pos[$table][1] || $table_pos[$val["table"]][1]) { $left = min(floatval($table_pos[$table][1]), floatval($table_pos[$val["table"]][1])) - 1; } else { $base_left -= .1; } while ($lefts[(string) $left]) { // find free $left $left -= .0001; } $schema[$table]["references"][$val["table"]][(string) $left] = array($val["source"], $val["target"]); $referenced[$val["table"]][$table][(string) $left] = $val["target"]; $lefts[(string) $left] = true; } } $top = max($top, $schema[$table]["pos"][0] + 2.5 + $pos); } ?>