$row[\database\SpsSqlManager::$placeId], self::$parentIdName => $row[\database\SpsSqlManager::$parentId], self::$refpointName => $row[\database\SpsSqlManager::$refpoint]); array_push($places, $place); } return json_encode($places); } /** * Method convert an array to a response json for the pis service like * @example [{"id":"127003463","0":{"placeInformationName":"name","placeInformationValue":"Informations-, Kommunikations- und Medienzentrum"},"1":{"placeInformationName":"typ","placeInformationValue":"library"}}] * @param array[num][assoc] $result * @return json-string */ public static function arrayToPisJson($result) { $actPlace = 0; $infos = array(); $place = null; foreach ($result as $row) { // fetch the place id of the row $placeId = $row[\database\PisSqlManager::$placeId]; // if the id is new -> add new place item if ($actPlace != $placeId) { if ($place) { array_push($infos, $place); } $actPlace = $placeId; $place = array(self::$placeIdName => $placeId); } // add placeinformation item $placeInfo = array(self::$placeInfoName => $row[\database\PisSqlManager::$infName], self::$placeInfoValueName => utf8_encode($row[\database\PisSqlManager::$infValue])); array_push($place, $placeInfo); } array_push($infos, $place); return json_encode($infos); } /** * Method convert an array to a response json for the pss service * * @param array[num][assoc] $result * @return Json-string */ public static function arrayToPssJson($result) { $actPlace = 0; $services = array(); $place = null; foreach ($result as $row) { // fetch the place id of the row $placeId = $row[\database\PssSqlManager::$placeId]; // if the id is new -> add new place item if ($actPlace != $placeId) { if ($place) { array_push($services, $place); } $actPlace = $placeId; $place = array(self::$placeIdName => $placeId); } // add placeservice items $placeSrv = array(self::$placeServiceName => $row[\database\PisSqlManager::$srvName], self::$placeSapName => $row[\database\PisSqlManager::$srvSap], self::$placeRequestName => $row[\database\PisSqlManager::$srvRequest]); array_push($place, $placeSrv); } array_push($services, $place); return json_encode($services); } /** * Implement the arrayToSps from @see SerialManager * @param array [num] [assoc] $result * @return string */ public function arrayToSps($result) { return self::arrayToSpsJson($result); } /** * Implement the arrayToPss from @see SerialManager * @param array [num] [assoc] $result * @return string */ public function arrayToPss($result) { return self::arrayToPssJson($result); } /** * Implement the arrayToPis from @see SerialManager * @param array [num] [assoc] $result * @return string */ public function arrayToPis($result) { return self::arrayToPisJson($result); } } ?>