Browse Source

exported wfs get capabilites to external class

Piotr Labudda 8 năm trước cách đây
mục cha
commit
508dd6f7fb

+ 435 - 0
SE/se-lib/Api/Wfs/GetCapabilities.php

@@ -0,0 +1,435 @@
+<?php
+
+Lib::loadClass('Api_WfsException');
+Lib::loadClass('Api_WfsGeomTypeConverter');
+Lib::loadClass('Api_WfsNs');
+Lib::loadClass('Request');
+Lib::loadClass('Core_AclHelper');
+Lib::loadClass('Core_XmlWriter');
+
+class Api_Wfs_GetCapabilities {
+
+	public function getCapabilitiesXml($wfsServerUrl, $serviceTitle, $serviceDescription, $aclList) {
+		// if (V::get('DBG_ACL', '', $_GET)) {
+		// 	{
+		// 		echo "Core_AclHelper::getCustomAclList = [" . "\n";
+		// 		foreach (Core_AclHelper::getCustomAclList() as $typeName) {
+		// 			echo "|\t{$typeName}" . "\n";
+		// 		}
+		// 		echo "]// .EOF Core_AclHelper::getCustomAclList" . "\n";
+		// 	}
+		//
+		// 	$fullTblAclList = $this->_usrAcl->getTablesAcl();
+		// 	print_r($fullTblAclList);
+		// 	die("\n" . '.EOF - DBG_ACL');
+		// }
+		header('Content-type: application/xml; charset=utf-8');
+		$xmlWriter = new Core_XmlWriter();
+		if (!$xmlWriter) throw new HttpException("Error no XMLWriter", 404);
+		$xmlWriter->openUri('php://output');
+		$xmlWriter->setIndent(true);
+		$xmlWriter->startDocument('1.0','UTF-8');
+		$xmlWriter->startElement('WFS_Capabilities');
+		$xmlWriter->writeAttribute('xmlns', 'http://www.opengis.net/wfs');
+		$xmlWriter->writeAttribute('xmlns:ogc', 'http://www.opengis.net/ogc');
+		$xmlWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
+		foreach (Api_WfsNs::getNsList() as $uri => $prefix) {
+			$xmlWriter->writeAttribute("xmlns:{$prefix}", $uri);
+		}
+		$schemaLocations = [];
+		//$schemaLocations[] = 'http://www.opengis.net/wfs http://webgis.regione.sardegna.it:80/geoserver/schemas/wfs/1.0.0/WFS-capabilities.xsd';// @from http://webgis.regione.sardegna.it/geoserver/ows?service=WFS&request=GetCapabilities
+		if (!empty($schemaLocations)) $xmlWriter->writeAttribute('xsi:schemaLocation', implode(' ', $schemaLocations));
+		$xmlWriter->writeAttribute('version', "1.0.0");
+		$xmlWriter->h('Service', [
+			['Name', "WFS"],
+			['Title', $serviceTitle],
+			['Abstract', $serviceDescription],
+			['Keywords', "WFS, WMS"],
+			['OnlineResource', $wfsServerUrl],
+			['Fees', "NONE"],
+			['AccessConstraints', "NONE"],
+		]);
+		$xmlWriter->h('Capability', [
+			[ 'Request', [
+				[ 'GetCapabilities', [
+					[ 'DCPType', [
+						[ 'HTTP', [
+							[ 'Get', [ 'onlineResource' => "{$wfsServerUrl}?REQUEST=GetCapabilities" ], null ]
+						] ]
+					] ],
+					[ 'DCPType', [
+						[ 'HTTP', [
+							[ 'Post', [ 'onlineResource' => "{$wfsServerUrl}" ], null ]
+						] ]
+					] ],
+				] ]
+			] ]
+		]);
+		$xmlWriter->h('DescribeFeatureType', [
+			[ 'SchemaDescriptionLanguage', [
+				[ 'XMLSCHEMA', null ]
+			] ],
+			[ 'DCPType', [
+				[ 'HTTP', [
+					[ 'Get', ['onlineResource' => "{$wfsServerUrl}?REQUEST=DescribeFeatureType"], null ]
+				] ]
+			] ],
+			[ 'DCPType', [
+				[ 'HTTP', [
+					[ 'Post', ['onlineResource' => "{$wfsServerUrl}"], null ]
+				] ]
+			] ],
+		]);
+		$xmlWriter->h('GetFeature', [
+			[ 'ResultFormat', [
+				'WFSKMLOutputFormat',
+				'GML2',
+				'GML3',
+				'SHAPE-ZIP',
+				'CSV',
+				'JSON',
+			] ],
+			[ 'DCPType', [
+				[ 'HTTP', [
+					[ 'Get', ['onlineResource' => "{$wfsServerUrl}?REQUEST=GetFeature"], null ]
+				] ]
+			] ],
+			[ 'DCPType', [
+				[ 'HTTP', [
+					[ 'Post', ['onlineResource' => "{$wfsServerUrl}"], null ]
+				] ]
+			] ],
+		]);
+		$xmlWriter->h('Transaction', [
+			[ 'DCPType', [
+				[ 'HTTP', [
+					[ 'Get', ['onlineResource' => "{$wfsServerUrl}?REQUEST=Transaction"], null ]
+				] ]
+			] ],
+			[ 'DCPType', [
+				[ 'HTTP', [
+					[ 'Post', ['onlineResource' => "{$wfsServerUrl}"], null ]
+				] ]
+			] ],
+		]);
+		$xmlWriter->h('LockFeature', [
+			[ 'DCPType', [
+				[ 'HTTP', [
+					[ 'Get', ['onlineResource' => "{$wfsServerUrl}?REQUEST=LockFeature"], null ]
+				] ]
+			] ],
+			[ 'DCPType', [
+				[ 'HTTP', [
+					[ 'Post', ['onlineResource' => "{$wfsServerUrl}"], null ]
+				] ]
+			] ],
+		]);
+		$xmlWriter->h('GetFeatureWithLock', [
+			[ 'ResultFormat', [
+				'GML2'
+			] ],
+			[ 'DCPType', [
+				[ 'HTTP', [
+					[ 'Get', ['onlineResource' => "{$wfsServerUrl}?REQUEST=GetFeatureWithLock"], null ]
+				] ]
+			] ],
+			[ 'DCPType', [
+				[ 'HTTP', [
+					[ 'Post', ['onlineResource' => "{$wfsServerUrl}"], null ]
+				] ]
+			] ],
+		]);
+
+		$featureTypeNodes = [];
+		foreach ($aclList as $tblAcl) {
+			$ns = Core_AclHelper::parseNamespaceUrl($tblAcl->getNamespace());
+			DBG::log(['ns'=>$ns, 'acl_ns'=>$tblAcl->getNamespace(), 'cls'=>get_class($tblAcl)], 'array', "tblAcl [".$tblAcl->getID()."]");
+			$dataSourceName = 'default_db';// TODO: $tblAcl->getSourceName()
+			$prefix = "p5_{$dataSourceName}";
+			$featureTypeNodes[] = [ 'FeatureType', [ "xmlns:{$prefix}" => Api_WfsNs::getNsUri($prefix) ], [
+				[ 'Name', "p5_" . "{$ns['prefix']}:{$ns['name']}" ], // TODO: remove 'p5_' prefix
+				[ 'Title', $tblAcl->getRawLabel() ],
+				[ 'Abstract', $tblAcl->getRawOpis() ],
+				[ 'Keywords', implode(', ', [ $tblAcl->getID(), $tblAcl->getName(), $tblAcl->getRawLabel() ]) ],
+				[ 'SRS', 'EPSG:4326' ],
+				[ 'LatLongBoundingBox', [
+					'minx' => "8.12328509871721",
+					'miny' => "38.8575126897477",
+					'maxx' => "9.838674658246807",
+					'maxy' => "41.31378404137082"], null ]
+			] ];
+		}
+		foreach (Core_AclHelper::getCustomAclList() as $typeName) {
+			list($prefix, $name) = explode(':', $typeName);
+			$featureTypeNodes[] = [ 'FeatureType', [ "xmlns:{$prefix}" => Api_WfsNs::getNsUri($prefix) ], [
+				[ 'Name', "{$prefix}:{$name}" ],
+				[ 'Title', $name ],
+				[ 'Abstract', $name ],
+				[ 'Keywords', $name ],
+				[ 'SRS', 'EPSG:4326' ],
+			] ];
+		}
+		$xmlWriter->startElement('FeatureTypeList');
+		$xmlWriter->h('Operations', ['Query', 'Insert', 'Update', 'Delete', 'Lock']);
+		if (DBG::isActive()) {
+			DBG::log(array_map(function ($feature) {
+				return "{$feature[2][0][1]}, ".array_values($feature[1])[0];
+			}, $featureTypeNodes), 'array', "\$featureTypeNodes");
+		}
+		foreach ($featureTypeNodes as $node) {
+			$xmlWriter->h($node);
+		}
+		$xmlWriter->endElement();// FeatureTypeList
+
+		$xmlWriter->h('ogc:Filter_Capabilities', [
+			[ 'ogc:Spatial_Capabilities', [
+				[ 'ogc:Spatial_Operators', [
+					'ogc:Disjoint',
+					'ogc:Equals',
+					'ogc:DWithin',
+					'ogc:Beyond',
+					'ogc:Intersect',
+					'ogc:Touches',
+					'ogc:Crosses',
+					'ogc:Within',
+					'ogc:Contains',
+					'ogc:Overlaps',
+					'ogc:BBOX',
+				] ]
+			] ],
+			[ 'ogc:Scalar_Capabilities', [
+				'ogc:Logical_Operators',
+				[ 'ogc:Comparison_Operators', [
+					'ogc:Simple_Comparisons',
+					'ogc:Between',
+					'ogc:Like',
+					'ogc:NullCheck',
+				] ],
+				[ 'ogc:Arithmetic_Operators', [
+					'ogc:Simple_Arithmetic',
+					[ 'ogc:Functions', [
+						[ 'ogc:Function_Names', [
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "abs" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "abs_2" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "abs_3" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "abs_4" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "acos" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "AddCoverages" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"4"], "Aggregate" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Area" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "area2" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"3"], "AreaGrid" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "asin" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "atan" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "atan2" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"14"], "BarnesSurface" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"3"], "between" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "boundary" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "boundaryDimension" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Bounds" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "buffer" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"3"], "BufferFeatureCollection" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"3"], "bufferWithSegments" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"7"], "Categorize" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "ceil" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Centroid" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "classify" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "Clip" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "CollectGeometries" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Collection_Average" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Collection_Bounds" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"0"], "Collection_Count" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Collection_Max" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Collection_Median" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Collection_Min" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Collection_Sum" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Collection_Unique" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Concatenate" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "contains" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"7"], "Contour" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "convert" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "convexHull" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "cos" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Count" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "CropCoverage" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "crosses" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "dateFormat" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "dateParse" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "difference" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "dimension" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "disjoint" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "disjoint3D" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "distance" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "distance3D" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "double2bool" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "endAngle" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "endPoint" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "env" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "envelope" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "EqualInterval" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "equalsExact" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"3"], "equalsExactTolerance" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "equalTo" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "exp" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "exteriorRing" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"3"], "Feature" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "floor" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "geometryType" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "geomFromWKT" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "geomLength" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "getGeometryN" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "getX" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "getY" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "getz" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "greaterEqualThan" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "greaterThan" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"5"], "Grid" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"7"], "Heatmap" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"0"], "id" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "IEEEremainder" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"3"], "if_then_else" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"11"], "in10" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"3"], "in2" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"4"], "in3" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"5"], "in4" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"6"], "in5" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"7"], "in6" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"8"], "in7" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"9"], "in8" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"10"], "in9" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "InclusionFeatureCollection" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "int2bbool" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "int2ddouble" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "interiorPoint" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "interiorRingN" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"3"], "Interpolate" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "intersection" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"7"], "IntersectionFeatureCollection" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "intersects" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "intersects3D" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "isClosed" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"0"], "isCoverage" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "isEmpty" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "isLike" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "isNull" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "isometric" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "isRing" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "isSimple" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "isValid" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"3"], "isWithinDistance" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"3"], "isWithinDistance3D" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "Jenks" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "length" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "lessEqualThan" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "lessThan" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "list" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "log" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"4"], "LRSGeocode" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"5"], "LRSMeasure" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"5"], "LRSSegment" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "max" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "max_2" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "max_3" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "max_4" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "min" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "min_2" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "min_3" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "min_4" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "mincircle" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "minimumdiameter" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "minrectangle" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "modulo" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "MultiplyCoverages" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"3"], "Nearest" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "not" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "notEqualTo" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "numberFormat" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"5"], "numberFormat2" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "numGeometries" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "numInteriorRing" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "numPoints" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "octagonalenvelope" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"3"], "offset" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "overlaps" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "parameter" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "parseBoolean" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "parseDouble" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "parseInt" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "parseLong" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"0"], "pi" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"4"], "PointBuffers" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "pointN" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"7"], "PointStacker" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"6"], "PolygonExtraction" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "pow" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "property" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "PropertyExists" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "Quantile" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"3"], "Query" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"0"], "random" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"5"], "RangeLookup" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "RasterAsPointCollection" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"4"], "RasterZonalStatistics" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"5"], "Recode" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "RectangularClip" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "relate" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"3"], "relatePattern" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"3"], "Reproject" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "rint" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "round" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "round_2" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "roundDouble" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"6"], "ScaleCoverage" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"4"], "sdo_nn" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "setCRS" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"3"], "Simplify" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "sin" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"3"], "Snap" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "sqrt" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "StandardDeviation" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "startAngle" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "startPoint" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "strCapitalize" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "strConcat" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "strEndsWith" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "strEqualsIgnoreCase" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "strIndexOf" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "strLastIndexOf" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "strLength" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "strMatches" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"3"], "strPosition" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"4"], "strReplace" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "strStartsWith" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"3"], "strSubstring" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "strSubstringStart" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "strToLowerCase" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "strToUpperCase" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "strTrim" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"3"], "strTrim2" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "StyleCoverage" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "symDifference" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "tan" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "toDegrees" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "toRadians" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "touches" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "toWKT" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "Transform" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "union" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "UnionFeatureCollection" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "Unique" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "UniqueInterval" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"6"], "VectorToRaster" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"3"], "VectorZonalStatistics" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"1"], "vertices" ],
+							[ 'ogc:Function_Name', ['nArgs'=>"2"], "within" ],
+						] ],
+					] ],
+				] ],
+			] ],
+		]);
+		$xmlWriter->endElement();// WFS_Capabilities
+		$xmlWriter->endDocument();
+		exit;
+	}
+
+}

+ 18 - 1
SE/se-lib/Api/WfsDataServer.php

@@ -6,6 +6,7 @@ Lib::loadClass('Api_WfsGeomTypeConverter');
 Lib::loadClass('Api_WfsNs');
 Lib::loadClass('Api_WfsNs');
 Lib::loadClass('Core_XmlWriter');
 Lib::loadClass('Core_XmlWriter');
 Lib::loadClass('DBG');
 Lib::loadClass('DBG');
+Lib::loadClass('Api_Wfs_GetCapabilities');
 
 
 class Api_WfsDataServer extends Api_WfsServerBase {
 class Api_WfsDataServer extends Api_WfsServerBase {
 
 
@@ -440,9 +441,25 @@ class Api_WfsDataServer extends Api_WfsServerBase {
 		$serviceTitle = "Web Feature Service";
 		$serviceTitle = "Web Feature Service";
 		$serviceDescription = "This is the reference implementation of WFS 1.0.0 and WFS 1.1.0, supports all WFS operations including Transaction.";
 		$serviceDescription = "This is the reference implementation of WFS 1.0.0 and WFS 1.1.0, supports all WFS operations including Transaction.";
 
 
+		$idDefaultDB = DB::getPDO()->getZasobId();
+		$aclList = array_filter($this->_usrAcl->getTablesAcl(), function ($acl) use ($idDefaultDB) {
+			// 		// $dataSourceName = 'default_db';// TODO: getSourceName
+			// 		// $tblName = $tblAcl->getName();
+			// 		// try {
+			// 		// 	$acl = $this->getAclFromTypeName($typeName = "p5_{$dataSourceName}:{$tblName}");
+			// 		// } catch (Exception $e) {
+			// 		// 	// echo "Error for table({$tblName}): " . $e->getMessage() . "\n";
+			// 		// }
+			// 		// if (!$acl) {
+			// 		// 	// TODO: error log msg
+			// 		// 	return false;
+			// 		// }
+			return ($idDefaultDB == $acl->getDB()); // hide non default_db tables
+		});
+
 		//header('Content-type: application/xml; charset="utf-8"');
 		//header('Content-type: application/xml; charset="utf-8"');
 		header('Content-type: application/xml');
 		header('Content-type: application/xml');
-		$this->_getCapabilities($wfsServerUrl, $serviceTitle, $serviceDescription);
+		(new Api_Wfs_GetCapabilities)->getCapabilitiesXml($wfsServerUrl, $serviceTitle, $serviceDescription, $aclList);
 	}
 	}
 
 
 }
 }

+ 26 - 4
SE/se-lib/Api/WfsQgisServer.php

@@ -4,6 +4,7 @@ Lib::loadClass('Api_WfsServerBase');
 Lib::loadClass('Api_WfsException');
 Lib::loadClass('Api_WfsException');
 Lib::loadClass('Api_WfsGeomTypeConverter');
 Lib::loadClass('Api_WfsGeomTypeConverter');
 Lib::loadClass('DBG');
 Lib::loadClass('DBG');
+Lib::loadClass('Api_Wfs_GetCapabilities');
 
 
 class Api_WfsQgisServer extends Api_WfsServerBase {
 class Api_WfsQgisServer extends Api_WfsServerBase {
 
 
@@ -199,16 +200,37 @@ if($DBG){echo '(geomFld: '.$geomFld.'):';print_r($acl->getFieldType($geomFld));e
 		$serviceTitle = "Web Feature Service for QGIS";
 		$serviceTitle = "Web Feature Service for QGIS";
 		$serviceDescription = "This is the reference implementation of WFS 1.0.0 and WFS 1.1.0, supports all WFS operations including Transaction.";
 		$serviceDescription = "This is the reference implementation of WFS 1.0.0 and WFS 1.1.0, supports all WFS operations including Transaction.";
 
 
-		//header('Content-type: application/xml; charset="utf-8"');
+		$idDefaultDB = DB::getPDO()->getZasobId();
+		$aclList = array_filter($this->_usrAcl->getTablesAcl(), function ($acl) use ($idDefaultDB) {
+			// if ($idDefaultDB != $tblAcl->getDB()) {// hide non default_db tables
+			// 	return false;
+			// }
+			// $dataSourceName = 'default_db';// TODO: getSourceName
+			// $tblName = $tblAcl->getName();
+			// try {
+			// 	$acl = $this->getAclFromTypeName($typeName = "p5_" . $tblAcl->getSourceName() . ":" . $tblAcl->getName());
+			// } catch (Exception $e) {
+			// 	// TODO: error log $e->getMessage();
+			// }
+			// if (!$acl) {
+			// 	// TODO: error log msg
+			// 	continue;
+			// }
+			// $fldList = $acl->getRealFieldList();
+			// if (!in_array('the_geom', $fldList)) {
+			// 	continue;
+			// }
+			return ($idDefaultDB == $acl->getDB()); // hide non default_db tables
+		});
+
 		header('Content-type: application/xml');
 		header('Content-type: application/xml');
-		$this->_getCapabilities($wfsServerUrl, $serviceTitle, $serviceDescription);
+		(new Api_Wfs_GetCapabilities)->getCapabilitiesXml($wfsServerUrl, $serviceTitle, $serviceDescription, $aclList);
 		exit;
 		exit;
 	}
 	}
 
 
 	public function _getTableAclList() {// Use only Tables from default_db with the_geom field
 	public function _getTableAclList() {// Use only Tables from default_db with the_geom field
 		$tblAclList = array();
 		$tblAclList = array();
-		$db = DB::getDB();
-		$idDefaultDB = $db->_zasob_id;
+		$idDefaultDB = DB::getPDO()->getZasobId();
 		$fullTblAclList = $this->_usrAcl->getTablesAcl();
 		$fullTblAclList = $this->_usrAcl->getTablesAcl();
 		foreach ($fullTblAclList as $tblAcl) {
 		foreach ($fullTblAclList as $tblAcl) {
 			if ($idDefaultDB != $tblAcl->getDB()) {// hide non default_db tables
 			if ($idDefaultDB != $tblAcl->getDB()) {// hide non default_db tables

+ 3 - 426
SE/se-lib/Api/WfsServerBase.php

@@ -194,428 +194,6 @@ class Api_WfsServerBase {
 		return $args;
 		return $args;
 	}
 	}
 
 
-	public function _getCapabilities($wfsServerUrl, $serviceTitle, $serviceDescription) {
-		if (V::get('DBG_ACL', '', $_GET)) {
-			{
-				echo "Core_AclHelper::getCustomAclList = [" . "\n";
-				foreach (Core_AclHelper::getCustomAclList() as $typeName) {
-					echo "|\t{$typeName}" . "\n";
-				}
-				echo "]// .EOF Core_AclHelper::getCustomAclList" . "\n";
-			}
-
-			$fullTblAclList = $this->_usrAcl->getTablesAcl();
-			print_r($fullTblAclList);
-			die("\n" . '.EOF - DBG_ACL');
-		}
-		header('Content-type: application/xml; charset=utf-8');
-		$xmlWriter = new Core_XmlWriter();
-		if (!$xmlWriter) throw new HttpException("Error no XMLWriter", 404);
-		$xmlWriter->openUri('php://output');
-		$xmlWriter->setIndent(true);
-		$xmlWriter->startDocument('1.0','UTF-8');
-		$xmlWriter->startElement('WFS_Capabilities');
-		$xmlWriter->writeAttribute('xmlns', 'http://www.opengis.net/wfs');
-		$xmlWriter->writeAttribute('xmlns:ogc', 'http://www.opengis.net/ogc');
-		$xmlWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
-		foreach (Api_WfsNs::getNsList() as $uri => $prefix) {
-			$xmlWriter->writeAttribute("xmlns:{$prefix}", $uri);
-		}
-		$schemaLocations = [];
-		//$schemaLocations[] = 'http://www.opengis.net/wfs http://webgis.regione.sardegna.it:80/geoserver/schemas/wfs/1.0.0/WFS-capabilities.xsd';// @from http://webgis.regione.sardegna.it/geoserver/ows?service=WFS&request=GetCapabilities
-		if (!empty($schemaLocations)) $xmlWriter->writeAttribute('xsi:schemaLocation', implode(' ', $schemaLocations));
-		$xmlWriter->writeAttribute('version', "1.0.0");
-		$xmlWriter->h('Service', [
-			['Name', "WFS"],
-			['Title', $serviceTitle],
-			['Abstract', $serviceDescription],
-			['Keywords', "WFS, WMS"],
-			['OnlineResource', $wfsServerUrl],
-			['Fees', "NONE"],
-			['AccessConstraints', "NONE"],
-		]);
-		$xmlWriter->h('Capability', [
-			[ 'Request', [
-				[ 'GetCapabilities', [
-					[ 'DCPType', [
-						[ 'HTTP', [
-							[ 'Get', [ 'onlineResource' => "{$wfsServerUrl}?REQUEST=GetCapabilities" ], null ]
-						] ]
-					] ],
-					[ 'DCPType', [
-						[ 'HTTP', [
-							[ 'Post', [ 'onlineResource' => "{$wfsServerUrl}" ], null ]
-						] ]
-					] ],
-				] ]
-			] ]
-		]);
-		$xmlWriter->h('DescribeFeatureType', [
-			[ 'SchemaDescriptionLanguage', [
-				[ 'XMLSCHEMA', null ]
-			] ],
-			[ 'DCPType', [
-				[ 'HTTP', [
-					[ 'Get', ['onlineResource' => "{$wfsServerUrl}?REQUEST=DescribeFeatureType"], null ]
-				] ]
-			] ],
-			[ 'DCPType', [
-				[ 'HTTP', [
-					[ 'Post', ['onlineResource' => "{$wfsServerUrl}"], null ]
-				] ]
-			] ],
-		]);
-		$xmlWriter->h('GetFeature', [// $this->_printGetFeatureXml($wfsServerUrl);
-			[ 'ResultFormat', [
-				'WFSKMLOutputFormat',
-				'GML2',
-				'GML3',
-				'SHAPE-ZIP',
-				'CSV',
-				'JSON',
-			] ],
-			[ 'DCPType', [
-				[ 'HTTP', [
-					[ 'Get', ['onlineResource' => "{$wfsServerUrl}?REQUEST=GetFeature"], null ]
-				] ]
-			] ],
-			[ 'DCPType', [
-				[ 'HTTP', [
-					[ 'Post', ['onlineResource' => "{$wfsServerUrl}"], null ]
-				] ]
-			] ],
-		]);
-		$xmlWriter->h('Transaction', [
-			[ 'DCPType', [
-				[ 'HTTP', [
-					[ 'Get', ['onlineResource' => "{$wfsServerUrl}?REQUEST=Transaction"], null ]
-				] ]
-			] ],
-			[ 'DCPType', [
-				[ 'HTTP', [
-					[ 'Post', ['onlineResource' => "{$wfsServerUrl}"], null ]
-				] ]
-			] ],
-		]);
-		$xmlWriter->h('LockFeature', [
-			[ 'DCPType', [
-				[ 'HTTP', [
-					[ 'Get', ['onlineResource' => "{$wfsServerUrl}?REQUEST=LockFeature"], null ]
-				] ]
-			] ],
-			[ 'DCPType', [
-				[ 'HTTP', [
-					[ 'Post', ['onlineResource' => "{$wfsServerUrl}"], null ]
-				] ]
-			] ],
-		]);
-		$xmlWriter->h('GetFeatureWithLock', [
-			[ 'ResultFormat', [
-				'GML2'
-			] ],
-			[ 'DCPType', [
-				[ 'HTTP', [
-					[ 'Get', ['onlineResource' => "{$wfsServerUrl}?REQUEST=GetFeatureWithLock"], null ]
-				] ]
-			] ],
-			[ 'DCPType', [
-				[ 'HTTP', [
-					[ 'Post', ['onlineResource' => "{$wfsServerUrl}"], null ]
-				] ]
-			] ],
-		]);
-
-		$featureTypeNodes = [];
-		foreach ($this->_getTableAclList() as $tblAcl) {
-			$ns = Core_AclHelper::parseNamespaceUrl($tblAcl->getNamespace());
-			DBG::log(['ns'=>$ns, 'acl_ns'=>$tblAcl->getNamespace(), 'cls'=>get_class($tblAcl)], 'array', "tblAcl [".$tblAcl->getID()."]");
-			$dataSourceName = 'default_db';// TODO: $tblAcl->getSourceName()
-			$prefix = "p5_{$dataSourceName}";
-			$featureTypeNodes[] = [ 'FeatureType', [ "xmlns:{$prefix}" => Api_WfsNs::getNsUri($prefix) ], [
-				[ 'Name', "p5_" . "{$ns['prefix']}:{$ns['name']}" ], // TODO: remove 'p5_' prefix
-				[ 'Title', $tblAcl->getRawLabel() ],
-				[ 'Abstract', $tblAcl->getRawOpis() ],
-				[ 'Keywords', implode(', ', [ $tblAcl->getID(), $tblAcl->getName(), $tblAcl->getRawLabel() ]) ],
-				[ 'SRS', 'EPSG:4326' ],
-				[ 'LatLongBoundingBox', [
-					'minx' => "8.12328509871721",
-					'miny' => "38.8575126897477",
-					'maxx' => "9.838674658246807",
-					'maxy' => "41.31378404137082"], null ]
-			] ];
-		}
-		foreach (Core_AclHelper::getCustomAclList() as $typeName) {
-			list($prefix, $name) = explode(':', $typeName);
-			$featureTypeNodes[] = [ 'FeatureType', [ "xmlns:{$prefix}" => Api_WfsNs::getNsUri($prefix) ], [
-				[ 'Name', "{$prefix}:{$name}" ],
-				[ 'Title', $name ],
-				[ 'Abstract', $name ],
-				[ 'Keywords', $name ],
-				[ 'SRS', 'EPSG:4326' ],
-			] ];
-		}
-		$xmlWriter->startElement('FeatureTypeList');
-		$xmlWriter->h('Operations', ['Query', 'Insert', 'Update', 'Delete', 'Lock']);
-		if (DBG::isActive()) {
-			DBG::log(array_map(function ($feature) {
-				return "{$feature[2][0][1]}, ".array_values($feature[1])[0];
-			}, $featureTypeNodes), 'array', "\$featureTypeNodes");
-		}
-		foreach ($featureTypeNodes as $node) {
-			$xmlWriter->h($node);
-		}
-		$xmlWriter->endElement();// FeatureTypeList
-
-		$xmlWriter->h('ogc:Filter_Capabilities', [
-			[ 'ogc:Spatial_Capabilities', [
-				[ 'ogc:Spatial_Operators', [
-					'ogc:Disjoint',
-					'ogc:Equals',
-					'ogc:DWithin',
-					'ogc:Beyond',
-					'ogc:Intersect',
-					'ogc:Touches',
-					'ogc:Crosses',
-					'ogc:Within',
-					'ogc:Contains',
-					'ogc:Overlaps',
-					'ogc:BBOX',
-				] ]
-			] ],
-			[ 'ogc:Scalar_Capabilities', [
-				'ogc:Logical_Operators',
-				[ 'ogc:Comparison_Operators', [
-					'ogc:Simple_Comparisons',
-					'ogc:Between',
-					'ogc:Like',
-					'ogc:NullCheck',
-				] ],
-				[ 'ogc:Arithmetic_Operators', [
-					'ogc:Simple_Arithmetic',
-					[ 'ogc:Functions', [
-						[ 'ogc:Function_Names', [
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "abs" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "abs_2" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "abs_3" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "abs_4" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "acos" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "AddCoverages" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"4"], "Aggregate" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Area" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "area2" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"3"], "AreaGrid" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "asin" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "atan" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "atan2" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"14"], "BarnesSurface" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"3"], "between" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "boundary" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "boundaryDimension" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Bounds" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "buffer" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"3"], "BufferFeatureCollection" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"3"], "bufferWithSegments" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"7"], "Categorize" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "ceil" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Centroid" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "classify" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "Clip" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "CollectGeometries" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Collection_Average" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Collection_Bounds" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"0"], "Collection_Count" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Collection_Max" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Collection_Median" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Collection_Min" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Collection_Sum" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Collection_Unique" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Concatenate" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "contains" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"7"], "Contour" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "convert" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "convexHull" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "cos" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "Count" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "CropCoverage" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "crosses" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "dateFormat" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "dateParse" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "difference" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "dimension" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "disjoint" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "disjoint3D" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "distance" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "distance3D" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "double2bool" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "endAngle" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "endPoint" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "env" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "envelope" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "EqualInterval" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "equalsExact" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"3"], "equalsExactTolerance" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "equalTo" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "exp" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "exteriorRing" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"3"], "Feature" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "floor" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "geometryType" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "geomFromWKT" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "geomLength" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "getGeometryN" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "getX" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "getY" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "getz" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "greaterEqualThan" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "greaterThan" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"5"], "Grid" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"7"], "Heatmap" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"0"], "id" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "IEEEremainder" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"3"], "if_then_else" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"11"], "in10" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"3"], "in2" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"4"], "in3" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"5"], "in4" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"6"], "in5" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"7"], "in6" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"8"], "in7" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"9"], "in8" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"10"], "in9" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "InclusionFeatureCollection" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "int2bbool" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "int2ddouble" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "interiorPoint" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "interiorRingN" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"3"], "Interpolate" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "intersection" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"7"], "IntersectionFeatureCollection" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "intersects" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "intersects3D" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "isClosed" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"0"], "isCoverage" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "isEmpty" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "isLike" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "isNull" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "isometric" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "isRing" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "isSimple" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "isValid" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"3"], "isWithinDistance" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"3"], "isWithinDistance3D" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "Jenks" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "length" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "lessEqualThan" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "lessThan" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "list" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "log" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"4"], "LRSGeocode" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"5"], "LRSMeasure" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"5"], "LRSSegment" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "max" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "max_2" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "max_3" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "max_4" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "min" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "min_2" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "min_3" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "min_4" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "mincircle" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "minimumdiameter" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "minrectangle" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "modulo" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "MultiplyCoverages" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"3"], "Nearest" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "not" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "notEqualTo" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "numberFormat" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"5"], "numberFormat2" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "numGeometries" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "numInteriorRing" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "numPoints" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "octagonalenvelope" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"3"], "offset" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "overlaps" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "parameter" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "parseBoolean" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "parseDouble" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "parseInt" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "parseLong" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"0"], "pi" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"4"], "PointBuffers" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "pointN" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"7"], "PointStacker" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"6"], "PolygonExtraction" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "pow" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "property" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "PropertyExists" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "Quantile" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"3"], "Query" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"0"], "random" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"5"], "RangeLookup" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "RasterAsPointCollection" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"4"], "RasterZonalStatistics" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"5"], "Recode" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "RectangularClip" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "relate" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"3"], "relatePattern" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"3"], "Reproject" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "rint" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "round" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "round_2" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "roundDouble" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"6"], "ScaleCoverage" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"4"], "sdo_nn" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "setCRS" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"3"], "Simplify" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "sin" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"3"], "Snap" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "sqrt" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "StandardDeviation" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "startAngle" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "startPoint" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "strCapitalize" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "strConcat" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "strEndsWith" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "strEqualsIgnoreCase" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "strIndexOf" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "strLastIndexOf" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "strLength" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "strMatches" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"3"], "strPosition" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"4"], "strReplace" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "strStartsWith" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"3"], "strSubstring" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "strSubstringStart" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "strToLowerCase" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "strToUpperCase" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "strTrim" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"3"], "strTrim2" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "StyleCoverage" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "symDifference" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "tan" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "toDegrees" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "toRadians" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "touches" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "toWKT" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "Transform" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "union" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "UnionFeatureCollection" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "Unique" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "UniqueInterval" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"6"], "VectorToRaster" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"3"], "VectorZonalStatistics" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"1"], "vertices" ],
-							[ 'ogc:Function_Name', ['nArgs'=>"2"], "within" ],
-						] ],
-					] ],
-				] ],
-			] ],
-		]);
-		$xmlWriter->endElement();// WFS_Capabilities
-		$xmlWriter->endDocument();
-		exit;
-	}
 
 
 	public function _getXmlSchemaLocation() {
 	public function _getXmlSchemaLocation() {
 		$schemaLocations = array();
 		$schemaLocations = array();
@@ -1703,15 +1281,14 @@ if($DBG){echo 'L.' . __LINE__ . ' $validateConvertedTransactionXsdString:';print
 
 
 	public function _getTableAclList() {// Use only Tables from default_db
 	public function _getTableAclList() {// Use only Tables from default_db
 		$tblAclList = array();
 		$tblAclList = array();
-		$db = DB::getDB();
-		$idDefaultDB = $db->_zasob_id;
+		$idDefaultDB = DB::getPDO()->getZasobId();
 		$fullTblAclList = $this->_usrAcl->getTablesAcl();
 		$fullTblAclList = $this->_usrAcl->getTablesAcl();
 		foreach ($fullTblAclList as $tblAcl) {
 		foreach ($fullTblAclList as $tblAcl) {
-			$dataSourceName = 'default_db';// TODO: getSourceName
-			$tblName = $tblAcl->getName();
 			if ($idDefaultDB != $tblAcl->getDB()) {// hide non default_db tables
 			if ($idDefaultDB != $tblAcl->getDB()) {// hide non default_db tables
 				continue;
 				continue;
 			}
 			}
+			// $dataSourceName = 'default_db';// TODO: getSourceName
+			// $tblName = $tblAcl->getName();
 			// try {
 			// try {
 			// 	$acl = $this->getAclFromTypeName($typeName = "p5_{$dataSourceName}:{$tblName}");
 			// 	$acl = $this->getAclFromTypeName($typeName = "p5_{$dataSourceName}:{$tblName}");
 			// } catch (Exception $e) {
 			// } catch (Exception $e) {