Support » Plugins and Hacks » [Plugin: CGM Event Calendar] Google map

[Plugin: CGM Event Calendar] Google map

Viewing 1 replies (of 1 total)
  • This is from a text file I have, more notes to self.

    Hope it helps.


    Of course I had to add the gmap column to the DB but that’s pretty straight forward.

    I changed the location section on the page display to:

    if (isset($entry['location']) && $entry['location'] != '') {
    				echo '<p><strong>'.__('Location', 'cgm_event_calendar').'</strong><br />';
    				echo $entry['location'];
    			if (isset($entry['gmap']) && $entry['gmap'] != '') {
    				echo ' | <small><a href="'.$entry['gmap'].'" target="_blank">View Map</a></small>';
    			if (isset($entry['location']) && $entry['location'] != '') {
    				echo '</p>';

    I added this hook to the very end:

    // tugbucket gmap addition
    	add_action('admin_footer', 'gmap_functionality');
    	function gmap_functionality(){

    below is the gmap.php:

    <?php echo "\n\n"; ?>
    <!-- tugbucket gmap function -->
    <script src="http://maps.google.com/maps?file=api&v=2&key=" type="text/javascript"></script>
    <script src="http://www.google.com/uds/api?file=uds.js&v=1.0" type="text/javascript"></script>
    <script src="http://www.google.com/uds/solutions/localsearch/gmlocalsearch.js" type="text/javascript"></script>
    <style type="text/css">
    @import url("http://www.google.com/uds/css/gsearch.css");
    @import url("http://www.google.com/uds/solutions/localsearch/gmlocalsearch.css");
    .gmls-more-results, .gmls-result-wrapper .gs-result .gs-directions-to-from { display: none; }
    <div id="gmapHolder" style="border: 1px solid #000; background: #fff; width: 750px; position: absolute; z-index: 9999; top: -700px; left: 50%; margin-left: -376px;">
    <div id="map_canvas" style="width: 750px; height: 470px;"></div>
        <p style="text-align: center; padding: 2px 0 10px 0;">If the location in the bubble above is correct <a href="#x" id="linkGetter" onclick="return false;">click here</a>. You may aslo <a href="#x" id="linkGetterCancel" onclick="return false;">cancel the map</a>.</p>
    <script type="text/javascript">
    jQuery(document).ready(function() {
    	var mapLink = "<a href='#x' id='gmapCreate' onclick='return false;'><img src='<?php echo get_bloginfo('siteurl')?>/wp-content/plugins/cgm-event-calendar/images/gmap.gif' border='0' width='30' height='24' /></a><input type='hidden' name='gmapURL' id='gmapURL' />";
    	jQuery("#gmapCreate").live("click", function(){
    		jQuery("#gmapHolder").animate({top: "40"}, 1000);
    		gmapLinkValue = jQuery('#gmapHolder #map_canvas a.gs-title').attr('href');
    		jQuery("input#gmapURL").val(gmapLinkValue.replace("/place", ""));
    		jQuery("#gmapHolder").animate({top: "-700"}, 1000);
    			jQuery(".mapAdded").text("Map Updated!");
    		} else {
    			jQuery("#entry_location").parent("td").append("<span class='mapAdded'> Map Added!</span>");
    		jQuery("#gmapHolder").animate({top: "-700"}, 1000);
    function initialize() {
      if (GBrowserIsCompatible()) {
        // Create and Center a Map
        var map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(35.14, -89.95), 11);
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        // bind a search control to the map, suppress result list
        map.addControl(new google.maps.LocalSearch(), new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,20)));
    <?php echo "\n\n"; ?>

    The manual additon is the starting point:

    map.setCenter(new GLatLng(35.14, -89.95), 11);

    Since I am in Memphis and the site I am using this on is based in Memphis as well, the lat/lon is hardcoded for Memphis.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: CGM Event Calendar] Google map’ is closed to new replies.