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";
/**
* Fieldname of the refpoint
* @var string
*/
public static $refpoint = "refpoint";
/**
* String for the select part of the query
* @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
@@ -122,7 +128,7 @@ class SpsSqlManager extends SQLManager {
// build query string
$query = self::$selectTerm;
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 {
return null;
}
@@ -209,8 +215,7 @@ class SpsSqlManager extends SQLManager {
* @return boolean
*/
private function validPolyString($poly) {
if (\utiliy\StringManager::validSQLString($poly) && \utiliy\StringManager::startsWith($poly, self::$polyStartStr)
&& \utiliy\StringManager::endsWith($poly, self::$polyEndStr)) {
if (\utiliy\StringManager::validSQLString($poly) && \utiliy\StringManager::startsWith($poly, self::$polyStartStr) && \utiliy\StringManager::endsWith($poly, self::$polyEndStr)) {
return TRUE;
}
return FALSE;

View File

@@ -54,6 +54,12 @@ class JsonManager implements SerialManager {
*/
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
* @example [{"id":"121799787","parentId":null}]
@@ -64,7 +70,8 @@ class JsonManager implements SerialManager {
$places = array();
foreach ($result as $row) {
$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);
}
return json_encode($places);

View File

@@ -10,7 +10,7 @@ require_once PATH_UTILITTY . "/SerialManager.php";
* @author stubbfel
* @since 25.06.2013
*/
class XmlManager implements SerialManager{
class XmlManager implements SerialManager {
/**
* a default xml document
@@ -72,6 +72,12 @@ class XmlManager implements SerialManager{
*/
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
* <place id ="4711" parentID=%0815"/>
@@ -86,6 +92,7 @@ class XmlManager implements SerialManager{
$place = $xml->addChild(self::$placeElementName);
$place->addAttribute(self::$placeIdAttrName, $row[\database\SpsSqlManager::$placeId]);
$place->addAttribute(self::$parentIdAttrName, $row[\database\SpsSqlManager::$parentId]);
$place->addAttribute(self::$refpointAttrName, $row[\database\SpsSqlManager::$refpoint]);
}
return $xml->asXML();
}
@@ -158,15 +165,15 @@ class XmlManager implements SerialManager{
}
return $xml->asXML();
}
public function arrayToSps($result) {
return self::arrayToSpsXml($result);
}
public function arrayToPis($result){
return self::arrayToPisXml($result);
public function arrayToPis($result) {
return self::arrayToPisXml($result);
}
public function arrayToPss($result) {
return self::arrayToPssXml($result);
}