"Simple Search", "dropdown" => "Dropdown Select", "boolean" => "Yes/No/Both Select", "date-range" => "Date Range" ); $report_type = isset($_POST["report_type"]) ? $_POST["report_type"] : $type; $used_fields = array(); $used_filters = array(); $unused_fields = array(); $unused_filters = array(); $table = isset($_POST["table"]) ? $_POST["table"] : $table; $table_columns = array(); if (isset($fields)) { foreach ($fields as $key => $field) { $used_fields[] = $key; } foreach ($filters as $key => $field) { $used_filters[] = $key; } // Figure out the fields we're not using so we can offer them back. $table_description = BigTree::describeTable($table); foreach ($table_description["columns"] as $column => $details) { if (!in_array($column,$used_fields)) { $unused_fields[] = array("field" => $column, "title" => str_replace(array("Url","Pdf","Sql"),array("URL","PDF","SQL"),ucwords(str_replace(array("-","_")," ",$details["name"])))); } if (!in_array($column,$used_filters)) { $unused_filters[] = array("field" => $column, "title" => str_replace(array("Url","Pdf","Sql"),array("URL","PDF","SQL"),ucwords(str_replace(array("-","_")," ",$details["name"])))); } $table_columns[] = $column; } } else { $fields = array(); $filters = array(); // To tolerate someone selecting the blank spot in the table dropdown again when creating a form. if ($table) { $table_info = BigTree::describeTable($table); } else { $table_info = array("foreign_keys" => array(), "columns" => array()); } foreach ($table_info["columns"] as $column) { $table_columns[] = $column["name"]; $title = str_replace(array("Url","Pdf","Sql"),array("URL","PDF","SQL"),ucwords(str_replace(array("-","_")," ",$column["name"]))); $fields[$column["name"]] = $title; $type = "search"; if ($column["type"] == "date" || $column["type"] == "datetime" || $column["type"] == "timestamp") { $type = "date-range"; } if ($column["name"] == "approved" || $column["name"] == "archived" || $column["name"] == "featured") { $type = "boolean"; } $filters[$column["name"]] = array("title" => $title,"type" => $type); } } if (count($fields)) { ?>
Title Type
style="display: none;">

Title

Please choose a table to populate this area.