Files
adminer/plugins/table-structure.php

42 lines
1.5 KiB
PHP
Raw Normal View History

<?php
/** Expanded table structure output
* @link https://www.adminer.org/plugins/#use
* @author Matthew Gamble, https://www.matthewgamble.net/
2018-01-14 11:03:54 +01:00
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
*/
class AdminerTableStructure {
/** Print table structure in tabular format
* @param array data about individual fields
* @return bool
*/
function tableStructurePrint($fields, $tableStatus = null) {
2018-10-27 21:20:56 +02:00
echo "<div class='scrollable'>\n";
2025-02-23 11:42:05 +01:00
echo "<table class='nowrap odds'>\n";
2025-03-12 11:38:28 +01:00
echo "<thead><tr>"
. "<th>" . Adminer\lang('Column')
. "<th>" . Adminer\lang('Type')
. "<th>" . Adminer\lang('Collation')
. "<th>" . Adminer\lang('Nullable')
. "<th>" . Adminer\lang('Default')
. (Adminer\support("comment") ? "<th>" . Adminer\lang('Comment') : "")
. "</thead>\n"
;
foreach ($fields as $field) {
2025-03-05 11:40:56 +01:00
echo "<tr><th>" . Adminer\h($field["field"]) . ($field["primary"] ? " (PRIMARY)" : "");
echo "<td><span>" . Adminer\h($field["full_type"]) . "</span>";
echo ($field["auto_increment"] ? " <i>" . Adminer\lang('Auto Increment') . "</i>" : "");
echo "<td>" . ($field["collation"] ? " <i>" . Adminer\h($field["collation"]) . "</i>" : "");
echo "<td>" . ($field["null"] ? Adminer\lang('Yes') : Adminer\lang('No'));
echo "<td>" . Adminer\h($field["default"]);
echo (Adminer\support("comment") ? "<td>" . Adminer\h($field["comment"]) : "");
echo "\n";
}
echo "</table>\n";
echo "</div>\n";
return true;
}
}