Ejemplo n.º 1
0
 /**
  * Get address from coord
  * @param type $latitude
  * @param type $longitude
  * @return type
  */
 private function _getAddressFromCoord($latitude, $longitude)
 {
     $googleService = new CServiceGoogle();
     $address = $googleService->getAddressFromCoords($latitude, $longitude);
     /* Do cleanup to remove no need data */
     $session = JFactory::getSession();
     $session->set('ccoords', $address);
     return $address;
 }
Ejemplo n.º 2
0
 /**
  * Return location data
  * @link https://developers.google.com/maps/documentation/geocoding/#JSON Google GeoCoding JSON
  * @param string $type
  * @return boolean
  */
 public function getLocation($type = 'formatted_address')
 {
     if ($this->get('location')) {
         return $this->get('location');
     } else {
         if ($this->get('latitude') != '255.000000' & $this->get('longitude') != '255.000000') {
             $googleService = new CServiceGoogle();
             $address = $googleService->getAddressFromCoords($this->get('latitude'), $this->get('longitude'));
             return $address->{$type};
         }
     }
     return false;
 }