| 123456789101112131415161718192021222324252627282930313233 |
- <?php
- Core::addScript("public/js/app-locations.js");
- Core::addBreadcrumb("/account", "Account");
- Core::addBreadcrumb("/account/locations", "Locations");
- $customer = Customer::getForAdmin();
- if(!$customer) throw new Exception("You do not have permission to access this page.");
- $page_title = "$customer->name Locations";
- Core::addBreadcrumb("/account/locations?customer_id=$customer->id", $page_title);
- $nvp = ["customer_id" => $customer->id];
- $id = http::value("id", "int");
- $internal_id = http::value("internal_id", "trim");
- $name = http::value("name", "trim");
- if($id) $nvp["id"] = $id;
- if($internal_id) $nvp["internal_id"] = db::escape($internal_id);
- if($name) $nvp["name"] = (new Constraint("CONTAINS"))->setValues(db::escape($name));
- $locations = Location::query($nvp, ["sort" => "name", "order" => "asc"]);
- $filter_count = count($nvp) - 1;
- View::includeOnce("header", compact("page_title"));
- View::include("locations", compact("customer", "filter_count", "locations"));
- View::includeOnce("footer");
- ?>
|