|
|
@@ -61,7 +61,33 @@ class Api_WfsDataServer extends Api_WfsServerBase {
|
|
|
$ogcFilter = $this->convertOgcFilterFromRequestBody($reqBody);
|
|
|
}
|
|
|
}
|
|
|
- return $this->getFeatures($typeEx[0], $typeEx[1], $maxFeatures, $srsname, $ogcFilter, $sortBy, $startIndex, $propertyName);
|
|
|
+ return $this->getFeatures($typeEx[0], $typeEx[1], $maxFeatures, $srsname, $ogcFilter, $sortBy, $startIndex, $propertyName, $simple = true);
|
|
|
+ } else {
|
|
|
+ throw new HttpException("Wrong param TYPENAME", 400);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getFeatureAdvancedAction() {
|
|
|
+ $type = V::get('TYPENAME', '', $_REQUEST);
|
|
|
+ $typeEx = explode(':', $type);
|
|
|
+ $maxFeatures = '10000';// TODO: Set Deafult Limit
|
|
|
+ $maxFeatures = V::get('MAXFEATURES', $maxFeatures, $_REQUEST, 'int');
|
|
|
+ $maxFeatures = V::get('maxFeatures', $maxFeatures, $_REQUEST, 'int');
|
|
|
+ $maxFeatures = V::get('count', $maxFeatures, $_REQUEST, 'int');
|
|
|
+ $startIndex = V::get('startIndex', 0, $_REQUEST, 'int');// sql offset
|
|
|
+ $ogcFilter = V::get('Filter', '', $_REQUEST);
|
|
|
+ $sortBy = V::get('sortBy', '', $_REQUEST);
|
|
|
+ $propertyName = V::get('propertyName', '', $_REQUEST);
|
|
|
+ $propertyName = trim($propertyName);
|
|
|
+ $srsname = V::get('SRSNAME', '', $_REQUEST);// eg. EPSG:4326
|
|
|
+ if (count($typeEx) == 2) {
|
|
|
+ if (empty($ogcFilter)) {// read ogc:Filter from POST body if not defined in GET
|
|
|
+ $reqBody = Request::getRequestBody();
|
|
|
+ if (!empty($reqBody)) {
|
|
|
+ $ogcFilter = $this->convertOgcFilterFromRequestBody($reqBody);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $this->getFeatures($typeEx[0], $typeEx[1], $maxFeatures, $srsname, $ogcFilter, $sortBy, $startIndex, $propertyName, $simple = false);
|
|
|
} else {
|
|
|
throw new HttpException("Wrong param TYPENAME", 400);
|
|
|
}
|
|
|
@@ -84,13 +110,15 @@ class Api_WfsDataServer extends Api_WfsServerBase {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function getFeatures($nsPrefix, $type, $maxFeatures, $srsname, $ogcFilter = '', $sortBy = '', $startIndex = 0, $propertyName = '') {
|
|
|
+ public function getFeatures($nsPrefix, $type, $maxFeatures, $srsname, $ogcFilter = '', $sortBy = '', $startIndex = 0, $propertyName = '', $simple = true) {
|
|
|
$DBG = (V::get('DBG_GEO', '', $_GET) > 0);// TODO: Profiler
|
|
|
$typeName = "{$nsPrefix}:{$type}";
|
|
|
$acl = $this->getAclFromTypeName($typeName);
|
|
|
$fldList = $this->_getFieldListFromAcl($acl);
|
|
|
|
|
|
$baseNsUri = $this->getBaseNamespaceUri();
|
|
|
+ $rootWfsNs = 'p5';
|
|
|
+ $rootWfsNsUri = "{$baseNsUri}";
|
|
|
//$wfsNs = 'p5_default_db_' . $type;//$nsPrefix;
|
|
|
$wfsNs = 'p5_default_db';//$nsPrefix;
|
|
|
$wfsNsUri = "{$baseNsUri}/" . substr($nsPrefix, 3);
|
|
|
@@ -150,6 +178,7 @@ if($DBG){echo 'getItems:';print_r($searchParams);echo "\n";}
|
|
|
$rootNode->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:gml', 'http://www.opengis.net/gml');
|
|
|
$rootNode->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
|
|
|
$rootNode->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:' . $wfsNs, $wfsNsUri);
|
|
|
+ if (!$simple) $rootNode->setAttributeNS('http://www.w3.org/2000/xmlns/', "xmlns:{$rootWfsNs}", $rootWfsNsUri);
|
|
|
//$rootNode->setAttribute('xsi:schemaLocation', 'http://www.opengis.net/wfs');
|
|
|
$rootNode->setAttribute('xsi:schemaLocation', "{$wfsNsUri} {$featureTypeUri}");
|
|
|
|
|
|
@@ -181,6 +210,13 @@ if($DBG){echo 'item['.$itemKey.'] ('.$geomFld.')isEmpty('.empty($item->{$geomFld
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
+ if (!$simple) {
|
|
|
+ $idZasob = $acl->getFieldIdByName($fldName);
|
|
|
+ // TODO: if ! allowed to 'R' - hide text
|
|
|
+ if ($idZasob > 0 && $acl->isAllowed($idZasob, 'W', $item)) {
|
|
|
+ $featureFldNode->setAttributeNS($rootWfsNsUri, "{$rootWfsNs}:allow_write", "true");
|
|
|
+ }
|
|
|
+ }
|
|
|
$featureNode->appendChild($featureFldNode);
|
|
|
}
|
|
|
}
|