/** * Returns HTML text to access GoogleMap. * @param address - address string to generate map for. * @param zoom. */ public static function getGoogleMap($address, $zoom, $iframe) { $key = self::getApiKey(); $encoded = urlencode($address); $coder = new GeoCoder($encoded, $key); $code = $coder->invoke(); $mapRep = ""; if ($iframe != null && $iframe == "true") { $mapRep .= " <div id='map' style='width: 500px; height: 300px'></div>\n" . self::getMapScript($address, $zoom, $code->getLatitude(), $code->getLongitude(), $key) . " <script type='text/javascript'>\n" . " loadScript();\n" . " </script>\n"; } else { $mapRep .= "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'\n" . " 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>\n" . "<html xmlns='http://www.w3.org/1999/xhtml'>\n" . " <head>\n" . " <meta http-equiv='content-type' content='text/html; charset=utf-8'/>\n" . " <title>Google Maps JavaScript API Example</title>\n" . self::getMapScript($address, $zoom, $code->getLatitude(), $code->getLongitude(), $key) . " </head>\n" . " <body onload='loadScript()' onunload='GUnload()'>\n" . " <div id='map' style='width: 500px; height: 300px'></div>\n" . " </body>\n" . "</html>"; } $result = new RestResponse(); $result->setResponseBody($mapRep); return $result; }
public function connect() { $this->response = $this->req->sendRequest(); if (PEAR::isError($this->response)) { echo $this->response->getMessage(); die; } else { $this->responseBody = $this->req->getResponseBody(); } $response = new RestResponse(); $response->setResponseCode($this->req->getResponseCode()); $response->setResponseBody($this->req->getResponseBody()); return $response; }