コード例 #1
0
 function makeMenuLink(&$contact, $address_id, &$nav)
 {
     global $php_ext, $db_link;
     // this is just a copy of the code from address.php
     $add = $contact->getValueGroup('addresses');
     foreach ($add as $a) {
         if ($a['refid'] == $address_id) {
             $add = $a;
             break;
         }
     }
     $address_country = $a['country'];
     $gm = new GoogleMapsLink();
     // display link only if we have lat/long or a valid geocoder
     if ($gm->canMap($address_country)) {
         // || isset($address_latitude) && $gm->canMap($address_country))
         $nav->addEntry('plugin.Map', 'map', "../plugins/Map/Map.display.php?id={$address_id}&cid={$contact->contact['id']}");
     }
 }
コード例 #2
0
if (isset($_GET['id'])) {
    $address_id = StringHelper::cleanGPC($_GET['id']);
}
if (isset($_GET['cid'])) {
    $contact = Contact::newContact(intval(StringHelper::cleanGPC($_GET['cid'])));
}
// use for the google-bubble?
// search correct address in value group ... not very efficient
$adds = $contact->getValueGroup('addresses');
foreach ($adds as $a) {
    if ($a['refid'] == $address_id) {
        $add =& $a;
        break;
    }
}
if (!isset($add)) {
    $errorHandler->error('argVal', 'The address with id=' . $address_id . ' does not exist');
}
$errorMessage = 'Unable to map this address. The address may not be included in any geocoder currently available here, or it is simply misspelled. Sorry!';
// Cache Geocode ... currently not available, needs API key
/* if(empty($add['latitude'])) {} */
// Load GoogleMaps
require_once 'plugins/Map/Map.GoogleMaps.php';
$gm = new GoogleMapsLink();
if ($gm->showMap($add)) {
    // returns true if successful display (will use lat/long if avail)
    exit;
}
// Not successful ... use other vendor to display?
$ct = $add['country'];
$errorHandler->error('invArg', $errorMessage);