|
@@ -1192,11 +1192,11 @@ if($DBG){echo '$validateConvertedTransactionXsdString:';print_r($validateConvert
|
|
|
return $reqXml->schemaValidateSource($validateConvertedTransactionXsdString);
|
|
return $reqXml->schemaValidateSource($validateConvertedTransactionXsdString);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public function _getDescribeFeatureType($nsPrefix, $type) {
|
|
|
|
|
- return $this->_getDescribeFeatureTypes(array(array($nsPrefix, $type)));
|
|
|
|
|
|
|
+ public function _getDescribeFeatureType($nsPrefix, $type, $simple = true) {
|
|
|
|
|
+ return $this->_getDescribeFeatureTypes(array(array($nsPrefix, $type)), $simple);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public function _parseDescribeFeatureTypeRequest($reqContent) {
|
|
|
|
|
|
|
+ public function _parseDescribeFeatureTypeRequest($reqContent, $simple = true) {
|
|
|
$parserXml = xml_parser_create();
|
|
$parserXml = xml_parser_create();
|
|
|
xml_parser_set_option($parserXml, XML_OPTION_CASE_FOLDING, 0);
|
|
xml_parser_set_option($parserXml, XML_OPTION_CASE_FOLDING, 0);
|
|
|
xml_parser_set_option($parserXml, XML_OPTION_SKIP_WHITE, 1);
|
|
xml_parser_set_option($parserXml, XML_OPTION_SKIP_WHITE, 1);
|
|
@@ -1231,10 +1231,10 @@ if($DBG){echo '$validateConvertedTransactionXsdString:';print_r($validateConvert
|
|
|
$typeNames[] = explode(':', $requestXmlTags[$i]['value'], 2);
|
|
$typeNames[] = explode(':', $requestXmlTags[$i]['value'], 2);
|
|
|
}
|
|
}
|
|
|
//echo "typeNames: " . json_encode($typeNames) . "\n";
|
|
//echo "typeNames: " . json_encode($typeNames) . "\n";
|
|
|
- return $this->_getDescribeFeatureTypes($typeNames);
|
|
|
|
|
|
|
+ return $this->_getDescribeFeatureTypes($typeNames, $simple);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public function _getDescribeFeatureAllTypes() {
|
|
|
|
|
|
|
+ public function _getDescribeFeatureAllTypes($simple = true) {
|
|
|
$db = DB::getDB();
|
|
$db = DB::getDB();
|
|
|
$idDefaultDB = $db->_zasob_id;
|
|
$idDefaultDB = $db->_zasob_id;
|
|
|
|
|
|
|
@@ -1244,16 +1244,18 @@ if($DBG){echo '$validateConvertedTransactionXsdString:';print_r($validateConvert
|
|
|
$tblName = $tblAcl->getName();
|
|
$tblName = $tblAcl->getName();
|
|
|
$typeNames[] = array("p5_{$dataSourceName}", $tblName);
|
|
$typeNames[] = array("p5_{$dataSourceName}", $tblName);
|
|
|
}
|
|
}
|
|
|
- return $this->_getDescribeFeatureTypes($typeNames);
|
|
|
|
|
|
|
+ return $this->_getDescribeFeatureTypes($typeNames, $simple);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// @param $typeNames = array( array( $nsPrefix, $type ) )
|
|
// @param $typeNames = array( array( $nsPrefix, $type ) )
|
|
|
- public function _getDescribeFeatureTypes($typeNames) {
|
|
|
|
|
|
|
+ public function _getDescribeFeatureTypes($typeNames, $simple = true) {
|
|
|
if (empty($typeNames)) {
|
|
if (empty($typeNames)) {
|
|
|
throw new HttpException("Feature Type Names not defined", 400);
|
|
throw new HttpException("Feature Type Names not defined", 400);
|
|
|
}
|
|
}
|
|
|
$baseNsUri = $this->getBaseNamespaceUri();
|
|
$baseNsUri = $this->getBaseNamespaceUri();
|
|
|
|
|
|
|
|
|
|
+ $rootWfsNs = 'p5';
|
|
|
|
|
+ $rootWfsNsUri = "{$baseNsUri}";
|
|
|
$wfsNs = 'p5_default_db';
|
|
$wfsNs = 'p5_default_db';
|
|
|
$wfsNsUri = "{$baseNsUri}/default_db";
|
|
$wfsNsUri = "{$baseNsUri}/default_db";
|
|
|
$featureTypeUri = $this->getBaseUri() . "?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType";
|
|
$featureTypeUri = $this->getBaseUri() . "?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType";
|
|
@@ -1269,6 +1271,7 @@ if($DBG){echo '$validateConvertedTransactionXsdString:';print_r($validateConvert
|
|
|
$dom->appendChild($rootNode);
|
|
$dom->appendChild($rootNode);
|
|
|
$rootNode->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:gml', 'http://www.opengis.net/gml');
|
|
$rootNode->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:gml', 'http://www.opengis.net/gml');
|
|
|
$rootNode->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:' . $wfsNs, $wfsNsUri);
|
|
$rootNode->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:' . $wfsNs, $wfsNsUri);
|
|
|
|
|
+ $rootNode->setAttributeNS('http://www.w3.org/2000/xmlns/', "xmlns:{$rootWfsNs}", $rootWfsNsUri);
|
|
|
$rootNode->setAttribute('elementFormDefault', 'qualified');
|
|
$rootNode->setAttribute('elementFormDefault', 'qualified');
|
|
|
$rootNode->setAttribute('targetNamespace', $wfsNsUri);
|
|
$rootNode->setAttribute('targetNamespace', $wfsNsUri);
|
|
|
{// <xsd:import namespace="http://www.opengis.net/gml" schemaLocation="...../gml/2.1.2/feature.xsd"/>
|
|
{// <xsd:import namespace="http://www.opengis.net/gml" schemaLocation="...../gml/2.1.2/feature.xsd"/>
|
|
@@ -1306,6 +1309,7 @@ if($DBG){echo '$validateConvertedTransactionXsdString:';print_r($validateConvert
|
|
|
|
|
|
|
|
// <xsd:element maxOccurs="1" minOccurs="0" name="{$fldName}" nillable="true" type="xsd:integer"/>
|
|
// <xsd:element maxOccurs="1" minOccurs="0" name="{$fldName}" nillable="true" type="xsd:integer"/>
|
|
|
$pKeyField = $acl->getPrimaryKeyField();
|
|
$pKeyField = $acl->getPrimaryKeyField();
|
|
|
|
|
+ $p5Attributes = ($simple)? array() : $acl->getAttributesFromZasoby();
|
|
|
foreach ($fldList as $fldName) {
|
|
foreach ($fldList as $fldName) {
|
|
|
$elNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:element');
|
|
$elNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:element');
|
|
|
$seqNode->appendChild($elNode);
|
|
$seqNode->appendChild($elNode);
|
|
@@ -1319,6 +1323,7 @@ if($DBG){echo '$validateConvertedTransactionXsdString:';print_r($validateConvert
|
|
|
$elNode->setAttribute('minOccurs', $minOccurs);
|
|
$elNode->setAttribute('minOccurs', $minOccurs);
|
|
|
$elNode->setAttribute('maxOccurs', '1');
|
|
$elNode->setAttribute('maxOccurs', '1');
|
|
|
$elNode->setAttribute('nillable', 'true');
|
|
$elNode->setAttribute('nillable', 'true');
|
|
|
|
|
+ $fldType = 'xsd:string';
|
|
|
if ($acl->isIntegerField($fldName)) {
|
|
if ($acl->isIntegerField($fldName)) {
|
|
|
$fldType = 'xsd:integer';
|
|
$fldType = 'xsd:integer';
|
|
|
}
|
|
}
|
|
@@ -1344,17 +1349,57 @@ if($DBG){echo '$validateConvertedTransactionXsdString:';print_r($validateConvert
|
|
|
$fldType = 'gml:GeometryPropertyType';
|
|
$fldType = 'gml:GeometryPropertyType';
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- else {
|
|
|
|
|
- $fldType = 'xsd:string';
|
|
|
|
|
|
|
+ else if ($acl->isEnumerationField($fldName)) {
|
|
|
|
|
+ $fldType = ($simple)? 'xsd:string' : "{$nsPrefix}:{$fldName}Type";
|
|
|
}
|
|
}
|
|
|
$elNode->setAttribute('type', $fldType);
|
|
$elNode->setAttribute('type', $fldType);
|
|
|
|
|
+
|
|
|
|
|
+ if (!$simple) {
|
|
|
|
|
+ if (!empty($p5Attributes[$fldName]['id_zasob'])) {
|
|
|
|
|
+ $elNode->setAttributeNS($rootWfsNsUri, "{$rootWfsNs}:id_zasob", $p5Attributes[$fldName]['id_zasob']);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!empty($p5Attributes[$fldName]['label'])) {
|
|
|
|
|
+ $elNode->setAttributeNS($rootWfsNsUri, "{$rootWfsNs}:label", $p5Attributes[$fldName]['label']);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!empty($p5Attributes[$fldName]['description'])) {
|
|
|
|
|
+ $elNode->setAttributeNS($rootWfsNsUri, "{$rootWfsNs}:description", $p5Attributes[$fldName]['description']);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$elNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:element');
|
|
$elNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:element');
|
|
|
$rootNode->appendChild($elNode);
|
|
$rootNode->appendChild($elNode);
|
|
|
$elNode->setAttribute('name', $type);
|
|
$elNode->setAttribute('name', $type);
|
|
|
$elNode->setAttribute('type', $wfsNs . ':' . $typeName);
|
|
$elNode->setAttribute('type', $wfsNs . ':' . $typeName);
|
|
|
- $elNode->setAttribute('substitutionGroup', 'gml:_Feature');// substitutionGroup="gml:_Feature"
|
|
|
|
|
|
|
+ if ($simple) {
|
|
|
|
|
+ $elNode->setAttribute('substitutionGroup', 'gml:_Feature');
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $elNode->setAttribute('substitutionGroup', 'gml:AbstractFeature');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (!$simple) {
|
|
|
|
|
+ foreach ($fldList as $fldName) {
|
|
|
|
|
+ if ($acl->isEnumerationField($fldName)) {
|
|
|
|
|
+ $enum = $acl->getEnumerations($fldName);
|
|
|
|
|
+ $stNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:simpleType');
|
|
|
|
|
+ $stNode->setAttribute('name', "{$fldName}Type");//"{$nsPrefix}:{$fldName}Type");
|
|
|
|
|
+ $rootNode->appendChild($stNode);
|
|
|
|
|
+ $resNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:restriction');
|
|
|
|
|
+ $stNode->appendChild($resNode);
|
|
|
|
|
+ $resNode->setAttribute('base', 'xsd:string');
|
|
|
|
|
+ // TODO: if (!empty($p5Attributes[$fldName]['valuesMap'])) -> show only this values
|
|
|
|
|
+ foreach ($enum as $val => $label) {
|
|
|
|
|
+ $enumNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:enumeration');
|
|
|
|
|
+ $resNode->appendChild($enumNode);
|
|
|
|
|
+ $enumNode->setAttribute('value', "{$val}");
|
|
|
|
|
+
|
|
|
|
|
+ if (!empty($p5Attributes[$fldName]['valuesMap'][$val])) {
|
|
|
|
|
+ $enumNode->setAttributeNS($rootWfsNsUri, "{$rootWfsNs}:label", $p5Attributes[$fldName]['valuesMap'][$val]);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return $dom->saveXML();
|
|
return $dom->saveXML();
|