This commit is contained in:
stubbfel
2013-07-10 13:50:09 +02:00
parent a9d5edde37
commit d00187bdc2
3 changed files with 30 additions and 11 deletions

View File

@@ -26,11 +26,17 @@ class SpsSqlManager extends SQLManager {
*/ */
public static $parentId = "parent"; public static $parentId = "parent";
/**
* Fieldname of the refpoint
* @var string
*/
public static $refpoint = "refpoint";
/** /**
* String for the select part of the query * String for the select part of the query
* @var string * @var string
*/ */
private static $selectTerm = "SELECT DISTINCT id, parent FROM sps WHERE "; private static $selectTerm = "SELECT DISTINCT id, parent, refpoint FROM sps WHERE ";
/** /**
* String for the alias part of the query * String for the alias part of the query
@@ -122,7 +128,7 @@ class SpsSqlManager extends SQLManager {
// build query string // build query string
$query = self::$selectTerm; $query = self::$selectTerm;
if ($this->validAliasString($alias)) { if ($this->validAliasString($alias)) {
$query .= self::$aliasTerm . self::$quoteTerm . $alias . self::$quoteTerm . $this->addDomainTerm($domain); $query .= self::$aliasTerm . self::$quoteTerm . $alias . self::$quoteTerm . $this->addDomainTerm($domain);
} else { } else {
return null; return null;
} }
@@ -209,8 +215,7 @@ class SpsSqlManager extends SQLManager {
* @return boolean * @return boolean
*/ */
private function validPolyString($poly) { private function validPolyString($poly) {
if (\utiliy\StringManager::validSQLString($poly) && \utiliy\StringManager::startsWith($poly, self::$polyStartStr) if (\utiliy\StringManager::validSQLString($poly) && \utiliy\StringManager::startsWith($poly, self::$polyStartStr) && \utiliy\StringManager::endsWith($poly, self::$polyEndStr)) {
&& \utiliy\StringManager::endsWith($poly, self::$polyEndStr)) {
return TRUE; return TRUE;
} }
return FALSE; return FALSE;

View File

@@ -54,6 +54,12 @@ class JsonManager implements SerialManager {
*/ */
private static $parentIdName = "parentId"; private static $parentIdName = "parentId";
/**
* Name for the refpoint item
* @var string
*/
private static $refpointName = "refpoint";
/** /**
* Method convert an array to a response json for the sps service * Method convert an array to a response json for the sps service
* @example [{"id":"121799787","parentId":null}] * @example [{"id":"121799787","parentId":null}]
@@ -64,7 +70,8 @@ class JsonManager implements SerialManager {
$places = array(); $places = array();
foreach ($result as $row) { foreach ($result as $row) {
$place = array(self::$placeIdName => $row[\database\SpsSqlManager::$placeId], $place = array(self::$placeIdName => $row[\database\SpsSqlManager::$placeId],
self::$parentIdName => $row[\database\SpsSqlManager::$parentId]); self::$parentIdName => $row[\database\SpsSqlManager::$parentId],
self::$refpointName => $row[\database\SpsSqlManager::$refpoint]);
array_push($places, $place); array_push($places, $place);
} }
return json_encode($places); return json_encode($places);

View File

@@ -10,7 +10,7 @@ require_once PATH_UTILITTY . "/SerialManager.php";
* @author stubbfel * @author stubbfel
* @since 25.06.2013 * @since 25.06.2013
*/ */
class XmlManager implements SerialManager{ class XmlManager implements SerialManager {
/** /**
* a default xml document * a default xml document
@@ -72,6 +72,12 @@ class XmlManager implements SerialManager{
*/ */
private static $parentIdAttrName = "parentId"; private static $parentIdAttrName = "parentId";
/**
* Name for the refpoint attribute
* @var string
*/
private static $refpointAttrName = "refpoint";
/** /**
* Method convert an array to a response xml for the sps service * Method convert an array to a response xml for the sps service
* <place id ="4711" parentID=%0815"/> * <place id ="4711" parentID=%0815"/>
@@ -86,6 +92,7 @@ class XmlManager implements SerialManager{
$place = $xml->addChild(self::$placeElementName); $place = $xml->addChild(self::$placeElementName);
$place->addAttribute(self::$placeIdAttrName, $row[\database\SpsSqlManager::$placeId]); $place->addAttribute(self::$placeIdAttrName, $row[\database\SpsSqlManager::$placeId]);
$place->addAttribute(self::$parentIdAttrName, $row[\database\SpsSqlManager::$parentId]); $place->addAttribute(self::$parentIdAttrName, $row[\database\SpsSqlManager::$parentId]);
$place->addAttribute(self::$refpointAttrName, $row[\database\SpsSqlManager::$refpoint]);
} }
return $xml->asXML(); return $xml->asXML();
} }
@@ -158,15 +165,15 @@ class XmlManager implements SerialManager{
} }
return $xml->asXML(); return $xml->asXML();
} }
public function arrayToSps($result) { public function arrayToSps($result) {
return self::arrayToSpsXml($result); return self::arrayToSpsXml($result);
} }
public function arrayToPis($result){ public function arrayToPis($result) {
return self::arrayToPisXml($result); return self::arrayToPisXml($result);
} }
public function arrayToPss($result) { public function arrayToPss($result) {
return self::arrayToPssXml($result); return self::arrayToPssXml($result);
} }