$p["tables"][] = $field["options"]["mtm-connecting-table"] . "#structure"; } if (!in_array($field["options"]["mtm-other-table"] . "#structure", $p["tables"]) && substr($field["options"]["mtm-other-table"], 0, 8) != "bigtree_") { $p["tables"][] = $field["options"]["mtm-other-table"] . "#structure"; } } // Include the custom field type if it was forgotten. if (isset($custom_field_types[$field["type"]])) { if (!in_array($field["type"], $p["field_types"])) { $p["field_types"][] = $field["type"]; } } } // For views/reports we just care about what table it's from } elseif ($action["view"]) { $auto = BigTreeAutoModule::getView($action["view"]); } elseif ($action["report"]) { $auto = BigTreeAutoModule::getReport($action["report"]); } if (!in_array($auto["table"] . "#structure", $p["tables"])) { $p["tables"][] = $auto["table"] . "#structure"; } } if ($module["group"]) { $p["module_groups"][] = $module["group"]; } } // Search the class files directory to see if one exists in there with our route. if (file_exists(SERVER_ROOT . "custom/inc/modules/" . $module["route"] . ".php")) { $p["files"][] = SERVER_ROOT . "custom/inc/modules/" . $module["route"] . ".php"; }
function _local_bigtree_update_22() { global $admin; // Go through all views and figure out what kind of data is in each column. $q = sqlquery("SELECT id FROM bigtree_module_views"); while ($f = sqlfetch($q)) { $admin->updateModuleViewColumnNumericStatus(BigTreeAutoModule::getView($f["id"])); } }
<?php $bigtree["report"] = BigTreeAutoModule::getReport($bigtree["module_action"]["report"]); $bigtree["form"] = BigTreeAutoModule::getRelatedFormForReport($bigtree["report"]); $bigtree["view"] = $bigtree["report"]["view"] ? BigTreeAutoModule::getView($bigtree["report"]["view"]) : BigTreeAutoModule::getRelatedViewForReport($bigtree["report"]); if ($admin->Level > 1) { $bigtree["subnav_extras"][] = array("link" => ADMIN_ROOT . "developer/modules/reports/edit/" . $bigtree["report"]["id"] . "/?return=front", "icon" => "setup", "title" => "Edit in Developer"); } $action = $bigtree["commands"][0]; if ($action == "csv") { include BigTree::path("admin/auto-modules/reports/csv.php"); } elseif ($action == "view") { include BigTree::path("admin/auto-modules/reports/view.php"); } else { include BigTree::path("admin/auto-modules/reports/filter.php"); }
<?php if (isset($_POST["search"]) && $_POST["search"] || isset($_GET["search"]) && $_GET["search"]) { include "draggable.php"; ?> <script>$("#nested_container").removeClass("nested_table");</script> <?php } else { if (isset($_POST["view"])) { $bigtree["view"] = BigTreeAutoModule::getView($_POST["view"]); $bigtree["module"] = $admin->getModule(BigTreeAutoModule::getModuleForView($bigtree["view"])); } $module_page = ADMIN_ROOT . $bigtree["module"]["route"] . "/"; $permission = $admin->getAccessLevel($bigtree["module"]["id"]); // Setup the preview action if we have a preview URL and field. if ($bigtree["view"]["preview_url"]) { $bigtree["view"]["actions"]["preview"] = "on"; } function _localDrawLevel($items, $depth) { global $bigtree, $module_page, $permission, $admin; foreach ($items as $item) { $expanded = !empty($_COOKIE["bigtree_admin"]["nested_views"][$bigtree["view"]["id"]][$item["id"]]) ? true : false; $children = BigTreeAutoModule::getViewDataForGroup($bigtree["view"], $item["id"], "position DESC, id ASC", "both"); // Stop the item status notice if (!isset($item["status"])) { $item["status"] = false; } if ($item["status"] == "p") { $status = "Pending"; $status_class = "pending";
function updateModuleView($id, $title, $description, $table, $type, $options, $fields, $actions, $related_form, $preview_url = "") { $id = sqlescape($id); $title = sqlescape(BigTree::safeEncode($title)); $description = sqlescape(BigTree::safeEncode($description)); $table = sqlescape($table); $type = sqlescape($type); $options = BigTree::json($options, true); $fields = BigTree::json($fields, true); $actions = BigTree::json($actions, true); $related_form = $related_form ? intval($related_form) : "NULL"; $preview_url = sqlescape(BigTree::safeEncode($this->makeIPL($preview_url))); sqlquery("UPDATE bigtree_module_views SET title = '{$title}', description = '{$description}', `table` = '{$table}', type = '{$type}', options = '{$options}', fields = '{$fields}', actions = '{$actions}', preview_url = '{$preview_url}', related_form = {$related_form} WHERE id = '{$id}'"); sqlquery("UPDATE bigtree_module_actions SET name = 'View {$title}' WHERE view = '{$id}'"); static::updateModuleViewColumnNumericStatus(BigTreeAutoModule::getView($id)); $this->track("bigtree_module_views", $id, "updated"); }
$used_views = array(); $used_reports = array(); foreach ((array) $module_groups as $group) { $package["components"]["module_groups"][] = $admin->getModuleGroup($group); } foreach ((array) $modules as $module) { $module = $admin->getModule($module); if ($module) { $module["actions"] = $admin->getModuleActions($module["id"]); foreach ($module["actions"] as $a) { // If there's an auto module, include it as well. if ($a["form"] && !in_array($a["form"], $used_forms)) { $module["forms"][] = BigTreeAutoModule::getForm($a["form"], false); $used_forms[] = $a["form"]; } elseif ($a["view"] && !in_array($a["view"], $used_views)) { $module["views"][] = BigTreeAutoModule::getView($a["view"], false); $used_views[] = $a["view"]; } elseif ($a["report"] && !in_array($a["report"], $used_reports)) { $module["reports"][] = BigTreeAutoModule::getReport($a["report"]); $used_reports[] = $a["report"]; } } $module["embed_forms"] = $admin->getModuleEmbedForms("title", $module["id"]); $package["components"]["modules"][] = $module; } } foreach ((array) $templates as $template) { $package["components"]["templates"][] = $cms->getTemplate($template); } foreach ((array) $callouts as $callout) { $package["components"]["callouts"][] = $admin->getCallout($callout);
$redirect_append = array(); unset($return_view_data["view"]); // We don't need the view passed back. foreach ($return_view_data as $key => $val) { $redirect_append[] = "{$key}=" . urlencode($val); } $redirect_append = "?" . implode("&", $redirect_append); } } else { $redirect_append = ""; } // Get the redirect location. $view = BigTreeAutoModule::getRelatedViewForForm($bigtree["form"]); // If we specify a specific return view, get that information if ($bigtree["form"]["return_view"]) { $view = BigTreeAutoModule::getView($bigtree["form"]["return_view"]); $action = $admin->getModuleActionForView($bigtree["form"]["return_view"]); if ($action["route"]) { $redirect_url = ADMIN_ROOT . $bigtree["module"]["route"] . "/" . $action["route"] . "/" . $redirect_append; } else { $redirect_url = ADMIN_ROOT . $bigtree["module"]["route"] . "/" . $redirect_append; } // If we specify a specific return URL... } elseif ($bigtree["form"]["return_url"]) { $redirect_url = $bigtree["form"]["return_url"] . $redirect_append; // Otherwise just go back to the main module landing. } else { $redirect_url = ADMIN_ROOT . $bigtree["module"]["route"] . "/" . $redirect_append; } // If we've specified a preview URL in our module and the user clicked Save & Preview, return to preview page. if ($_POST["_bigtree_preview"]) {
<?php $view = BigTreeAutoModule::getView(end($bigtree["path"])); $fields = $view["fields"]; $x = 0; foreach ($fields as $key => $field) { $fields[$key]["width"] = $_POST[$key]; } // Update the view $admin->updateModuleViewFields(end($bigtree["path"]), $fields); $action = $admin->getModuleActionForView(end($bigtree["path"])); $admin->growl("Developer", "Updated View Styles"); BigTree::redirect(DEVELOPER_ROOT . "modules/edit/" . $action["module"] . "/");
<?php header("Content-type: text/javascript"); $id = sqlescape($_GET["id"]); // Grab View Data $view = BigTreeAutoModule::getView(sqlescape($_GET["view"])); $table = $view["table"]; // Get module $module = $admin->getModule(BigTreeAutoModule::getModuleForView($view["id"])); // Get the item $current_item = BigTreeAutoModule::getPendingItem($table, $id); $item = $current_item["item"]; // Check permission $access_level = $admin->getAccessLevel($module, $item, $table); if ($access_level != "n") { $original_item = BigTreeAutoModule::getItem($table, $id); $original_access_level = $admin->getAccessLevel($module, $original_item["item"], $table); if ($original_access_level != "p") { $access_level = $original_access_level; } }
$used_views = array(); $used_reports = array(); foreach ((array) $module_groups as $group) { $package["components"]["module_groups"][] = $admin->getModuleGroup($group); } foreach ((array) $modules as $module) { $module = $admin->getModule($module); if ($module) { $module["actions"] = $admin->getModuleActions($module["id"]); foreach ($module["actions"] as $a) { // If there's an auto module, include it as well. if ($a["form"] && !in_array($a["form"], $used_forms)) { $module["forms"][] = BigTreeAutoModule::getForm($a["form"], false); $used_forms[] = $a["form"]; } elseif ($a["view"] && !in_array($a["view"], $used_views)) { $view = BigTreeAutoModule::getView($a["view"], false); // Unset edit_url as it exposes origin URL unset($view["edit_url"]); $module["views"][] = $view; $used_views[] = $a["view"]; } elseif ($a["report"] && !in_array($a["report"], $used_reports)) { $module["reports"][] = BigTreeAutoModule::getReport($a["report"]); $used_reports[] = $a["report"]; } } $module["embed_forms"] = $admin->getModuleEmbedForms("title", $module["id"]); $package["components"]["modules"][] = $module; } } foreach ((array) $templates as $template) { $package["components"]["templates"][] = $cms->getTemplate($template);
<?php // Grab View Data $view = BigTreeAutoModule::getView($_POST["view"]); $module = $admin->getModule(BigTreeAutoModule::getModuleForView($view)); $access_level = $admin->getAccessLevel($module); $table = $view["table"]; if ($access_level == "p") { parse_str($_POST["sort"]); foreach ($row as $position => $id) { if (is_numeric($id)) { sqlquery("UPDATE `{$table}` SET position = '" . (count($row) - $position) . "' WHERE id = '" . sqlescape($id) . "'"); BigTreeAutoModule::recacheItem($id, $table); } else { BigTreeAutoModule::updatePendingItemField(substr($id, 1), "position", count($row) - $position); BigTreeAutoModule::recacheItem(substr($id, 1), $table, true); } } } // Find any view that uses this table for grouping and wipe its view cache $dependant = BigTreeAutoModule::getDependantViews($table); foreach ($dependant as $v) { BigTreeAutoModule::clearCache($v["table"]); }
<?php $bigtree["view"] = $view = BigTreeAutoModule::getView($bigtree["module_action"]["view"]); // Setup the preview action if we have a preview URL and field. if ($bigtree["view"]["preview_url"]) { $bigtree["view"]["actions"]["preview"] = "on"; } // Provide developers a nice handy link for edit/return of this view if ($admin->Level > 1) { $bigtree["subnav_extras"][] = array("link" => ADMIN_ROOT . "developer/modules/views/edit/" . $bigtree["view"]["id"] . "/?return=front", "icon" => "setup", "title" => "Edit in Developer"); } // Setup the preview action if we have a preview URL and field. if ($bigtree["view"]["preview_url"]) { $bigtree["view"]["actions"]["preview"] = "on"; } if ($bigtree["view"]["description"] && !$_COOKIE["bigtree_admin"]["ignore_view_description"][$bigtree["view"]["id"]]) { ?> <section class="inset_block"> <span class="hide" data-id="<?php echo $bigtree["view"]["id"]; ?> ">x</span> <p><?php echo $bigtree["view"]["description"]; ?> </p> </section> <?php } include BigTree::path("admin/auto-modules/views/" . $bigtree["view"]["type"] . ".php");