コード例 #1
0
ファイル: runtime.php プロジェクト: RootStudio/Perch-Locator
/**
 * Display list of addresses near to location specified by ID
 *
 * @param       $id
 * @param array $opts
 * @param bool  $return
 *
 * @return void|array
 */
function root_locator_nearby($id, array $opts = [], $return = false)
{
    $API = new PerchAPI(1.0, 'root_locator');
    $Addresses = new RootLocator_Addresses($API);
    $Address = $Addresses->find((int) $id);
    $coordinates = false;
    if (is_object($Address)) {
        $coordinates = $Address->getCoordinates();
    }
    if ($coordinates) {
        if (isset($opts['address'])) {
            $opts['address'] = null;
        }
        $opts['coordinates'] = $coordinates;
        $opts['exclude'] = $id;
        if ($return) {
            root_locator_get_custom($opts, $return);
        }
        root_locator_get_custom($opts, $return);
    }
}
コード例 #2
0
ファイル: index.php プロジェクト: RootStudio/Perch-Locator
                            locations.forEach(function(address) {
                                var marker = new google.maps.Marker({
                                    position: new google.maps.LatLng(address.addressLatitude, address.addressLongitude),
                                    map: map,
                                    title: address.locationTitle
                                });

                                bounds.extend(marker.getPosition());
                            });
                        }

                        // Zoom to map to fit the markers on display
                        map.fitBounds(bounds);
                    }
                </script>

                <!-- This is *not* the key you use in the Perch settings area. You will need a Browser key -->
                <script src="https://maps.googleapis.com/maps/api/js?callback=initMap&key=XXXXXXXXXX" async defer></script>

                <?php 
    root_locator_get_custom(array('address' => perch_get('address'), 'range' => 50));
    ?>
            <?php 
}
?>
        </div>
    </body>
</html>

<?php 
PerchUtil::output_debug();