Exemple #1
0
 function get_geodata()
 {
     if (!SecurityUtil::checkPermission('AddressBook::', "::", ACCESS_EDIT)) {
         AjaxUtil::error($this->__('Error! No authorization to access this module.'));
     }
     $val_1 = FormUtil::getPassedValue('val_1', NULL, 'GETPOST');
     $val_2 = FormUtil::getPassedValue('val_2', NULL, 'GETPOST');
     $val_3 = FormUtil::getPassedValue('val_3', NULL, 'GETPOST');
     $val_4 = FormUtil::getPassedValue('val_4', NULL, 'GETPOST');
     //GMaps test
     include_once 'modules/AddressBook/lib/vendor/GMaps/GoogleMapV3.php';
     $key = ModUtil::getVar('AddressBook', 'google_api_key');
     $map = new GoogleMapAPI();
     $map->setApiKey($key);
     $geocode = $map->getGeocode($val_1 . ', ' . $val_2 . ', ' . $val_3 . ', ' . $val_4);
     if (isset($geocode['lat']) && isset($geocode['lon'])) {
         $result = $geocode['lat'] . ',' . $geocode['lon'];
     } else {
         $result = '';
     }
     if (FormUtil::getPassedValue('plane', NULL, 'GETPOST')) {
         return $result;
     }
     return new Zikula_Response_Ajax(array('lat_lon' => $result, 'result' => $result ? true : false));
 }
 /**
  * Get lat lon by address
  * @author Oleg D.
  */
 function getLatLon($address, $updateAddress = 0)
 {
     $addressString = $city = $state = $country = '';
     if (!empty($address['address'])) {
         $addressString = $address['address'] . ' ' . $address['address2'] . ' ' . $address['address3'];
         if (!empty($address['city'])) {
             $city = $address['city'];
         }
         if (!empty($address['Country']['name'])) {
             $country = $address['Country']['name'];
         } elseif (!empty($address['country_name'])) {
             $country = $address['country_name'];
         }
         if (!empty($address['Provincestate']['name'])) {
             $state = $address['Provincestate']['name'];
         } elseif (!empty($address['state_name'])) {
             $state = $address['state_name'];
         }
         App::import('Vendor', 'GoogleMapAPI', array('file' => 'class.GoogleMapAPI.php'));
         $map = new GoogleMapAPI();
         $map->setAPIKey(GOOGLE_MAP_KEY);
         $latLon = $map->getCoordsByAddress(trim($addressString), $city, $state, $country);
         if ($updateAddress && !empty($address['id']) && !empty($latLon['lat']) && !empty($latLon['lon'])) {
             $Address = new Address();
             $Address->save(array('id' => $address['id'], 'latitude' => $latLon['lat'], 'longitude' => $latLon['lon']));
         }
         return $latLon;
     } else {
         return false;
     }
 }
function testMap()
{
    $MAP_OBJECT = new GoogleMapAPI();
    $MAP_OBJECT->_minify_js = isset($_REQUEST["min"]) ? FALSE : TRUE;
    $MAP_OBJECT->setDSN(${$wpdb}->get_results("SELECT * from wp_NBDonation where {$table} like '%{$input}%' and Type in('{$org}','Both');"));
    $MAP_OBJECT->addMarkerByCoords(-104.988, 39.755, "Marker Title", "Marker Description");
    $MAP_OBJECT->addMarkerByCoords(-118.243, 34.0522, "Marker2 Title", "Marker2 Description");
    ?>
<html>
<head>
<?php 
    echo $MAP_OBJECT->getHeaderJS();
    echo $MAP_OBJECT->getMapJS();
    ?>
</head>
<body>
<?php 
    echo $MAP_OBJECT->printOnLoad();
    echo $MAP_OBJECT->printMap();
    echo $MAP_OBJECT->printSidebar();
    ?>
</body>
</html>

<?php 
}
 protected function validate($data, $id = null)
 {
     $errors = parent::validate($data, $id);
     if (!array_key_exists('password', $errors) && array_key_exists('password', $data) && (array_key_exists('pass2', $data) && $data['password'] != $data['pass2'] || !array_key_exists('pass2', $data))) {
         $errors['password'] = lang('pass_dont_match');
     }
     if (!array_key_exists('city_id', $errors) && array_key_exists('city_id', $data)) {
         $gm = new GoogleMapAPI();
         $coords = $gm->geoPlaceCoords($data['city_id']);
         if (!$coords) {
             $errors['city_id'] = sprintf(lang('invalid_field'), ucfirst(lang('city_id')));
         }
     }
     return $errors;
 }
	public static function geocode($address = NULL)
	{
		if ($address)
		{
			$map_object = new GoogleMapAPI;
			//$map_object->_minify_js = isset($_REQUEST["min"]) ? FALSE : TRUE;
			$geocodes = $map_object->getGeoCode($address);
			//$geocodes = $MAP_OBJECT->geoGetCoordsFull($address);
			
			return $geocodes;
		}
		else
		{
			return false;
		}
	}
 /**
  * Get lat lon by address
  * 
  * modified by skinny....$state can be array('id'=>$id) and $country can be array('id'=>$id)
  * 
  * @author Oleg D.
  */
 function getLatLon($address = null, $city = null, $state = null, $country = null)
 {
     if (is_array($state)) {
         $stateid = $state['id'];
         $provinceState = $this->Provincestate->find('first', array('id' => $stateid));
         $state = $provinceState['Provincestate']['name'];
     }
     if (is_array($country)) {
         $countryid = $country['id'];
         $country = $this->Country->find('first', array('id' => $countryid));
         $country = $country['Country']['name'];
     }
     App::import('Vendor', 'GoogleMapAPI', array('file' => 'class.GoogleMapAPI.php'));
     $map = new GoogleMapAPI();
     $map->setAPIKey(GOOGLE_MAP_KEY);
     return $map->getCoordsByAddress($address, $city, $state, $country);
 }
 public function create_event($data)
 {
     $errors = $this->validate($data);
     if ($errors) {
         return ['errors' => $errors, 'data' => $data];
     }
     $info = $this->gm->geoPlaceInfo($data['place_id']);
     if (!$info) {
         $errors['place_id'] = sprintf(lang('invalid_field'), ucfirst(lang('place_id')));
         return ['errors' => $errors, 'data' => $data];
     } else {
         $data['place_info'] = json_encode(['name' => $info->result->name, 'address' => $info->result->formatted_address, 'icon' => $info->result->icon, 'phone' => $info->result->international_phone_number, 'website' => $info->result->website, 'rating' => $info->result->rating]);
         $data['lat'] = $info->result->geometry->location->lat;
         $data['lng'] = $info->result->geometry->location->lng;
     }
     $data['id'] = $this->add($data);
     $this->join_event($data['id'], $data['users_id']);
     return ['errors' => [], 'data' => $data];
 }
Exemple #8
0
 public function action_index2()
 {
     require_once Kohana::find_file('vendor', 'php-googlemap/GoogleMap', 'php');
     $this->before('/pages/maps');
     $this->template->title = __('Map');
     $height = Core::get('height', '100%');
     $width = Core::get('width', '100%');
     $map = new GoogleMapAPI();
     $map->setWidth($width);
     $map->setHeight($height);
     $map->disableSidebar();
     $map->setMapType('map');
     $map->setZoomLevel(Core::get('zoom', core::config('advertisement.map_zoom')));
     //$map->mobile = TRUE;
     $atributes = array("target='_blank'");
     if (core::get('controls') == 0) {
         $map->disableMapControls();
         $map->disableTypeControls();
         $map->disableScaleControl();
         $map->disableZoomEncompass();
         $map->disableStreetViewControls();
         $map->disableOverviewControl();
     }
     //only 1 marker
     if (core::get('address') != '') {
         $map->addMarkerByAddress(core::get('address'), core::get('address'));
     } else {
         //last ads, you can modify this value at: advertisement.feed_elements
         $ads = DB::select('a.seotitle')->select(array('c.seoname', 'category'), 'a.title', 'a.published', 'a.address')->from(array('ads', 'a'))->join(array('categories', 'c'), 'INNER')->on('a.id_category', '=', 'c.id_category')->where('a.status', '=', Model_Ad::STATUS_PUBLISHED)->where('a.address', 'IS NOT', NULL)->order_by('published', 'desc')->limit(Core::config('advertisement.map_elements'))->as_object()->cached()->execute();
         foreach ($ads as $a) {
             //d($a);
             if (strlen($a->address) > 3) {
                 $url = Route::url('ad', array('category' => $a->category, 'seotitle' => $a->seotitle));
                 $map->addMarkerByAddress($a->address, $a->title, HTML::anchor($url, $a->title, $atributes));
             }
         }
         //only center if not a single ad
         $map->setCenterCoords(Core::get('lon', core::config('advertisement.center_lon')), Core::get('lat', core::config('advertisement.center_lat')));
     }
     $this->template->map = $map;
 }
Exemple #9
0
 public static function geocode($address = NULL)
 {
     if ($address) {
         $coordinates = self::checkAndGetCoordinates($address);
         if ($coordinates) {
             $geocodes = array('country' => '', 'location_name' => '', 'latitude' => $coordinates['lat'], 'longitude' => $coordinates['lng']);
             return $geocodes;
         }
         $map_object = new GoogleMapAPI();
         $map_object->setLookupService("GOOGLE");
         $geocodes_full = $map_object->geoGetCoordsFull($address);
         // Verify that the request succeeded
         if (!isset($geocodes_full->status)) {
             return FALSE;
         }
         if ($geocodes_full->status != 'OK') {
             return FALSE;
         }
         // Convert the Geocoder's results to an array
         $all_components = json_decode(json_encode($geocodes_full->results), TRUE);
         $location = $all_components[0]['geometry']['location'];
         // Find the country
         $address_components = $all_components[0]['address_components'];
         $country_name = NULL;
         foreach ($address_components as $component) {
             if (in_array('country', $component['types'])) {
                 $country_name = $component['long_name'];
                 break;
             }
         }
         // If no country has been found, use the formatted address
         if (empty($country_name)) {
             $country_name = $all_components[0]['formatted_address'];
         }
         $geocodes = array('country' => $country_name, 'location_name' => $all_components[0]['formatted_address'], 'latitude' => $location['lat'], 'longitude' => $location['lng']);
         return $geocodes;
     } else {
         return FALSE;
     }
 }
Exemple #10
0
<?
require_once 'loginMySQL.php';
require('GoogleMapAPI.class.php');
require_once('BusDataStructure.php');
require_once('IndirectBusStructure.php');
require_once 'KLogger.php';
require_once 'DisplayJunctionsData.php';
//require('GoogleApiAdvancedClass.php');
//require('JSMin.php');
  
$map = new GoogleMapAPI('map');
// setup database for geocode caching
// $map->setDSN('mysql://*****:*****@localhost/GEOCODES');
// enter YOUR Google Map Key
//$map->setAPIKey('ABQIAAAA1c1sWAqiVfYVo2H2uZO3DRSWrvxHdeTKbGAggAmAoqEyMU0eFRSTrS7LnHnkyvA93YPmiuF_C-0r7Q');
// this is registered for mygann.com
$map->setAPIKey('ABQIAAAA1c1sWAqiVfYVo2H2uZO3DRQ-Owys87H0UMOnk1A622ubszpz9RQGCAfKKCtR4nC1ERddua80KFlgrA');
   
$log = new KLogger ( "log.txt" , KLogger::DEBUG );
// connect to the database
$db_server = mysql_connect($db_hostname, $db_username, $db_password);
if (!$db_server) die("Unable to connect to MYSQL: " . mysql_error());

mysql_select_db($db_database)
or die("Unable to select database: " . mysql_error());



// increase the time out to infinity default is 60
set_time_limit(0);   
Exemple #11
0
 public function viewpresentsAction()
 {
     $smarty = Zend_Registry::get('view');
     $request = $this->getRequest();
     $id = (int) $request->getParam('id', 0);
     if ($id > 0) {
         $model = $this->_getModel();
         $modelConfig = $this->_getModelConfig();
         $modelLanJoueur = $this->_getModelLanJoueur();
         $modelLanJeuxJoueurTeam = $this->_getModelLanJeuxJoueurTeam();
         $lan = $model->fetchEntryField($id, array('idLan', 'nom', 'adresse', 'ville', 'cp'));
         // API Google Map v3
         require '../library/My/GoogleMapAPI.class.php';
         $map = new GoogleMapAPI();
         $map->setMapType('ROADMAP');
         $map->setDivId('googlemap');
         // fixe les dimensions de la carte
         $map->setSize('830px', '500px');
         // definition du zoom automatique
         $map->setEnableAutomaticCenterZoom(true);
         if (true) {
             $villes = $modelLanJoueur->fetchEntriesVillePresents($id);
             foreach ($villes as $v) {
                 $joueurs = $modelLanJoueur->fetchEntriesByLanVillePresentsField($id, $v['ville'], array('idCompte', 'login', 'cp', 'ville', 'img'));
                 if (sizeof($joueurs) > 1) {
                     $logins = "";
                     foreach ($joueurs as $j) {
                         $logins .= $j['login'] . "<br/>";
                     }
                     // ajout d'un marqueur joueur sur la carte
                     $map->addMarkerByAddress($j['ville'] . ' ' . $j['cp'], "Joueurs", "<span class='rouge'><strong>{$j['ville']} ({$j['cp']})</strong></span><br/>{$logins}", "Joueurs de {$j['ville']}", $request->getBaseUrl() . '/images/comptes/thumb/no_logo.png');
                 } else {
                     // ajout d'un marqueur joueur sur la carte
                     $map->addMarkerByAddress($joueurs[0]['ville'] . ' ' . $joueurs[0]['cp'], $joueurs[0]['login'], "<span class='rouge'><strong>" . $joueurs[0]['login'] . "</strong></span><br/>" . $joueurs[0]['ville'] . " (" . $joueurs[0]['cp'] . ")", $joueurs[0]['login'], $request->getBaseUrl() . '/images/comptes/thumb/' . $joueurs[0]['img']);
                 }
             }
             // ajout du marqueur lan sur la carte
             $map->addMarkerByAddress($lan['adresse'] . ' ' . $lan['ville'] . ' ' . $lan['cp'], $lan['nom'], "<span class='rouge'><strong>{$lan['nom']}</strong></span><br/>{$lan['adresse']}<br/>{$lan['ville']} ({$lan['cp']})", $lan['nom'], $request->getBaseUrl() . '/images/admin/computer_gmap.png');
         }
         $joueurs = $modelLanJoueur->fetchEntriesByLanPresentField($id, array('idCompte', 'login', 'cp', 'ville', 'img', 'prenom', 'datenaissance'));
         $map->generate();
         $date = new Zend_Date();
         $smarty->assign('datedujour', $date->toString('YYYY-M-dd'));
         $smarty->assign('lan', $lan);
         $smarty->assign('base_url', $request->getBaseUrl());
         $smarty->assign('joueurs', $joueurs);
         $smarty->assign('map', $map);
         $smarty->assign('title', 'Pr&eacute;sents de la lan ' . $lan['nom']);
         $smarty->display('lan/viewinscrits.tpl');
     } else {
         return $this->_helper->redirector('index');
     }
 }
echo '<tr>';
echo '<th>';
echo "Bús";
echo '</th>';
echo '<th>';
echo "Localización";
echo '</th>';
echo '<th>';
echo "Ultima posición";
echo '</th>';
echo '</tr>';
echo '</thead>';
//parametros posiscion
include_once "php-google-map-api-master/releases/3.0/src/GoogleMap.php";
include_once "php-google-map-api-master/releases/3.0/src/JSMin.php";
$MAP_OBJECT = new GoogleMapAPI();
$MAP_OBJECT->_minify_js = isset($_REQUEST["min"]) ? FALSE : TRUE;
for ($i = 1; $i < count($vehi); $i++) {
    $vehiID = $orgVehi->GetVehiclesListResult->Vehicle[$i]->ID;
    $vehiDes = $orgVehi->GetVehiclesListResult->Vehicle[$i]->Description;
    $paramPosi = array("SpecificVehicleIDs" => array("short" => $vehiID));
    $orgposi = $client2->__soapCall('GetLatestPositionPerVehicle', array($paramPosi));
    //llamado al services posiciongps
    $posi1 = $orgposi->GetLatestPositionPerVehicleResult->GPSPosition->Latitude;
    $posi2 = $orgposi->GetLatestPositionPerVehicleResult->GPSPosition->Longitude;
    //llamado localizacion
    $paramlocal = array("Longitude" => $posi2, "Latitude" => $posi1);
    $orglocal = $client4->__soapCall('GetNearestLocation', array($paramlocal));
    $positime = $orgposi->GetLatestPositionPerVehicleResult->GPSPosition->Time;
    $date = new DateTime($positime);
    $location = $orglocal->GetNearestLocationResult->OriginLongitude;
Exemple #13
0
<?php
include_once("GoogleMap.php");
include_once("JSMin.php");

$MAP_OBJECT = new GoogleMapAPI(); $MAP_OBJECT->_minify_js = isset($_REQUEST["min"])?FALSE:TRUE;
?>
<html>
<head>
<?=$MAP_OBJECT->getHeaderJS();?>
<?=$MAP_OBJECT->getMapJS();?>
</head>
<body>
<?=$MAP_OBJECT->printOnLoad();?> 
<?=$MAP_OBJECT->printMap();?>
<?=$MAP_OBJECT->printSidebar();?>
</body>
</html>
<?php

// Load Elgg engine
include_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php";
echo '<link href="views/default/css.php" rel="stylesheet" type="text/css" />';
////////////////////////////////////////////////////////////
//////////////////////////map//////////////////////////////
///////////////////////////////////////////////////////////
require_once 'GoogleMapAPI-2.5/GoogleMapAPI.class.php';
$map = new GoogleMapAPI('map');
// setup database for geocode caching
$map->setDSN('mysql://elgg@localhost:81/elgg');
// enter YOUR Google Map Key
$map->setAPIKey('ABQIAAAAQNUInQTwgn5VDDyl8bOByxTn2aORatyZyU46qAvXBfOijvU79hSczO6cDTdYULHuwTIH54k9rc-_Ng');
// create some map markers
//$map->addMarkerByAddress("Kozani","Stathis","<b>Stathis</b><a href=\"http://metamorphosis.med.duth.gr/pg/profile/stathis\">Stathis Konstantinidis</a>","" );
//$map->addMarkerByAddress("GR","Nikolas","<b>Nikolas</b>","" );
//$map->addMarkerByAddress("Mallorca","S","<b>S</b>","" );
//$map->addMarkerByAddress("Stuttgardt","Germany","<b>Germany</b>","" );
///// Show repurposed objects for content_item (<-content item id)
$selected_c_i = $_GET['content_item'];
/*
 *		show_history_on_map($selected_c_i, $map);  -> Gia na deiksei ta repurposed antikeimena
 *		Gia na treksei http://metamorphosis.med.duth.gr/mod/content_item/show_map_content_item.php?content_item=1220
 *
 *		show_all_repurposed_content_items_on_map($map);  -> Gia na deiksei ola ta repurposed content items.
 *
 */
////////////
//show_history_on_map($selected_c_i, $map);
//show_all_repurposed_content_items_on_map($map);
<?php

// Load Elgg engine
include_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php";
echo '<link href="views/default/css.php" rel="stylesheet" type="text/css" />';
////////////////////////////////////////////////////////////
//////////////////////////map//////////////////////////////
///////////////////////////////////////////////////////////
require_once 'GoogleMapAPI-2.5/GoogleMapAPI.class.php';
$map = new GoogleMapAPI('map');
// setup database for geocode caching
$map->setDSN('mysql://elgg@localhost/');
// enter YOUR Google Map Key
$map->setAPIKey('ABQIAAAAQNUInQTwgn5VDDyl8bOByxSM5HRgLZx_FTvWflhOcXW1FpA9rhSc6ancYc0NEjrJi8yIkmEMFXzv5Q');
// create some map markers
//$map->addMarkerByAddress("Kozani","Stathis","<b>Stathis</b><a href=\"http://metamorphosis.med.duth.gr/pg/profile/stathis\">Stathis Konstantinidis</a>","" );
//$map->addMarkerByAddress("GR","Nikolas","<b>Nikolas</b>","" );
//$map->addMarkerByAddress("Mallorca","S","<b>S</b>","" );
//$map->addMarkerByAddress("Stuttgardt","Germany","<b>Germany</b>","" );
///// Show repurposed objects for content_item (<-content item id)
$selected_c_i = $_GET['content_item'];
/*
 *		show_history_on_map($selected_c_i, $map);  -> Gia na deiksei ta repurposed antikeimena
 *		Gia na treksei http://metamorphosis.med.duth.gr/mod/content_item/show_map_content_item.php?content_item=1220
 *
 *		show_all_repurposed_content_items_on_map($map);  -> Gia na deiksei ola ta repurposed content items.
 *
 */
////////////
//show_history_on_map($selected_c_i, $map);
show_all_repurposed_content_items_on_map($map);
<?php

include_once "releases/3.0/src/GoogleMap.php";
include_once "releases/3.0/src/JSMin.php";
$MAP_OBJECT = new GoogleMapAPI();
$MAP_OBJECT->_minify_js = isset($_REQUEST["min"]) ? FALSE : TRUE;
for ($i = 0; $i < 20; $i++) {
    $MAP_OBJECT->addMarkerByCoords(-74.12975, 4.570694, "Marker Title", "Marker Description");
}
?>
<html>
<head>
<?php 
echo $MAP_OBJECT->getHeaderJS();
echo $MAP_OBJECT->getMapJS();
?>
</head>
<body>
<?php 
echo $MAP_OBJECT->printOnLoad();
?>
 
<?php 
echo $MAP_OBJECT->printMap();
?>

</body>
</html>


    ?>
					<?php 
    echo $MAP_OBJECT->printOnLoad();
    ?>
					<?php 
    echo $MAP_OBJECT->printMap();
    ?>
					<?php 
    echo $MAP_OBJECT->printSidebar();
    ?>
					<?php 
} else {
    //display qatar's map by default
    include_once "GoogleMap.php";
    include_once "JSMin.php";
    $MAP_OBJECT = new GoogleMapAPI();
    $MAP_OBJECT->_minify_js = isset($_REQUEST["min"]) ? FALSE : TRUE;
    $MAP_OBJECT->addMarkerByAddress("Bin omran Doha, Qatar", "IOU head office", "IOU head Office,bin Omran Doha");
    ?>
				<?php 
    echo $MAP_OBJECT->getHeaderJS();
    ?>
				<?php 
    echo $MAP_OBJECT->getMapJS();
    ?>
				
				<?php 
    echo $MAP_OBJECT->printOnLoad();
    ?>
				<?php 
    echo $MAP_OBJECT->printMap();
Exemple #18
0
*  Contributors:
*  2006-07 Ed Davis
*
*
*  Copyright Contributors
*
*  ChurchInfo is free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  This file best viewed in a text editor with tabs stops set to 4 characters
*
******************************************************************************/
require 'GoogleMapAPI/GoogleMapAPI.class.php';
$googleMapObj = new GoogleMapAPI('map');
$googleMapObj->setAPIKey($sGoogleMapKey);
$bHaveXML = FALSE;
if ($sXML_RPC_PATH) {
    $pathArray = explode(PATH_SEPARATOR, get_include_path());
    foreach ($pathArray as $onePath) {
        $fullpath = $onePath . DIRECTORY_SEPARATOR . $sXML_RPC_PATH;
        if (file_exists($fullpath) && is_readable($fullpath)) {
            require_once "{$sXML_RPC_PATH}";
            $bHaveXML = TRUE;
        }
    }
    if ($bHaveXML == 0) {
        // Maybe the user entered absolute path, let's check
        if (file_exists($sXML_RPC_PATH) && is_readable($sXML_RPC_PATH)) {
            require_once "{$sXML_RPC_PATH}";
 function nbpl_nights()
 {
     $zip = '';
     $geocode = array();
     if (!empty($_REQUEST['zip'])) {
         $zip = trim($_REQUEST['zip']);
     }
     $ObjVenueView = ClassRegistry::init("VenueView");
     $conditions = array('VenueView.is_deleted' => 0, 'VenueView.nbpltype <> ' => 'None');
     $order = array('VenueView.id' => 'DESC');
     $fields = array('*');
     if (!empty($zip)) {
         App::import('Vendor', 'GoogleMapAPI', array('file' => 'class.GoogleMapAPI.php'));
         $map = new GoogleMapAPI();
         $map->setAPIKey(GOOGLE_MAP_KEY);
         $geocode = $map->geoGetCoords('UNITED STATES ' . $zip);
         if (!empty($geocode['lat']) && !empty($geocode['lon'])) {
             $fields[] = "(((acos(sin((" . $geocode['lat'] . " * pi()/180)) * sin((latitude*pi()/180)) + cos((" . $geocode['lat'] . " *pi()/180)) * cos((latitude * pi()/180)) \n\t\t\t\t* cos(((" . $geocode['lon'] . "- longitude)*pi()/180)))) * 180/pi()) * 60 *1.1515) as distance";
             $order = array('distance' => 'ASC') + $order;
         } else {
             $zip = '';
             $this->Session->setFlash('Incorrect Zip Code', 'flash_error');
         }
     }
     $venues = $ObjVenueView->find('all', array('fields' => $fields, 'contain' => array('Nbplday'), 'conditions' => $conditions, 'order' => $order));
     $this->set(compact('venues', 'zip', 'geocode'));
 }
Exemple #20
0
 public static function borough($lat, $lng)
 {
     $map_object = new GoogleMapAPI();
     $geocode_result = map::reverseGeocode($lat, $lng);
     return $map_object->parseBorough($geocode_result);
 }
/**
 * AddressBook
 *
 * @copyright (c) AddressBook Development Team
 * @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
 * @package AddressBook
 */
function smarty_function_AddressShowGmap($params, &$smarty)
{
    $dom = ZLanguage::getModuleDomain('AddressBook');
    $assign = isset($params['assign']) ? $params['assign'] : null;
    $directions = '';
    if (isset($params['directions'])) {
        $directions = '<a href="http://maps.google.com/maps?f=d&daddr=' . $params['lat_long'];
        if (isset($params['zoomlevel'])) {
            $directions .= '&z=' . $params['zoomlevel'];
        }
        $directions .= '" target="_blank">' . __('Get directions to this location', $dom) . '</a>';
    }
    if (!empty($directions)) {
        $directions = '<div>' . $directions . '</div>';
    }
    include_once 'modules/AddressBook/lib/vendor/GMaps/GoogleMapV3.php';
    $map_id = 'googlemap';
    if (isset($params['mapid'])) {
        $map_id .= $params['mapid'];
    }
    $app_id = 'ZikulaAddressBook';
    $map = new GoogleMapAPI($map_id, $app_id);
    if (isset($params['maptype'])) {
        $map->setMapType($params['maptype']);
        // hybrid, satellite, terrain, roadmap
    }
    if (isset($params['zoomlevel'])) {
        $map->setZoomLevel($params['zoomlevel']);
    }
    $map->setTypeControlsStyle('dropdown');
    $map->setWidth(isset($params['width']) && $params['width'] ? $params['width'] : '100%');
    $map->setHeight(isset($params['height']) && $params['height'] ? $params['height'] : '400px');
    // handle one (center) point
    if (isset($params['lat_long'])) {
        $arrLatLong = explode(',', $params['lat_long']);
        $map->setCenterCoords($arrLatLong[1], $arrLatLong[0]);
        $map->addMarkerByCoords($arrLatLong[1], $arrLatLong[0], $params['title'], $params['html'], $params['tooltip'], $params['icon'], $params['iconshadow']);
    }
    // API key
    if (isset($params['api_key'])) {
        $map->setApiKey($params['api_key']);
    }
    // handle array of points
    if (isset($params['points'])) {
        foreach ($params['points'] as $point) {
            $arrLatLong = explode(',', $point['lat_long']);
            $map->addMarkerByCoords($arrLatLong[1], $arrLatLong[0], $point['title'], $point['html'], $point['tooltip'], $point['icon'], $point['iconshadow']);
        }
    }
    // load the map
    $map->enableOnLoad();
    if ($assign) {
        $result = $map->getHeaderJS() . $map->getMapJS() . $directions . $map->printMap() . $map->printOnLoad();
        $smarty->assign($assign, $result);
    } else {
        PageUtil::addVar('rawtext', $map->getHeaderJS());
        PageUtil::addVar('rawtext', $map->getMapJS());
        return $directions . $map->printMap() . $map->printOnLoad();
    }
}
<?php

session_start();
include_once "php-google-map-api-master/releases/3.0/src/GoogleMap.php";
include_once "php-google-map-api-master/releases/3.0/src/JSMin.php";
require_once "consumopos.php";
$MAP_OBJECT = new GoogleMapAPI();
$MAP_OBJECT->_minify_js = isset($_REQUEST["min"]) ? FALSE : TRUE;
//$MAP_OBJECT->setDSN("mysql://*****:*****@localhost/db_name");
$MAP_OBJECT->addMarkerByCoords($posi1, $posi2, "Marker Title", "Marker Description");
?>
<html>
<head>
<?php 
echo $MAP_OBJECT->getHeaderJS();
echo $MAP_OBJECT->getMapJS();
?>
</head>
<body>
<?php 
echo $MAP_OBJECT->printOnLoad();
?>
 
<?php 
echo $MAP_OBJECT->printMap();
echo $MAP_OBJECT->printSidebar();
?>
</body>
</html>
Exemple #23
0
/**
 * Output the google map
 *
 * @param string $text text for the "toggle" link that shows/hides the map. Set empty to omit
 * @param string $id used to set the IDs for the toggle href element ($id_toggle) and the map element ($id_data)
 * @param string $hide initial map state: "hide", "show", or "colrobox"
 * @param object $obj optional image/album object. Pass string for generic map and use callback to set points
 * @param function $callback optional callback function to set map options.
 */
function printGoogleMap($text = NULL, $id = NULL, $hide = NULL, $obj = NULL, $callback = NULL)
{
    global $_zp_current_album, $_zp_current_image;
    if (is_null($obj)) {
        if (is_null($_zp_current_image)) {
            $obj = $_zp_current_album;
        } else {
            $obj = $_zp_current_image;
        }
    }
    if (is_null($obj)) {
        $MAP_OBJECT = NULL;
        return false;
    }
    if (is_object($obj)) {
        $type = $obj->table;
        $typeid = $obj->getID();
    } else {
        $type = $obj;
        $typeid = '';
    }
    if (is_null($text)) {
        $text = gettext('Google Map');
    }
    if (empty($text)) {
        $hide = 'show';
    }
    if (is_null($hide)) {
        $hide = getOption('gmap_display');
    }
    if (!is_string($hide)) {
        if ($hide) {
            $hide = 'hide';
        } else {
            $hide = 'show';
        }
    }
    $MAP_OBJECT = new GoogleMapAPI($type . $typeid);
    $MAP_OBJECT->_minify_js = defined('RELEASE');
    $MAP_OBJECT->setZoomLevel(getOption('gmap_zoom'));
    $MAP_OBJECT->setWidth(getOption('gmap_width'));
    $MAP_OBJECT->setHeight(getOption('gmap_height'));
    $MAP_OBJECT->setMapType(getOption('gmap_starting_map'));
    $mapcontrol = getOption('gmap_control');
    if ($mapcontrol == 'none') {
        $MAP_OBJECT->disableTypeControls();
    } else {
        $MAP_OBJECT->enableMapControls();
        $MAP_OBJECT->setTypeControlsStyle($mapcontrol);
        $MAP_OBJECT->setControlSize(getOption('gmap_control_size'));
        $mapsallowed = array();
        if (getOption('gmap_map')) {
            $mapsallowed[] = 'ROADMAP';
        }
        if (getOption('gmap_hybrid')) {
            $mapsallowed[] = 'HYBRID';
        }
        if (getOption('gmap_satellite')) {
            $mapsallowed[] = 'SATELLITE';
        }
        if (getOption('gmap_terrain')) {
            $mapsallowed[] = 'TERRAIN';
        }
        $MAP_OBJECT->setTypeControlTypes($mapsallowed);
    }
    switch ($type) {
        case 'images':
            if (getImageGeodata($obj, $MAP_OBJECT)) {
                break;
            }
            $MAP_OBJECT = NULL;
            return false;
        case 'albums':
            if (getAlbumGeodata($obj, $MAP_OBJECT)) {
                break;
            }
            $MAP_OBJECT = NULL;
            return false;
        default:
            break;
    }
    $type = $type . $typeid . '_';
    if (is_null($id)) {
        $id = $type . 'googlemap';
    }
    $id_toggle = $id . '_toggle';
    $id_data = $id . '_data';
    if (!is_null($callback)) {
        call_user_func($callback, $MAP_OBJECT);
    }
    echo $MAP_OBJECT->getMapJS();
    switch ($hide) {
        case 'colorbox':
            $w = str_replace('px', '', $MAP_OBJECT->width) + 20;
            $h = str_replace('px', '', $MAP_OBJECT->height) + 20;
            if (function_exists('bzcompress')) {
                $method = 'bzip2';
                $data = bzcompress(serialize($MAP_OBJECT));
            } else {
                $method = 'gzip';
                $data = gzcompress(serialize($MAP_OBJECT));
            }
            $param = base64_encode($data);
            ?>
			<a href="javascript:<?php 
            echo $id_data;
            ?>
Colorbox();" title="<?php 
            echo $text;
            ?>
" class="google_map">
				<?php 
            echo $text;
            ?>
			</a>
			<div id="<?php 
            echo $id_data;
            ?>
" class="hidden_map">
				<div id="<?php 
            echo $id_data;
            ?>
_map">
					<?php 
            echo $MAP_OBJECT->printOnLoad();
            echo $MAP_OBJECT->printMap();
            ?>
				</div>
			</div>
			<script type="text/javascript">
				// <!-- <![CDATA[
				function <?php 
            echo $id_data;
            ?>
Colorbox() {
					$('#<?php 
            echo $id_data;
            ?>
').removeClass('hidden_map');
					$.colorbox({href:"#<?php 
            echo $id_data;
            ?>
_map", inline:true, open:true});
					$('#<?php 
            echo $id_data;
            ?>
').addClass('hidden_map');
				}
				$(document).ready(function(){
					$("#<?php 
            echo $id_data;
            ?>
_map").colorbox({iframe:true, innerWidth:'<?php 
            echo $w;
            ?>
px', innerHeight:'<?php 
            echo $h;
            ?>
px'});
				});
				// ]]> -->
			</script>
			<?php 
            break;
        case 'hide':
            ?>
			<script type="text/javascript">
				// <!-- <![CDATA[
				function toggle_<?php 
            echo $id_data;
            ?>
() {
					if ($('#<?php 
            echo $id_data;
            ?>
').hasClass('hidden_map')) {
						$('#<?php 
            echo $id_data;
            ?>
').removeClass('hidden_map');
					} else {
						$('#<?php 
            echo $id_data;
            ?>
').addClass('hidden_map');
					}
				}
				// ]]> -->
			</script>
			<a id="<?php 
            echo $id_toggle;
            ?>
" href="javascript:toggle_<?php 
            echo $id_data;
            ?>
();" title="<?php 
            echo gettext('Display or hide the Google Map.');
            ?>
">
				<?php 
            echo $text;
            ?>
			</a>
			<div id="<?php 
            echo $id_data;
            ?>
" class="hidden_map">
				<?php 
            echo $MAP_OBJECT->printOnLoad();
            echo $MAP_OBJECT->printMap();
            ?>
			</div>
			<?php 
            break;
        case 'show':
            ?>
			<a id="<?php 
            echo $id_toggle;
            ?>
" href="javascript:toggleMap('<?php 
            echo $id_data;
            ?>
');" title="<?php 
            echo gettext('Display or hide the Google Map.');
            ?>
">
				<?php 
            echo $text;
            ?>
			</a>
			<div id="<?php 
            echo $id_data;
            ?>
">
				<?php 
            echo $MAP_OBJECT->printOnLoad();
            echo $MAP_OBJECT->printMap();
            ?>
			</div>
			<?php 
            break;
    }
}
Exemple #24
0
<?php

require_once 'header_php.php';
?>

<?php 
$map = new GoogleMapAPI('map');
$map->setAPIKey($googlemaps_key);
$map->disableSidebar();
$map->setMapType('map');
$map->setWidth(450);
$map->setHeight(350);
$map->addMarkerByAddress('5186-F Longs Peak Road Berthoud Colorado 80513', '', 'Colorado Water Jet<br>5186-F Longs Peak Road<br>Berthoud, Colorado 80513');
?>


<?php 
include 'header.php';
?>


<table>
<tr valign='middle'><td>
<table>
<tr valign='top'><td>Address:</td><td>Colorado Water Jet<br>5186-F Longs Peak Road<br>Berthoud, Colorado 80513<br>&nbsp;</td></tr>
<tr><td>Phone:</td><td>970.532.5404</td></tr>
<tr><td>Toll Free:</td><td>866.532.5404</td></tr>
<tr><td>Fax:</td><td>970.532.5405</td></tr>
</table>
</td><td><?php 
$map->printMap();
<?php

require_once 'loginDetailsV2.php';
require 'GoogleMapAPI.class.php';
require_once 'BusDataStructure.php';
require_once 'IndirectBusStructure.php';
require_once 'IndirectBusStructureWithFrequency.php';
require_once 'KLogger.php';
require_once 'DisplayJunctionsDataV2.php';
require_once 'DisplaySortedJunctionData.php';
//require('GoogleApiAdvancedClass.php');
//require('JSMin.php');
set_time_limit(60);
//$DEBUG=false;
$map = new GoogleMapAPI('map');
// setup database for geocode caching
// $map->setDSN('mysql://*****:*****@localhost/GEOCODES');
// enter YOUR Google Map Key
//$map->setAPIKey('ABQIAAAA1c1sWAqiVfYVo2H2uZO3DRSWrvxHdeTKbGAggAmAoqEyMU0eFRSTrS7LnHnkyvA93YPmiuF_C-0r7Q');
// this is registered for mygann.com
// new key ABQIAAAA1c1sWAqiVfYVo2H2uZO3DRSdbZxIVjTSMKDiD-iCCeLYxJJn_BTfNn4DtNyckPujCTOcXysH3Glq9g
$map->setAPIKey('ABQIAAAA1c1sWAqiVfYVo2H2uZO3DRSdbZxIVjTSMKDiD-iCCeLYxJJn_BTfNn4DtNyckPujCTOcXysH3Glq9g');
$log = new KLogger("log.txt", KLogger::DEBUG);
// connect to the database
$db_server = mysql_connect($db_hostname, $db_username, $db_password);
if (!$db_server) {
    die("Unable to connect to MYSQL: " . mysql_error());
}
mysql_select_db($db_database) or die("Unable to select database: " . mysql_error());
//$DEBUG=true;
// increase the time out to infinity default is 60
Exemple #26
0
<!--<?php 
require_once 'header_php.php';
?>
-->

<?php 
$map = new GoogleMapAPI('map');
$map->setAPIKey($googlemaps_key);
$map->disableSidebar();
$map->setMapType('map');
$map->setWidth(510);
$map->setHeight(350);
$map->setMapType('hybrid');
$map->disableDirections();
$map->setZoomLevel(13);
//$map->addMarkerByAddress('5186-F Longs Peak Road Berthoud Colorado 80513','','Colorado Water Jet<br>5186-F Longs Peak Road<br>Berthoud, Colorado 80513');
$map->addMarkerByCoords(-104.98301267623901, 40.34088546651259, '', 'Colorado Water Jet<br>5186 Longs Peak Road Unit F<br>Berthoud, Colorado 80513');
?>


<?php 
include 'header.php';
?>




<table align="center" border="0" cellpadding="0" cellspacing="0">
<tr valign='top'><td rowspan='3'>Colorado WaterJet<br>5186 Longs Peak Road Unit F<br>Berthoud, Colorado 80513</td><td rowspan='3'><img src="/images/clear.gif" height="1" width="60"></td>
<td>970-532-5404</td></tr>
<tr><td><a href="mailto:sales@coloradowaterjet.com">sales@coloradowaterjet.com</a></td></tr>
<?php

include_once "releases/3.0/src/GoogleMap.php";
include_once "releases/3.0/src/JSMin.php";
$MAP_OBJECT = new GoogleMapAPI();
$MAP_OBJECT->_minify_js = isset($_REQUEST["min"]) ? FALSE : TRUE;
//$MAP_OBJECT->setDSN("mysql://*****:*****@localhost/db_name");
$MAP_OBJECT->addMarkerByCoords(-74.12975, 4.570694, "Marker Title", "Marker Description");
$MAP_OBJECT->addMarkerByCoords(-74.0831146, 4.737278, "Marker Title", "Marker Description");
$MAP_OBJECT->addMarkerByCoords(-74.12975, 4.570694, "Marker Title", "Marker Description");
$MAP_OBJECT->addMarkerByCoords(-74.12033, 4.533722, "Marker Title", "Marker Description");
$MAP_OBJECT->addMarkerByCoords(-74.12018999999999, 4.533611, "Marker Title", "Marker Description");
$MAP_OBJECT->addMarkerByCoords(-74.0765, 4.608278, "Marker Title", "Marker Description");
$MAP_OBJECT->addMarkerByCoords(-74.12536, 4.564445, "Marker Title", "Marker Description");
$MAP_OBJECT->addMarkerByCoords(-74.11136, 4.707167, "Marker Title", "Marker Description");
$MAP_OBJECT->addMarkerByCoords(-74.06231, 4.656667, "Marker Title", "Marker Description");
$MAP_OBJECT->addMarkerByCoords(-74.09294, 4.5875, "Marker Title", "Marker Description");
$MAP_OBJECT->addMarkerByCoords(-74.06628000000001, 4.639833, "Marker Title", "Marker Description");
$MAP_OBJECT->addMarkerByCoords(-74.12011, 4.528861, "Marker Title", "Marker Description");
$MAP_OBJECT->addMarkerByCoords(-74.1204147, 4.529778, "Marker Title", "Marker Description");
$MAP_OBJECT->addMarkerByCoords(-74.0497742, 4.761222, "Marker Title", "Marker Description");
$MAP_OBJECT->addMarkerByCoords(-74.06602479999999, 4.641917, "Marker Title", "Marker Description");
$MAP_OBJECT->addMarkerByCoords(-74.09263610000001, 4.746305, "Marker Title", "Marker Description");
$MAP_OBJECT->addMarkerByCoords(-74.09272, 4.746305, "Marker Title", "Marker Description");
$MAP_OBJECT->addMarkerByCoords(-74.04608, 4.755778, "Marker Title", "Marker Description");
$MAP_OBJECT->addMarkerByCoords(-74.04594419999999, 4.75425, "Marker Title", "Marker Description");
$MAP_OBJECT->addMarkerByCoords(-74.06936, 4.622583, "Marker Title", "Marker Description");
$MAP_OBJECT->addMarkerByCoords(-74.092804, 4.7465, "Marker Title", "Marker Description");
$MAP_OBJECT->addMarkerByCoords(-74.08583, 4.597472, "Marker Title", "Marker Description");
$MAP_OBJECT->addMarkerByCoords(-74.15011, 4.522861, "Marker Title", "Marker Description");
$MAP_OBJECT->addMarkerByCoords(-74.1204147, 4.5225778, "Marker Title", "Marker Description");
<?php

//http://www.bradwedell.com/php-google-maps-api
error_reporting(E_ALL ^ E_NOTICE);
require_once "../include/GoogleApi/GoogleMap.php";
require_once "../include/GoogleApi/JSMin.php";
$gmap = new GoogleMapAPI();
$gmap->setWidth('100%');
$gmap->setHeight('90%');