|
@@ -8,6 +8,8 @@ Core::addBreadcrumb("/account/locations", "Locations");
|
|
|
$customer = Customer::getForAdmin();
|
|
$customer = Customer::getForAdmin();
|
|
|
if(!$customer) throw new Exception("You do not have permission to access this page.");
|
|
if(!$customer) throw new Exception("You do not have permission to access this page.");
|
|
|
|
|
|
|
|
|
|
+$customer_slug = Util::slug($customer->name);
|
|
|
|
|
+
|
|
|
$sorts = [
|
|
$sorts = [
|
|
|
"name" => "Name",
|
|
"name" => "Name",
|
|
|
"last-added" => "Last Added",
|
|
"last-added" => "Last Added",
|
|
@@ -56,7 +58,7 @@ if(!empty($action)) {
|
|
|
if(!Core::$user->canAdmin()) throw new Exception("You do not have permission to access this resource.");
|
|
if(!Core::$user->canAdmin()) throw new Exception("You do not have permission to access this resource.");
|
|
|
|
|
|
|
|
header("Content-Type: text/csv; charset=utf-8");
|
|
header("Content-Type: text/csv; charset=utf-8");
|
|
|
- header("Content-Disposition: attachment; filename=export.csv");
|
|
|
|
|
|
|
+ header("Content-Disposition: attachment; filename=$customer_slug-export.csv");
|
|
|
|
|
|
|
|
$handle = fopen("php://output", "w");
|
|
$handle = fopen("php://output", "w");
|
|
|
|
|
|
|
@@ -84,6 +86,33 @@ if(!empty($action)) {
|
|
|
|
|
|
|
|
fclose($handle);
|
|
fclose($handle);
|
|
|
|
|
|
|
|
|
|
+ exit;
|
|
|
|
|
+
|
|
|
|
|
+ case "export-kml":
|
|
|
|
|
+
|
|
|
|
|
+ header("Content-Type: text/xml; charset=utf-8");
|
|
|
|
|
+ header("Content-Disposition: attachment; filename=$customer_slug-export.kml");
|
|
|
|
|
+
|
|
|
|
|
+ $xml = simplexml_load_file("files/empty.kml");
|
|
|
|
|
+
|
|
|
|
|
+ $folder_node = $xml->addChild("Folder");
|
|
|
|
|
+ $folder_node->addChild("name", $customer->name);
|
|
|
|
|
+ $folder_node->addChild("open", 1);
|
|
|
|
|
+ $folder_node->addChild("description", $customer->name . " Locations");
|
|
|
|
|
+
|
|
|
|
|
+ foreach($locations as $location) {
|
|
|
|
|
+ $placemark_node = $folder_node->addChild("Placemark");
|
|
|
|
|
+
|
|
|
|
|
+ $placemark_node->addChild("name", htmlspecialchars($location->name));
|
|
|
|
|
+ $placemark_node->addChild("description", htmlspecialchars($location->getDisplayAddress()));
|
|
|
|
|
+
|
|
|
|
|
+ $point_node = $placemark_node->addChild("Point");
|
|
|
|
|
+ $point_node->addChild("coordinates", $location->longitude . "," . $location->latitude);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ echo $xml->asXML();
|
|
|
|
|
+
|
|
|
exit;
|
|
exit;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|