results[0]->geometry->location->lat; $long = $output->results[0]->geometry->location->lng; $return = array(); $return[0]->lat = $lat; $return[0]->long = $long; return $return; } /** * Check curl existing * * @return unknown */ function _iscurlinstalled() { if (in_array ('curl', get_loaded_extensions())) { return true; } else{ return false; } } /** * Load Google Map * * @param unknown_type $geocode */ function loadGoogleMap($geocode,$mapdiv,$maptype){ global $configClass; switch ($maptype){ case "agent": case "company": $icon = "workoffice.png"; break; default: $icon = "house.png"; break; } if(count($geocode) == 1){ $lat = $geocode[0]->lat; $long = $geocode[0]->long; }else{ $lat = $geocode[0]->lat; $long = $geocode[0]->long; } if (!isset($configClass['goole_map_overlay'])) $configClass['goole_map_overlay'] = 'ROADMAP'; ?> lat; $long = $rows[0]->long; }else{ $lat = $rows[0]->lat; $long = $rows[0]->long; } } if (!isset($configClass['goole_map_overlay'])) $configClass['goole_map_overlay'] = 'ROADMAP'; ?> address != ""){ $address .= $row->address; } if($row->city != ""){ $address .= " ".$row->city; } if($row->state != ""){ $db->setQuery("Select state_name from #__osrs_states where id = '$state'"); $state_name = $db->loadResult(); $address .= " ".$state_name; $db->setQuery("Select country_id from #__osrs_states where id = '$state'"); $country_id = $db->loadResult(); $db->setQuery("Select country_name from #__osrs_countries where id = '$country_id'"); $country_name = $db->loadResult(); $address .= " ".$country_name; } $address = trim($address); } $url = "http://maps.googleapis.com/maps/api/geocode/json?address=".urlencode($address)."&sensor=false"; if(HelperOspropertyGoogleMap::_iscurlinstalled()){ $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 0); $return_data = curl_exec($ch); curl_close($ch); }else{ $return_data = file_get_contents($url) or die("url not loading"); } $return_data = json_decode($return_data); $return_location = $return_data->results; $return = array(); if($return_data->status == "OK"){ $return[0] = $return_location[0]->geometry->location->lat; $return[1] = $return_location[0]->geometry->location->lng; $return[2] = $return_data->status; } return $return; } /** * Load Street View Map * * @param unknown_type $geocode * @param unknown_type $divname */ function loadStreetViewMap($geocode,$divname){ global $mainframe; $lat = $geocode[0]->lat; $long = $geocode[0]->long; ?>
0){ $db->setQuery("Select state_name from #__osrs_states where id = '$state_id'"); $state_name = $db->loadResult(); $db->setQuery("Select country_id from #__osrs_states where id = '$state_id'"); $country_id = $db->loadResult(); $db->setQuery("Select country_name from #__osrs_countries where id = '$country_id'"); $country_name = $db->loadResult(); } if($city_id > 0){ $db->setQuery("Select city from #__osrs_cities where id = '$city_id'"); $city_name = $db->loadResult(); } if(($city_name != "") or ($state_name != "")){ $address = ""; if($city_name != ""){ $address = $city_name; } if($state_name != ""){ $address .= " ".$state_name; } if($country_name != ""){ $address .= " ".$country_name; } $url = "http://maps.googleapis.com/maps/api/geocode/json?address=".urlencode($address)."&sensor=false"; if(HelperOspropertyGoogleMap::_iscurlinstalled()){ $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 0); $return_data = curl_exec($ch); curl_close($ch); }else{ $return_data = file_get_contents($url) or die("url not loading"); } $return_data = json_decode($return_data); $return_location = $return_data->results; $return = array(); if($return_data->status == "OK"){ $default_lat = $return_location[0]->geometry->location->lat; $default_long = $return_location[0]->geometry->location->lng; } }else{ $default_lat = $configClass['goole_default_lat']; $default_long = $configClass['goole_default_long']; } ?>