public function testBoxInt32() { $bvXmlInt = MgBoxedValue::Int32(1234, "xml"); $bvJsonInt = MgBoxedValue::Int32(1234, "json"); $doc = new DOMDocument(); $doc->loadXML($bvXmlInt); $this->assertTrue($doc->getElementsByTagName("Type")->length == 1); $this->assertEquals("Int32", $doc->getElementsByTagName("Type")->item(0)->nodeValue); $this->assertTrue($doc->getElementsByTagName("Value")->length == 1); $this->assertEquals("1234", $doc->getElementsByTagName("Value")->item(0)->nodeValue); $val = json_decode($bvJsonInt); $this->assertEquals("Int32", $val->PrimitiveValue->Type); $this->assertEquals(1234, $val->PrimitiveValue->Value); }
public function GetSessionTimeout($sessionId, $format) { $fmt = $this->ValidateRepresentation($format, array("xml", "json")); $siteConn = new MgSiteConnection(); $userInfo = new MgUserInformation($sessionId); $siteConn->Open($userInfo); $site = $siteConn->GetSite(); $timeout = $site->GetSessionTimeout(); $body = MgBoxedValue::Int32($timeout, $fmt); if ($fmt == "xml") { $this->app->response->header("Content-Type", MgMimeType::Xml); } else { $this->app->response->header("Content-Type", MgMimeType::Json); } $this->app->response->setBody($body); }
public function ConvertWktToEpsg($wkt, $format) { //Check for unsupported representations $fmt = $this->ValidateRepresentation($format, array("xml", "json")); $factory = new MgCoordinateSystemFactory(); $cs = $factory->Create($wkt); $body = MgBoxedValue::Int32($cs->GetEpsgCode(), $fmt); if ($fmt == "xml") { $this->app->response->header("Content-Type", MgMimeType::Xml); } else { $this->app->response->header("Content-Type", MgMimeType::Json); } $this->app->response->setBody($body); }