"; /** * Name for the place element * @var string */ private static $placeElementName = "place"; /** * Name for the placeinformation element * @var string */ private static $placeInfoElementName = "placeInformation"; /** * Name for the placeserviceelement * @var string */ private static $placeServiceElementName = "placeService"; /** * Name for the ssap element * @var string */ private static $placeSapElementName = "sap"; /** * Name for the request element * @var string */ private static $placeRequestElementName = "request"; /** * Name for the placeInfoName attribute * @var string */ private static $placeInfoAttrName = "placeInformationName"; /** * Name for the placeServiceName attribute * @var string */ private static $placeServiceAttrName = "placeServiceName"; /** * Name for the placeid attribute * @var string */ private static $placeIdAttrName = "id"; /** * Name for the parent attribute * @var string */ private static $parentIdAttrName = "parentId"; /** * Method convert an array to a response xml for the sps service * * * @param array[num][assoc] $result * @return xml-string */ public static function arrayToSpsXml($result) { $xml = new \SimpleXMLElement(XmlManager::$defaultXmlDoc); foreach ($result as $row) { $place = $xml->addChild(XmlManager::$placeElementName); $place->addAttribute(XmlManager::$placeIdAttrName, $row[\database\SpsSqlManager::$placeId]); $place->addAttribute(XmlManager::$parentIdAttrName, $row[\database\SpsSqlManager::$parentId]); } return $xml->asXML(); } /** * Method convert an array to a response xml for the pis service like * * Value * * * @param array[num][assoc] $result * @return xml-string */ public static function arrayToPisXml($result) { $xml = new \SimpleXMLElement(XmlManager::$defaultXmlDoc); $actPlace = 0; foreach ($result as $row) { // fetch the place id of the row $placeId = $row[\database\PisSqlManager::$placeId]; // if the id is new -> add new place element if ($actPlace != $placeId) { $actPlace = $placeId; $place = $xml->addChild(XmlManager::$placeElementName); $place->addAttribute(XmlManager::$placeIdAttrName, $placeId); } // add placeinformation elment $placeInfo = $place->addChild(XmlManager::$placeInfoElementName, utf8_encode($row[\database\PisSqlManager::$infValue])); $placeInfo->addAttribute(XmlManager::$placeInfoAttrName, $row[\database\PisSqlManager::$infName]); } return $xml->asXML(); } /** * Method convert an array to a response xml for the pss service * * * sapValue * reqVaule * * * * @param array[num][assoc] $result * @return xml-string */ public static function arrayToPssXml($result) { $xml = new \SimpleXMLElement(XmlManager::$defaultXmlDoc); $actPlace = 0; foreach ($result as $row) { // fetch the place id of the row $placeId = $row[\database\PssSqlManager::$placeId]; // if the id is new -> add new place element if ($actPlace != $placeId) { $actPlace = $placeId; $place = $xml->addChild(XmlManager::$placeElementName); $place->addAttribute(XmlManager::$placeIdAttrName, $placeId); } // add placeservice elment $placeSrv = $place->addChild(XmlManager::$placeServiceElementName); $placeSrv->addAttribute(XmlManager::$placeServiceAttrName, $row[\database\PssSqlManager::$srvName]); $placeSrv->addChild(XmlManager::$placeSapElementName, $row[\database\PssSqlManager::$srvSap]); $placeSrv->addChild(XmlManager::$placeRequestElementName, $row[\database\PssSqlManager::$srvRequest]); } return $xml->asXML(); } } ?>