コード例 #1
0
ファイル: MapUsingGoogle.php プロジェクト: dschwen/CRM
$sSQL = "SELECT cfg_name, IFNULL(cfg_value, cfg_default) AS value FROM config_cfg WHERE cfg_section='ChurchInfoReport'";
$rsConfig = mysql_query($sSQL);
// Can't use RunQuery -- not defined yet
if ($rsConfig) {
    while (list($cfg_name, $cfg_value) = mysql_fetch_row($rsConfig)) {
        ${$cfg_name} = $cfg_value;
    }
}
if ($nChurchLatitude == 0 || $nChurchLongitude == 0) {
    require "Include/GeoCoder.php";
    $myAddressLatLon = new AddressLatLon();
    // Try to look up the church address to center the map.
    $myAddressLatLon->SetAddress($sChurchAddress, $sChurchCity, $sChurchState, $sChurchZip);
    $ret = $myAddressLatLon->Lookup();
    if ($ret == 0) {
        $nChurchLatitude = $myAddressLatLon->GetLat();
        $nChurchLongitude = $myAddressLatLon->GetLon();
        $sSQL = "UPDATE config_cfg SET cfg_value='" . $nChurchLatitude . "' WHERE cfg_name=\"nChurchLatitude\"";
        RunQuery($sSQL);
        $sSQL = "UPDATE config_cfg SET cfg_value='" . $nChurchLongitude . "' WHERE cfg_name=\"nChurchLongitude\"";
        RunQuery($sSQL);
    }
}
?>

   <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?<?php 
echo $sGoogleMapKey ? "key={$sGoogleMapKey}&" : "";
?>
sensor=false"></script>
   <div>
    <div id="map" style="width: 800px; height: 600px; float:left;"></div>
コード例 #2
0
ファイル: FamilyEditor.php プロジェクト: dschwen/CRM
 $bSendNewsLetter = isset($_POST["SendNewsLetter"]);
 $nLatitude = 0.0;
 $nLongitude = 0.0;
 if (array_key_exists("Latitude", $_POST)) {
     $nLatitude = FilterInput($_POST["Latitude"], "float");
 }
 if (array_key_exists("Longitude", $_POST)) {
     $nLongitude = FilterInput($_POST["Longitude"], "float");
 }
 //	if ($bHaveXML) {
 // Try to get Lat/Lon based on the address
 $myAddressLatLon = new AddressLatLon();
 $myAddressLatLon->SetAddress($sAddress1, $sCity, $sState, $sZip);
 $ret = $myAddressLatLon->Lookup();
 if ($ret == 0) {
     $nLatitude = $myAddressLatLon->GetLat();
     $nLongitude = $myAddressLatLon->GetLon();
 } else {
     $nLatitude = "NULL";
     $nLongitude = "NULL";
 }
 //	}
 if (is_numeric($nLatitude)) {
     $nLatitude = "'" . $nLatitude . "'";
 } else {
     $nLatitude = "NULL";
 }
 if (is_numeric($nLongitude)) {
     $nLongitude = "'" . $nLongitude . "'";
 } else {
     $nLongitude = "NULL";
コード例 #3
0
ファイル: UpdateAllLatLon.php プロジェクト: jwigal/emcommdb
<?php

require "Include/Config.php";
require "Include/Functions.php";
require "Include/GeoCoder.php";
require "Include/Header.php";
$sSQL = "SELECT fam_ID, fam_Name, fam_Address1, fam_City, fam_State, fam_Zip from family_fam";
$rsFamilies = RunQuery($sSQL);
$myAddressLatLon = new AddressLatLon();
while ($aFam = mysql_fetch_array($rsFamilies)) {
    extract($aFam);
    $myAddressLatLon->SetAddress($fam_Address1, $fam_City, $fam_State, $fam_Zip);
    $ret = $myAddressLatLon->Lookup();
    if ($ret == 0) {
        echo "<p>" . $fam_Name, " Latitude " . $myAddressLatLon->GetLat() . " Longitude " . $myAddressLatLon->GetLon() . "</p>";
        $sSQL = "UPDATE family_fam SET fam_Latitude='" . $myAddressLatLon->GetLat() . "',fam_Longitude='" . $myAddressLatLon->GetLon() . "' WHERE fam_ID=" . $fam_ID;
        RunQuery($sSQL);
    } else {
        echo "<p>" . $fam_Name . ": " . $myAddressLatLon->GetError() . "</p>";
    }
    flush();
    ob_flush();
}