$details) { if (!in_array($column,$reserved) && !in_array($column,$used)) { $unused[] = array("field" => $column, "title" => str_replace(array("Url","Pdf","Sql"),array("URL","PDF","SQL"),ucwords(str_replace(array("-","_")," ",$details["name"])))); } if ($column == "position") { $positioned = true; } $table_columns[] = $column; } } else { $fields = array(); // To tolerate someone selecting the blank spot in the table dropdown again when creating a form. if ($table) { $table_description = BigTree::describeTable($table); } else { $table_description = array("foreign_keys" => array(), "columns" => array()); } // Let's relate the foreign keys based on the local column so we can check easier. $foreign_keys = array(); foreach ($table_description["foreign_keys"] as $key) { if (count($key["local_columns"]) == 1) { $foreign_keys[$key["local_columns"][0]] = $key; } } foreach ($table_description["columns"] as $column) { $table_columns[] = $column["name"]; if (!in_array($column["name"],$reserved)) { // Do a ton of guessing here to try to save time. $subtitle = ""; $type = "text"; $title = str_replace(array("Url","Pdf","Sql"),array("URL","PDF","SQL"),ucwords(str_replace(array("-","_")," ",$column["name"]))); $options = array(); if (strpos($title,"URL") !== false) { $subtitle = "(include http://)"; } if ($column["name"] == "route") { $type = "route"; } if (strpos($title,"File") !== false || strpos($title,"PDF") !== false) { $type = "upload"; } if (strpos($title,"Image") !== false) { $type = "upload"; $options["image"] = "on"; } if (strpos($title,"Description") !== false) { $type = "html"; } if ($column["name"] == "featured") { $type = "checkbox"; } if ($column["type"] == "date") { $type = "date"; } if ($column["type"] == "time") { $type = "time"; } if ($column["type"] == "datetime") { $type = "datetime"; } if ($column["type"] == "enum") { $type = "list"; $list = array(); foreach ($column["options"] as $option) { $list[] = array("value" => $option, "description" => $option); } $options = array( "list_type" => "static", "list" => $list ); if ($column["allow_null"]) { $options["allow-empty"] = "Yes"; } else { $options["allow-empty"] = "No"; } } // Database populated list for foreign keys. if (substr($column["type"],-3,3) == "int" && isset($foreign_keys[$column["name"]]) && implode("",$foreign_keys[$column["name"]]["other_columns"]) == "id") { $type = "list"; // Describe this other table $other_table = BigTree::describeTable($foreign_keys[$column["name"]]["other_table"]); $ot_columns = $other_table["columns"]; $desc_column = ""; // Find the first short title-esque column and use it as the populated list descriptor while (!$desc_column && next($ot_columns)) { $col = current($ot_columns); if (($col["type"] == "varchar" || $col["type"] == "char") && $col["size"] > 2) { $desc_column = $col; } } $options = array("list_type" => "db", "pop-table" => $foreign_keys[$column["name"]]["other_table"]); if ($desc_column) { $options["pop-description"] = $desc_column["name"]; $options["pop-sort"] = $desc_column["name"]." ASC"; } if ($column["allow_null"]) { $options["allow-empty"] = "Yes"; } else { $options["allow-empty"] = "No"; } } $fields[] = array("column" => $column["name"],"title" => $title, "subtitle" => $subtitle, "type" => $type,"options" => $options); } if ($column["name"] == "position" && $column["type"] == "int") { $positioned = true; } } } // Make sure this table has an "id" column and is auto increment, if not, throw a warning if (empty($table_description["columns"]["id"])) { ?>

The chosen table does not have a column named "id" which BigTree requires as a unique identifier.
Please an an "id" column INT(11) with Primary Key and Auto Increment settings.

The chosen table's "id" column is not set to auto increment. If you're adding to this table via BigTree, please set the column to auto increment.

getCachedFieldTypes(true); $types = $cached_types["modules"]; if (count($fields) || count($unused)) { ?>
Geocoding Many-To-Many
Title Subtitle Type Delete

The chosen table does not have any non-reserved columns.

Please choose a table to populate this area.