|
@@ -615,6 +615,45 @@ class Route_ViewTableAjax extends RouteBase {
|
|
|
return $response;
|
|
return $response;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function getCsvTheGeomAjaxAction() {
|
|
|
|
|
+ try {
|
|
|
|
|
+ self::getCsvTheGeomAjax();
|
|
|
|
|
+ } catch (Exception $e) {
|
|
|
|
|
+ SE_Layout::gora();
|
|
|
|
|
+ SE_Layout::menu();
|
|
|
|
|
+ SE_Layout::alert('danger', $e->getMessage());
|
|
|
|
|
+?>
|
|
|
|
|
+<div style="text-align: center;">
|
|
|
|
|
+ <a href="<?=$_SERVER['HTTP_REFERER']?>" class="btn btn-primary" style="width: 80px;">Powrót</a>
|
|
|
|
|
+</div>
|
|
|
|
|
+<?php
|
|
|
|
|
+ SE_Layout::dol();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function getCsvTheGeomAjax() {
|
|
|
|
|
+ Lib::loadClass('EpsgConversion');
|
|
|
|
|
+ $namespace = V::get('namespace', '', $_GET, 'word');
|
|
|
|
|
+ $acl = Core_AclHelper::getAclByNamespace($namespace);
|
|
|
|
|
+ $table = $acl->getRootTableName();
|
|
|
|
|
+ $id = V::get('id', 0, $_GET, 'int');
|
|
|
|
|
+
|
|
|
|
|
+ $query = "select st_astext(`the_geom`) as `the_geom` from `{$table}` where `ID` = {$id}";
|
|
|
|
|
+ try {
|
|
|
|
|
+ $result = DB::getPDO()->fetchValue($query);
|
|
|
|
|
+ } catch (Exception $e) {
|
|
|
|
|
+ throw new Exception('Błąd zapytania SQL');
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!preg_match('/^[[:alpha:]]+\((.*)\)$/', $result, $matches)) throw new Exception('Błąd danych georeferencyjnych');
|
|
|
|
|
+ $points = explode(',', $matches[1]);
|
|
|
|
|
+ $csv = implode("\n", array_map(function ($point, $i) {
|
|
|
|
|
+ list($x, $y) = explode(" ", $point, 2);
|
|
|
|
|
+ $wgs84 = EpsgConversion::LonLatToPUWGWGS84($x, $y);
|
|
|
|
|
+ return $i++ . ',' . round($wgs84->y, 3) . ',' . round($wgs84->x, 3) . ',0,Pikieta';
|
|
|
|
|
+ }, $points, range(1, count($points))));
|
|
|
|
|
+ Response::sendCsv($csv, "{$table}.{$id}");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public function moreFunctionsCellAjaxAction() {
|
|
public function moreFunctionsCellAjaxAction() {
|
|
|
Response::sendTryCatchJson(array($this, 'moreFunctionsCell'), $args = $_GET);
|
|
Response::sendTryCatchJson(array($this, 'moreFunctionsCell'), $args = $_GET);
|
|
|
}
|
|
}
|