<?php // Get the form so we can walk through its fields $form = BigTreeAutoModule::getForm($_GET["form"]); // Create a generic module class to get the decoded item data $m = new BigTreeModule(); $m->Table = $form["table"]; $item = $m->get($_GET["id"]); // Loop through form resources and see if we have related page data, only check html and text fields if (is_array($form["fields"])) { $check_data("", $external, $form["fields"], $item); } // Only retrieve these if we have errors as we only need them for URL generation if (array_filter($integrity_errors)) { $action = $admin->getModuleActionForForm($form); $module = $admin->getModule($action["module"]); } foreach ($integrity_errors as $field => $error_types) { foreach ($error_types as $type => $errors) { foreach ($errors as $error) { ?> <li> <section class="integrity_errors"> <a href="<?php echo ADMIN_ROOT . $module["route"] . "/" . $action["route"] . "/" . htmlspecialchars($_GET["id"]); ?> /" target="_blank">Edit</a> <span class="icon_small icon_small_warning"></span> <p>Broken <?php echo $type == "img" ? "Image" : "Link"; ?>
<?php $fieldMod = new BigTreeModule("btx_form_builder_fields"); BigTree::globalizePOSTVars("htmlspecialchars"); $form = sqlescape($bigtree["commands"][0]); // Get cleaned up prices, dates, and entries if ($early_bird) { $early_bird_date = "'" . date("Y-m-d H:i:s", strtotime(str_replace("@", "", $_POST["early_bird_date"]))) . "'"; $early_bird_base_price = floatval(str_replace(array('$', ',', ' '), '', $_POST["early_bird_base_price"])); } else { $early_bird_date = "NULL"; } $base_price = floatval(str_replace(array('$', ',', ' '), '', $_POST["base_price"])); $max_entries = intval($max_entries); BigTreeAutoModule::updateItem("btx_form_builder_forms", $form, array("title" => $title, "paid" => $paid, "base_price" => $base_price, "early_bird_base_price" => $early_bird_base_price, "early_bird_date" => $early_bird_date, "limit_entries" => $limit_entries, "max_entries" => $max_entries)); // Setup the default column, sort position, alignment inside columns. $position = count($_POST["type"]); $column = 0; $alignment = ""; // Get all the previous fields so we know which to delete. $fields_to_delete = array(); $existing_fields = $fieldMod->getMatching("form", $form); foreach ($existing_fields as $field) { $fields_to_delete[$field["id"]] = $field["id"]; } foreach ($_POST["type"] as $key => $type) { $id = $_POST["id"][$key]; // The field still exists, remove it from the list to delete if ($id) { unset($fields_to_delete[$id]); }
function get($item) { $item = parent::get($item); $item["detail_link"] = $this->Link . "detail/" . $item["route"] . "/"; return $item; }
static function searchEntries($id, $query, $page = 1) { $mod = new BigTreeModule("btx_form_builder_entries"); $results = $mod->search($query, "id DESC"); $form_results = array(); // Get only the results for the given form foreach ($results as $result) { if ($result["form"] == $id) { $form_results[] = $result; } } $pages = ceil(count($form_results) / 15); self::$SearchPageCount = $pages ? $pages : 1; return array_slice($form_results, ($page - 1) * 15, 15); }