|
|
@@ -64,7 +64,7 @@ class Api_WfsServerBase {
|
|
|
$args['resultType'] = null;// @from: resultType (resulttype)
|
|
|
$args['bbox'] = null;// @from: BBOX (bbox)
|
|
|
$args['wfs:featureID'] = null;// @from: featureID, featureId (featureid)
|
|
|
- $args['primaryKey'] = null;// primaryKey type - @from: featureID
|
|
|
+ $args['primaryKey'] = null;// primaryKey type - @from: featureID or $req[primaryKey]
|
|
|
|
|
|
$lowerArgs = array(); foreach ($rawArgs as $name => $value) $lowerArgs[ strtolower($name) ] = trim($value);
|
|
|
|
|
|
@@ -130,11 +130,16 @@ class Api_WfsServerBase {
|
|
|
$args['wfs:featureID'] = V::get('featureid', null, $lowerArgs);// TODO: allow multiply feature id (csv)
|
|
|
if ($args['wfs:featureID']) {
|
|
|
$dotPos = strpos($args['wfs:featureID'], '.');
|
|
|
- if (!$dotPos) throw new Exception("Wrong param fetureID");
|
|
|
- if ($args['typeName'] != substr($args['wfs:featureID'], 0, $dotPos)) throw new Exception("Wrong typeName in param fetureID");
|
|
|
+ if (!$dotPos) throw new Exception("Wrong param featureID");
|
|
|
+ if ($args['typeName'] != substr($args['wfs:featureID'], 0, $dotPos)) throw new Exception("Wrong typeName in param featureID");
|
|
|
$args['primaryKey'] = substr($args['wfs:featureID'], $dotPos + 1);
|
|
|
}
|
|
|
|
|
|
+ $pk = V::get('primarykey', '', $lowerArgs);
|
|
|
+ if ($pk) {
|
|
|
+ $args['primaryKey'] = $pk;
|
|
|
+ }
|
|
|
+
|
|
|
if(DBG::isActive() && V::get('DBG', 0, $_GET)){ echo "\$lowerArgs:";print_r($lowerArgs); }
|
|
|
if(DBG::isActive() && V::get('DBG', 0, $_GET)){ echo "\$args:";print_r($args); }
|
|
|
|
|
|
@@ -155,6 +160,7 @@ class Api_WfsServerBase {
|
|
|
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');
|
|
|
@@ -741,13 +747,13 @@ class Api_WfsServerBase {
|
|
|
$statusTag = '';
|
|
|
$statusIsFailed = false;
|
|
|
$statusAll = null;
|
|
|
- $createdFetureId = array();
|
|
|
+ $createdFeatureId = array();
|
|
|
foreach ($changesList as $featureId => $change) {
|
|
|
if ('FAILED' == $change['Status']) {
|
|
|
$statusIsFailed = true;
|
|
|
}
|
|
|
if ('SUCCESS' == $change['Status'] && !empty($change['fid'])) {
|
|
|
- $createdFetureId[] = $change['fid'];
|
|
|
+ $createdFeatureId[] = $change['fid'];
|
|
|
}
|
|
|
// if (!empty($change['Message'])) $messageTag .= "Feature '{$featureId}' {$change['Status']}: {$change['Message']}\n";
|
|
|
}
|
|
|
@@ -771,9 +777,9 @@ class Api_WfsServerBase {
|
|
|
// TODO: build xml by DOMDocument
|
|
|
// TODO: xsi:schemaLocation="http://www.opengis.net/wfs http://localhost:8080/geoserver/schemas/wfs/1.0.0/WFS-transaction.xsd"
|
|
|
$wfsInsertResult = '';
|
|
|
- if (!empty($createdFetureId)) {
|
|
|
+ if (!empty($createdFeatureId)) {
|
|
|
$wfsInsertResult = "\n<wfs:InsertResult>\n";
|
|
|
- foreach ($createdFetureId as $fid) {
|
|
|
+ foreach ($createdFeatureId as $fid) {
|
|
|
$wfsInsertResult .= '<ogc:FeatureId fid="' . $fid . '" xmlns:ogc="http://www.opengis.net/ogc"/>' . "\n";
|
|
|
}
|
|
|
$wfsInsertResult .= "\n</wfs:InsertResult>\n";
|
|
|
@@ -1227,9 +1233,43 @@ if($DBG){echo 'L.' . __LINE__ . ' $validateConvertedTransactionXsdString:';print
|
|
|
return $reqXml->schemaValidateSource($validateConvertedTransactionXsdString);
|
|
|
}
|
|
|
|
|
|
+ public function getInstanceFeatures($name, $args) {
|
|
|
+ $acl = $this->getAclFromTypeName("{$args['typePrefix']}:{$name}");
|
|
|
+ $baseNsUri = Api_WfsNs::getBaseWfsUri();
|
|
|
+ $rootWfsNs = 'p5';
|
|
|
+ $rootWfsNsUri = "{$baseNsUri}";
|
|
|
+ $wfsNs = $args['typePrefix'];
|
|
|
+ $wfsNsUri = "{$baseNsUri}/" . ('p5_' == substr($args['typePrefix'], 0, 3)) ? substr($args['typePrefix'], 3) : $args['typePrefix'];
|
|
|
+ $featureTypeUri = $this->getBaseUri() . "?SERVICE=WFS&VERSION=1.0.0&TYPENAME={$args['xsd:type']}&REQUEST=DescribeFeatureType";
|
|
|
+
|
|
|
+ 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:FeatureCollection');
|
|
|
+ $xmlWriter->writeAttribute('xmlns:wfs', 'http://www.opengis.net/wfs');
|
|
|
+ $xmlWriter->writeAttribute('xmlns', 'http://www.opengis.net/wfs');
|
|
|
+ $xmlWriter->writeAttribute('xmlns:gml', 'http://www.opengis.net/gml');
|
|
|
+ $xmlWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
|
|
|
+ $xmlWriter->writeAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink');
|
|
|
+ $xmlWriter->writeAttribute("xmlns:{$wfsNs}", $wfsNsUri);
|
|
|
+ if (!$simple) $xmlWriter->writeAttribute("xmlns:{$rootWfsNs}", $rootWfsNsUri);
|
|
|
+ $xmlWriter->writeAttribute('xsi:schemaLocation', "{$wfsNsUri} {$featureTypeUri}");
|
|
|
+ $xmlWriter->writeComment("INSTANCE TABLE: " . Core_AclHelper::getInstanceTable($acl->getRootTableName()));
|
|
|
+ // <gml:featureMember>
|
|
|
+ // <p5_objects:TestPerms fid="TestPerms.64" p5:web_link="https://biuro.biall-net.pl/dev-pl/se-master/index.php?_route=ViewTableAjax&namespace=default_objects/TestPerms#EDIT/64">
|
|
|
+ // <p5_objects:ID p5:allow_write="true">64</p5_objects:ID>
|
|
|
+ $xmlWriter->endElement();// wfs:FeatureCollection
|
|
|
+ $xmlWriter->endDocument();
|
|
|
+ exit;
|
|
|
+ }
|
|
|
+
|
|
|
public function _describeInstanceAttributeTable($nsPrefix, $name) {
|
|
|
$acl = $this->getAclFromTypeName("{$nsPrefix}:{$name}");
|
|
|
|
|
|
+ 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');
|