Adding the mapicon active to members
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 15 Jul 2013 17:22:38 +0000 (17:22 +0000)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 15 Jul 2013 17:22:38 +0000 (17:22 +0000)
Turning on the mapicon active. If they click on the map icon then it
will go up to the map.

Toolkit/Members/SearchList.php
Toolkit/Members/config.ini
Toolkit/Members/libjs/google-map.js
Toolkit/Members/memberDBGoogleMap.php

index 70e6d3d..f7fabe2 100644 (file)
@@ -755,11 +755,16 @@ class Toolkit_Members_SearchList extends Toolkit_FlexyDataGridBuilder
         */
        public function mapIcon($data)
        {
+        static $currentRecordNumber = 1;
         $searchResultNumbered =& $this->config
             ->getItem('section', 'conf')
             ->getItem('directive', 'searchResultNumbered')
             ->getContent();
                extract($data['record']);
+        if (!$lat || !$lon) {
+            return false;
+        }
+
         if ($searchResultNumbered && $this->memberMap) {
             $format = BASE_URL . 'map/5680FC/%s.png';
         }
@@ -767,15 +772,15 @@ class Toolkit_Members_SearchList extends Toolkit_FlexyDataGridBuilder
                if (empty($format)) {
                        return false;
                }
-        $currentRecordNumber
-            = $data['currRow'] + $this->getCurrentRecordNumberStart();
-               return array(
+               $html = array(
             'id' => $currentRecordNumber - 1,
             'icon'   => sprintf(
                 $format,
                 $currentRecordNumber
             )
                );
+        ++$currentRecordNumber;
+        return $html;
        }
 
        //      }}}
index 0559739..9755482 100644 (file)
@@ -29,7 +29,7 @@ glmReservations = Off
 ; to use map numbers for search results
 searchResultNumbered = On
 ; turn on to have the member icon click to go up to the member location on map
-searchMapIconActive = Off
+searchMapIconActive = On
 
 [add your business]
 approvalNeeded = Off
@@ -103,4 +103,4 @@ contacts = Off
 ; show billing module
 billing = Off
 ; the rest of the billing module config setting are in
-; Toolkit/Members/Billing/config.ini
\ No newline at end of file
+; Toolkit/Members/Billing/config.ini
index 292f33e..e52984a 100644 (file)
@@ -21,11 +21,26 @@ var Map = {
                Map._infoWindow = new google.maps.InfoWindow;
 
                $.get("member-db-google-map/"+location.search, Map._loadData, 'xml');
+        if (typeof glm_searchMapIconActive != 'undefined' && glm_searchMapIconActive) {
+            $(".map-link").live('click', function(e){
+                e.preventDefault();
+
+                var linkId = $(this).attr("rel");
+                console.log(linkId);
+                new google.maps.event.trigger(Map.arrMarkers[linkId], 'click');
+
+                Map._map.setZoom(14);
+                myAnchor = '#map-canvas';
+                window.location = String(window.location).replace(/\#.*$/, "") + myAnchor;
+                return false;
+            });
+        }
        },
 
        _loadData: function(data)
        {
                var markers = data.documentElement.getElementsByTagName("marker");
+        var index = 0;
                for (i = 0; i < markers.length; i++) {
                        var name = markers[i].getAttribute('member_name');
                        var street = markers[i].getAttribute('street');
@@ -99,7 +114,10 @@ var Map = {
                     position: point
                 });
             }
+
             Map.arrMarkers.push(marker);
+            index++;
+            console.log('Add marker at ' + index);
                        Map._bindInfoWindow(marker, Map._map, Map._infoWindow, html);
                }
 
@@ -108,15 +126,6 @@ var Map = {
                );
                Map._map.fitBounds(Map._latLngBounds);
 
-        if (glm_searchMapIconActive) {
-            $(".map-link").click(function (){
-                var linkId = $(this).attr("rel");
-                google.maps.event.trigger(Map.arrMarkers[linkId], "click");
-                myAnchor = '#map-canvas';
-                window.location = String(window.location).replace(/\#.*$/, "") + myAnchor;
-                Map._map.setZoom(14);
-            });
-        }
        },
 
        _bindInfoWindow: function(marker, map, infoWindow, html)
index 217b9e2..0ae880f 100644 (file)
@@ -123,8 +123,9 @@ try {
                 'iconUrl'         => $iconUrl,
                 'zIndex'         => $count,
                        );
+            ++$count;
                }
-        ++$count;
+
        }
 } catch (PDOException $e) {
        Toolkit_Common::handleError($e);