Procházet zdrojové kódy

synced code from biall - wfs

Piotr Labudda před 8 roky
rodič
revize
6570b5f86b

+ 20 - 1
SE/se-lib/Api/Wfs/GetFeature.php

@@ -379,7 +379,7 @@ class Api_Wfs_GetFeature {
 					$xmlWriter->endElement(); // 'p5:next'
 				} else {
 					DBG::log("TODO: Not Implemented p5:links chldren '{$type}'");
-					$xmlWriter->writeComment("TODO: Not implemented p5:links chldren '{$type}'");
+					$xmlWriter->writeComment("TODO: Not implemented p5:links children '{$type}'");
 				}
 			}
 			$xmlWriter->endElement(); // 'p5:links'
@@ -560,4 +560,23 @@ class Api_Wfs_GetFeature {
 		$xmlWriter->endElement();
 	}
 
+
+	public static function printJsonFeatures($items, $acl, $showFields = []) {
+		header('Content-Type: text/json; charset=UTF-8');
+		// TODO: only fields with Read access, then filter by $showFields list if set
+		$outputBlobFormat = V::get('outputBlobFormat', 'base64', $_GET);
+		if ('default_db/COMPANIES_FV' === $acl->getNamespace()) {
+			$items = array_map(function ($item) use ($outputBlobFormat) {
+				if (1 == $item['DOKUMENT']) {
+					$item['DOKUMENT'] = ('base64' === $outputBlobFormat)
+					?	base64_encode( DB::getPDO()->getBlob('COMPANIES_FV', 'DOKUMENT', 'ID', $item['ID']) )
+					:	Request::getPathUri() . "wfs-data.php?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetBlob&namespace=default_db/COMPANIES_FV&primaryKey={$item['ID']}&fieldName=DOKUMENT";
+				}
+				return $item;
+			}, $items);
+		}
+		echo json_encode($items);
+		exit;
+	}
+
 }

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

@@ -212,7 +212,6 @@ class Api_WfsDataServer extends Api_WfsServerBase {
 		$items = $queryFeatures->getItems();
 		DBG::log($items, 'array', 'getItems - $items');
 
-
 		header('Content-type: application/xml; charset=utf-8');
 		// echo "\$args['filterFields']: ";print_r($args['filterFields']);echo "\$searchParams['cols']: ";print_r($searchParams['cols']);die("");
 		$xmlWriter = new Core_XmlWriter();