Merge branch 'feature/#165' into devel

This commit is contained in:
stubbfel
2013-08-19 17:55:28 +02:00
5 changed files with 416 additions and 10 deletions

View File

@@ -32,17 +32,29 @@ class PisSqlManager extends SQLManager {
*/
public static $infValue = "iValue";
/**
* Fieldname of the parendId
* @var string
*/
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 pid, iName, iValue FROM pis WHERE ";
private static $selectTerm = "SELECT pid, parent, refpoint, iName, iValue FROM pis WHERE ";
/**
* String for the select all part of the query
* @var string
*/
private static $selectAllTerm = "SELECT pid, iName, iValue FROM pis ";
private static $selectAllTerm = "SELECT pid, parent, refpoint, iName, iValue FROM pis ";
/**
* String for the orderby part of the query
@@ -105,7 +117,7 @@ class PisSqlManager extends SQLManager {
if ($query == self::$selectTerm) {
$query = self::$selectAllTerm;
}
$query .= self::$orderByTerm;
// send query
return $this->query($query);

View File

@@ -38,17 +38,29 @@ class PssSqlManager extends SQLManager {
*/
public static $srvRequest = "request";
/**
* Fieldname of the parendId
* @var string
*/
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 pid, sName, sap, request FROM pss WHERE ";
private static $selectTerm = "SELECT pid, parent, refpoint, sName, sap, request FROM pss WHERE ";
/**
* String for the select all part of the query
* @var string
*/
private static $selectAllTerm = "SELECT pid, sName, sap, request FROM pss ";
private static $selectAllTerm = "SELECT pid, parent, refpoint, sName, sap, request FROM pss ";
/**
* String for the orderby part of the query
@@ -95,12 +107,12 @@ class PssSqlManager extends SQLManager {
$query .= self::$openBracket;
$query .= \utiliy\ArrayManager::toSqlWhereString($pidList, self::$orTerm, self::$pidTerm);
$query .= self::$closeBracket;
} else if ($pidList[0] != "*") {
} else if ($pidList[0] != "*") {
return null;
}
if (count($sNameList) > 0 && \utiliy\ArrayManager::validAlphaNumList($sNameList)) {
if ($query != self::$selectTerm) {
if ($query != self::$selectTerm) {
$query .= self::$andTerm;
}
$query .= self::$openBracket;
@@ -111,7 +123,7 @@ class PssSqlManager extends SQLManager {
if ($query == self::$selectTerm) {
$query = self::$selectAllTerm;
}
$query .= self::$orderByTerm;
// send query

View File

@@ -82,10 +82,12 @@ class JsonManager implements SerialManager {
* @return json-string
*/
public static function arrayToPisJson($result) {
$infos = array();
$infos = array();
foreach ($result as $row) {
// fetch the place id of the row
$placeId = $row[\database\PisSqlManager::$placeId];
$placeId = $row[\database\PisSqlManager::$placeId];
$infos[$placeId][self::$parentIdName] = $row[\database\PisSqlManager::$parentId];
$infos[$placeId][self::$refpointName] = $row[\database\PisSqlManager::$refpoint];
$infos[$placeId][$row[\database\PisSqlManager::$infName]] = utf8_encode($row[\database\PisSqlManager::$infValue]);
}
return json_encode($infos);
@@ -103,6 +105,8 @@ class JsonManager implements SerialManager {
// fetch the place id of the row
$placeId = $row[\database\PssSqlManager::$placeId];
$placeSrv = array(self::$placeSapName => $row[\database\PssSqlManager::$srvSap], self::$placeRequestName => $row[\database\PssSqlManager::$srvRequest]);
$services[$placeId][self::$parentIdName] = $row[\database\PssSqlManager::$parentId];
$services[$placeId][self::$refpointName] = $row[\database\PssSqlManager::$refpoint];
$services[$placeId][$row[\database\PssSqlManager::$srvName]] = $placeSrv;
}
return json_encode($services);

View File

@@ -120,6 +120,8 @@ class XmlManager implements SerialManager {
$actPlace = $placeId;
$place = $xml->addChild(self::$placeElementName);
$place->addAttribute(self::$placeIdAttrName, $placeId);
$place->addAttribute(self::$parentIdAttrName, $row[\database\PisSqlManager::$parentId]);
$place->addAttribute(self::$refpointAttrName, $row[\database\PisSqlManager::$refpoint]);
}
// add placeinformation elment
@@ -155,6 +157,8 @@ class XmlManager implements SerialManager {
$actPlace = $placeId;
$place = $xml->addChild(self::$placeElementName);
$place->addAttribute(self::$placeIdAttrName, $placeId);
$place->addAttribute(self::$parentIdAttrName, $row[\database\PssSqlManager::$parentId]);
$place->addAttribute(self::$refpointAttrName, $row[\database\PssSqlManager::$refpoint]);
}
// add placeservice elment

View File

@@ -0,0 +1,374 @@
-- phpMyAdmin SQL Dump
-- version 4.0.4.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Erstellungszeit: 19. Aug 2013 um 17:33
-- Server Version: 5.5.32
-- PHP-Version: 5.4.16
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Datenbank: `geodb`
--
CREATE DATABASE IF NOT EXISTS `geodb` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE `geodb`;
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `domain`
--
-- Erzeugt am: 19. Aug 2013 um 15:04
--
DROP TABLE IF EXISTS `domain`;
CREATE TABLE IF NOT EXISTS `domain` (
`id` int(32) NOT NULL AUTO_INCREMENT,
`name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ;
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `information`
--
-- Erzeugt am: 19. Aug 2013 um 15:04
--
DROP TABLE IF EXISTS `information`;
CREATE TABLE IF NOT EXISTS `information` (
`id` int(32) NOT NULL AUTO_INCREMENT,
`name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5 ;
-- --------------------------------------------------------
--
-- Stellvertreter-Struktur des Views `pis`
--
DROP VIEW IF EXISTS `pis`;
CREATE TABLE IF NOT EXISTS `pis` (
`pid` int(32)
,`parent` int(32)
,`refpoint` mediumtext
,`iid` int(32)
,`iName` varchar(50)
,`iValue` varchar(500)
);
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `place`
--
-- Erzeugt am: 19. Aug 2013 um 15:04
--
DROP TABLE IF EXISTS `place`;
CREATE TABLE IF NOT EXISTS `place` (
`id` int(32) NOT NULL AUTO_INCREMENT,
`plan` geometry NOT NULL,
`parent` int(32) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=183190823 ;
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `placealias`
--
-- Erzeugt am: 19. Aug 2013 um 15:04
--
DROP TABLE IF EXISTS `placealias`;
CREATE TABLE IF NOT EXISTS `placealias` (
`aid` int(32) NOT NULL AUTO_INCREMENT,
`pid` int(32) NOT NULL,
`alias` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`aid`,`pid`),
KEY `pid` (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=172 ;
--
-- RELATIONEN DER TABELLE `placealias`:
-- `pid`
-- `place` -> `id`
--
-- --------------------------------------------------------
--
-- Stellvertreter-Struktur des Views `placealiasview`
--
DROP VIEW IF EXISTS `placealiasview`;
CREATE TABLE IF NOT EXISTS `placealiasview` (
`alias` varchar(250)
,`plan` geometry
,`aid` int(32)
,`pid` int(32)
,`parent` int(32)
);
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `placedomain`
--
-- Erzeugt am: 19. Aug 2013 um 15:04
--
DROP TABLE IF EXISTS `placedomain`;
CREATE TABLE IF NOT EXISTS `placedomain` (
`pid` int(32) NOT NULL,
`did` int(32) NOT NULL,
PRIMARY KEY (`pid`,`did`),
KEY `did` (`did`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- RELATIONEN DER TABELLE `placedomain`:
-- `pid`
-- `place` -> `id`
-- `did`
-- `domain` -> `id`
--
-- --------------------------------------------------------
--
-- Stellvertreter-Struktur des Views `placedomainview`
--
DROP VIEW IF EXISTS `placedomainview`;
CREATE TABLE IF NOT EXISTS `placedomainview` (
`pid` int(32)
,`did` int(32)
,`name` varchar(50)
);
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `placeinformation`
--
-- Erzeugt am: 19. Aug 2013 um 15:04
--
DROP TABLE IF EXISTS `placeinformation`;
CREATE TABLE IF NOT EXISTS `placeinformation` (
`pid` int(32) NOT NULL,
`iid` int(32) NOT NULL,
`value` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`pid`,`iid`),
KEY `iid` (`iid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- RELATIONEN DER TABELLE `placeinformation`:
-- `pid`
-- `place` -> `id`
-- `iid`
-- `information` -> `id`
--
-- --------------------------------------------------------
--
-- Stellvertreter-Struktur des Views `placeinformationview`
--
DROP VIEW IF EXISTS `placeinformationview`;
CREATE TABLE IF NOT EXISTS `placeinformationview` (
`pid` int(32)
,`iid` int(32)
,`name` varchar(50)
,`value` varchar(500)
);
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `placeservice`
--
-- Erzeugt am: 19. Aug 2013 um 15:04
--
DROP TABLE IF EXISTS `placeservice`;
CREATE TABLE IF NOT EXISTS `placeservice` (
`pid` int(32) NOT NULL,
`sid` int(32) NOT NULL,
`request` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`pid`,`sid`),
KEY `sid` (`sid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- RELATIONEN DER TABELLE `placeservice`:
-- `pid`
-- `place` -> `id`
-- `sid`
-- `service` -> `id`
--
-- --------------------------------------------------------
--
-- Stellvertreter-Struktur des Views `placeserviceview`
--
DROP VIEW IF EXISTS `placeserviceview`;
CREATE TABLE IF NOT EXISTS `placeserviceview` (
`pid` int(32)
,`sid` int(32)
,`name` varchar(50)
,`sap` varchar(250)
,`request` varchar(250)
);
-- --------------------------------------------------------
--
-- Stellvertreter-Struktur des Views `pss`
--
DROP VIEW IF EXISTS `pss`;
CREATE TABLE IF NOT EXISTS `pss` (
`pid` int(32)
,`parent` int(32)
,`refpoint` mediumtext
,`sid` int(32)
,`sName` varchar(50)
,`sap` varchar(250)
,`request` varchar(250)
);
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `service`
--
-- Erzeugt am: 19. Aug 2013 um 15:04
--
DROP TABLE IF EXISTS `service`;
CREATE TABLE IF NOT EXISTS `service` (
`id` int(32) NOT NULL AUTO_INCREMENT,
`name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`sap` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;
-- --------------------------------------------------------
--
-- Stellvertreter-Struktur des Views `sps`
--
DROP VIEW IF EXISTS `sps`;
CREATE TABLE IF NOT EXISTS `sps` (
`id` int(32)
,`plan` geometry
,`refpoint` mediumtext
,`parent` int(32)
,`did` int(32)
,`dName` varchar(50)
,`aid` int(32)
,`alias` varchar(250)
);
-- --------------------------------------------------------
--
-- Struktur des Views `pis`
--
DROP TABLE IF EXISTS `pis`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `pis` AS select `placeinformation`.`pid` AS `pid`,`place`.`parent` AS `parent`,astext(centroid(`place`.`plan`)) AS `refpoint`,`placeinformation`.`iid` AS `iid`,`information`.`name` AS `iName`,`placeinformation`.`value` AS `iValue` from ((`placeinformation` left join `place` on((`place`.`id` = `placeinformation`.`pid`))) left join `information` on((`information`.`id` = `placeinformation`.`iid`)));
-- --------------------------------------------------------
--
-- Struktur des Views `placealiasview`
--
DROP TABLE IF EXISTS `placealiasview`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `placealiasview` AS select `placealias`.`alias` AS `alias`,`place`.`plan` AS `plan`,`placealias`.`aid` AS `aid`,`placealias`.`pid` AS `pid`,`place`.`parent` AS `parent` from (`place` left join `placealias` on((`place`.`id` = `placealias`.`pid`)));
-- --------------------------------------------------------
--
-- Struktur des Views `placedomainview`
--
DROP TABLE IF EXISTS `placedomainview`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `placedomainview` AS select `placedomain`.`pid` AS `pid`,`placedomain`.`did` AS `did`,`domain`.`name` AS `name` from ((`placedomain` left join `place` on((`place`.`id` = `placedomain`.`pid`))) left join `domain` on((`domain`.`id` = `placedomain`.`did`)));
-- --------------------------------------------------------
--
-- Struktur des Views `placeinformationview`
--
DROP TABLE IF EXISTS `placeinformationview`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `placeinformationview` AS select `placeinformation`.`pid` AS `pid`,`placeinformation`.`iid` AS `iid`,`information`.`name` AS `name`,`placeinformation`.`value` AS `value` from ((`placeinformation` left join `place` on((`place`.`id` = `placeinformation`.`pid`))) left join `information` on((`information`.`id` = `placeinformation`.`iid`)));
-- --------------------------------------------------------
--
-- Struktur des Views `placeserviceview`
--
DROP TABLE IF EXISTS `placeserviceview`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `placeserviceview` AS select `placeservice`.`pid` AS `pid`,`placeservice`.`sid` AS `sid`,`service`.`name` AS `name`,`service`.`sap` AS `sap`,`placeservice`.`request` AS `request` from ((`placeservice` left join `service` on((`service`.`id` = `placeservice`.`sid`))) left join `place` on((`place`.`id` = `placeservice`.`pid`)));
-- --------------------------------------------------------
--
-- Struktur des Views `pss`
--
DROP TABLE IF EXISTS `pss`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `pss` AS select `placeservice`.`pid` AS `pid`,`place`.`parent` AS `parent`,astext(centroid(`place`.`plan`)) AS `refpoint`,`placeservice`.`sid` AS `sid`,`service`.`name` AS `sName`,`service`.`sap` AS `sap`,`placeservice`.`request` AS `request` from ((`placeservice` left join `service` on((`service`.`id` = `placeservice`.`sid`))) left join `place` on((`place`.`id` = `placeservice`.`pid`)));
-- --------------------------------------------------------
--
-- Struktur des Views `sps`
--
DROP TABLE IF EXISTS `sps`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `sps` AS select `place`.`id` AS `id`,`place`.`plan` AS `plan`,astext(centroid(`place`.`plan`)) AS `refpoint`,`place`.`parent` AS `parent`,`placedomain`.`did` AS `did`,`domain`.`name` AS `dName`,`placealias`.`aid` AS `aid`,`placealias`.`alias` AS `alias` from (((`place` left join `placedomain` on((`place`.`id` = `placedomain`.`pid`))) left join `domain` on((`domain`.`id` = `placedomain`.`did`))) left join `placealias` on((`place`.`id` = `placealias`.`pid`)));
--
-- Constraints der exportierten Tabellen
--
--
-- Constraints der Tabelle `placealias`
--
ALTER TABLE `placealias`
ADD CONSTRAINT `placealias_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints der Tabelle `placedomain`
--
ALTER TABLE `placedomain`
ADD CONSTRAINT `placedomain_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `placedomain_ibfk_2` FOREIGN KEY (`did`) REFERENCES `domain` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints der Tabelle `placeinformation`
--
ALTER TABLE `placeinformation`
ADD CONSTRAINT `placeinformation_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `placeinformation_ibfk_2` FOREIGN KEY (`iid`) REFERENCES `information` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints der Tabelle `placeservice`
--
ALTER TABLE `placeservice`
ADD CONSTRAINT `placeservice_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `placeservice_ibfk_2` FOREIGN KEY (`sid`) REFERENCES `service` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;