├── Change Log.txt ├── README ├── docs.html ├── examples1.html ├── examples2.html └── third_party └── gmap ├── config.php ├── config └── gmap.php ├── ft.gmap.php ├── language ├── dutch │ └── lang.gmap.php ├── english │ └── lang.gmap.php ├── french │ └── lang.gmap.php ├── norwegian │ └── lang.gmap.php └── spanish │ └── lang.gmap.php ├── pi.gmap.php └── views ├── field_type ├── gmap.js └── settings.php └── map.php /Change Log.txt: -------------------------------------------------------------------------------- 1 | /** 2 | * Google Maps for ExpressionEngine 3 | * Author: Justin Kimbrell 4 | * Build: 2.5 - Jan 31, 2012 5 | * Copyright 2011 - All rights reserved 6 | * http://objectivehtml.com, http://inthesaucepan.com 7 | */ 8 | 9 | Version 2.5 10 | ----------- 11 | Version 2.x has officially come to a close. I am only leaving it available for those that need a free solution. This version will not be officially supported. Everyone is encouraged to upgrade to v3. I put A LOT of time and hard work into v3 and is something I am extremely proud of. Thanks for everyone who supported this add-on, and I hope you continue to support v3. 12 | 13 | I also updated the download package with the original documentation and examples, as they are no longer available online. 14 | 15 | Version 2.4 12/28/2011 16 | ---------------------- 17 | Merged a pull request, bug fixes, and deleted all the code for advanced features rendering this the "free" version of Google Maps for ExpressionEngine. All features in the previous v2.3 beta have been merged into the v3 release. Commercial release is coming soon with all new advanced features and a complete rewrite of the code based. 18 | 19 | 20 | Version 2.3 BETA Build 7/20/2011 21 | -------------------------------- 22 | Added basic form validation using CodeIngiter's validation class. Added the ability to geocode multiple locations. Fixed a bug that caused errors and notices when an invalid location was thrown at the geocoded. 23 | 24 | Version 2.3 BETA Build 7/11/2011 25 | -------------------------------- 26 | Fixed the bug that caused the map to clip when it was hidden before initialization (for the fieldtype). 27 | 28 | Version 2.3 BETA Build 7/07/2011 29 | -------------------------------- 30 | A number of bug fixes for the search and results methods. 31 | 32 | 33 | Version 2.3 BETA Build 6/22/2011 34 | -------------------------------- 35 | A number a significant improvements have been made to more easily search your channel data in relation to a specific location. Currently the user can only define the location, not the developer. However, this will not be the case in future builds. A new result method tracks the search search results that also integrates well with the channel:entries tag. Much more to come in this release. (This is the first BETA build of 2.3) 36 | 37 | Version 2.2.1 Build 6/13/2011 38 | ----------------------- 39 | Minor bug fixes that dealt with the field type and safecracker that caused some installations no to update the lat and lng. Also fixed the long time bug that caused conditional statements no to process correctly inside javascript. (Now $config['protect_javascript'] = 'n';) 40 | 41 | Version 2.2 Build 6/10/2011 42 | ---------------------- 43 | Version 2.2 brings a load of new features to the table. Here are the major ones: 44 | 45 | Create maps with custom marker icons 46 | Create maps with custom styles using the Google Maps API Styles Map Wizard 47 | 5 all new methods for further extendability including: gmap:marker, gmap:dropdown, gmap:center, gmap:zoom, and gmap:init. 48 | Fully compatible with Matrix (with SafeCracker coming before the final release) 49 | Display one info window at a time 50 | Add control over the default zoom functionality 51 | New gmap:dropdown method can be used to auto-populate a dropdown menu with the markers on the map. 52 | All new fieldtype with a very simple drag and drop interface to geocode a matrix of coordinates. 53 | Limit number of markers that can be added to the fieldtype. 54 | Populate custom latitude and longitude fields with the individual degrees. 55 | Available in 5 languages: English, French, Dutch, Norwegian, and Spanish 56 | Compatibility with SafeCracker, NSM Add-on Updater, and the new @ee_zoo's new Visitor 57 | 58 | 59 | Version 2.1.3 Build 5/9/2011 60 | ---------------------- 61 | Added the ability to search custom fields like the inherent exp:channel:entries tag. (search:custom_field="some value"). 62 | 63 | 64 | Version 2.1.2 Build 5/9/2011 65 | ---------------------- 66 | Fixed the a problem the with double-quotes breaking the javascript. The markup that is now inserted into the info window is now escaped. 67 | 68 | 69 | Version 2.1.1 Build 5/5/2011 70 | ---------------------- 71 | Fixed a typo the caused a JavaScript error in IE that resulted in the maps not displaying properly. 72 | 73 | 74 | Version 2.1 Build 5/2/2011 75 | ---------------------- 76 | Core plugin code was completely rewritten for comprehension and for easier long-term support. The original API was unchanged, except with the addition of several new features. Added latitude_field, longitude_field, and zoom_field to pull the respective values from a specified channel. Plot or center on a static longitude and latitude coordinate. Now able to add multiple static addresses. The only required field is now the id. A lot of rules were changes in how data interacts with the map. If the address or coordinates are blank coming from the channel, the record is ignored. You can define a single channel that stores address and coordinates and plot them on a single map. The idea of the upgrade was to be less restrictive. 77 | 78 | 79 | Version 2.0 Build 4/23/2011 80 | ---------------------- 81 | Completely revamped the Google Map implementation within the native channel:entries tag instead of using a proprietary syntax. Google Maps v3.0 API was used instead of 2.0 which comes with mobile support. All v3.0 options are available. -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Google Maps for ExpressionEngine 2 | Version 2.5 - January 31, 2012 3 | Copyright 2012 - Justin Kimbrell 4 | http://objectivehtml.com/google-maps 5 | 6 | Please upgrade to version 3, it's a lot better anyway! -------------------------------------------------------------------------------- /docs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Objective HTML by Justin Kimbrell - Google Maps for ExpressionEngine 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 1202 | 1203 | 1204 | 1205 | 1206 | 1207 | 1230 | 1231 | 1232 | 1236 | 1237 | 1241 | 1242 | 1243 | 1244 | 1245 | 1246 |
1247 | 1248 |
1249 |

Objective HTML

1250 | 1251 | 1259 |
1260 | 1261 |
1262 | 1263 | 1264 |

Documentation

1265 | 1266 | 1267 |
1268 | 1269 | 1270 | 1271 | 1272 |

Google Maps for ExpressionEngine

1273 | 1274 |
1275 |
Version
1276 | 1277 |
2.5
1278 |
Last update
1279 |
1/31/2012
1280 |
1281 | 1282 |
1283 | 1284 |

Description

1285 | 1286 |

1287 | 1288 | This plugin combines the familiar syntax of the exp:channel:entries tag (all of the parameters are available) combined with all the properties used to initialize Google Maps, thus making the process very familiar. This plugin requires no JavaScript or PHP to implement dynamic or static maps. You can plot locations using custom fields from your channels, or just a static address on the contact page right within your EE templates.

1289 | 1290 | 1291 |
1292 | 1293 | 1447 | 1448 |
1449 | 1450 |

Overview

1451 | 1452 | 1453 |

1454 | Using ExpressionEngine to manage pages and content saves hours of time, but using it to manage locations can prove to be a bigger challenge than first meets the eye. The possibilities of the clients' desires are endless, but all revolve around publishing and retrieving data from the channels module, and plotting the address' within a Google Map (now using API v3 with mobile support).

1455 |

1456 | This plugin aims to take the pain out of that entire process by using the familiar syntax as the channel:entries tag (all of the parameters are available) combined with all the properties used to initialize Google Maps, thus making the process very familiar. This plugin requires no JavaScript or PHP to implement and no knew knowledge outside of the channel tag and the desired properties of Google Map.

1457 |

1458 | 1459 | Note, the Google Maps JavaScript library is required to be included (in the head presumably) on your page. This plugin does not include the file.

1460 | 1461 | 1462 |
1463 | 1464 |
1465 |

Features

1466 | 1467 | Combines all the channel:entries parameters with all the Google Maps properties 1468 | Use EE backend to plot map coordinates 1469 | Auto zooms and centers map around the points dynamically (if desired) 1470 | Can adapt any channel with address' to plot within the map 1471 | Absolutely no SQL, PHP, or JavaScript knowledge necessary 1472 | Customizable info windows (popups within the map) 1473 | This is the easiest Google Maps implementation out there 1474 | Customizable controls, styles, map types, and more 1475 | No dependent JS files 1476 | 1477 |
1478 | 1479 | 1480 |
1481 | 1482 |

Installation

1483 | 1484 |
1485 |
    1486 |
  1. 1487 | Copy gmap plugin folder to your /system/expressionengine/third_party/ folder.
  2. 1488 | 1489 |
  3. 1490 | If you desire to use the fieldtype, install it by going to Addons > Fieldtypes > Google Maps for ExpressionEngine > Install
  4. 1491 |
  5. 1492 | Include this in the head of your document: <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
  6. 1493 | 1494 |
  7. 1495 | Refer to the Google Maps examples for additional information.
  8. 1496 |
1497 |
1498 |

1499 |  

1500 | 1501 | 1502 |
1503 | 1504 | 1505 |
1506 | 1507 |

Methods

1508 | 1509 |
    1510 | 1511 |
  1. {exp:gmap:init}
  2. 1512 | 1513 |
  3. {exp:gmap:marker}
  4. 1514 | 1515 |
  5. {exp:gmap:center}
  6. 1516 | 1517 |
  7. {exp:gmap:zoom}
  8. 1518 | 1519 |
1520 | 1521 | 1522 | 1523 |
1524 | 1525 |
{exp:gmap:init}
1526 | 1527 |
1528 | 1529 |

1530 | This is the main and primary method used to create Google Maps. This method is also an alias to the exp:channel:entries method anytime the channel parameter is defined. Meaning, if the channel parameter is defined, all of same parameters can that would normally be used with the exp:channel:entries method can be used with the exp:gmap method in addition to all the properties used to initialize a Google Map.

1531 | 1532 |

1533 | Do not use this method with the channel attribute if your are nesting the exp:gmap method inside the exp:channel:entries method. This will result two nested exp:channel:entries methods. This is not advisable. However, if the channel attribute is not present, you may include <code>exp:gmap</code> inside the exp:channel:entries tag.

1534 | 1535 |
1536 | 1537 | 1538 |
    1539 | 1540 |
  • 1541 | 1542 |
    1543 | 1544 | id 1545 | 1546 |
    1547 |
    Type:
    1548 | 1549 |
    String
    1550 | 1551 |
    Default:
    1552 |
    FALSE
    1553 |
    1554 | 1555 |
    1556 | 1557 |
    1558 | 1559 |
    Description
    1560 | 1561 | 1562 |

    1563 | The id must be a unique string, and is used to create the JavaScript variables for the map, and assigned to the map element (div). You must use only alphabetical and numerical characters with the exception of underscores.

    1564 | 1565 | 1566 |
    Code Examples
    1567 | 1568 | 1569 | {exp:gmap:init id="map_demo" address="Denver, CO"} 1570 | 1571 | 1572 | 1573 |
    1574 | 1575 |
  • 1576 | 1577 |
  • 1578 | 1579 |
    1580 | 1581 | class 1582 | 1583 |
    1584 |
    Type:
    1585 | 1586 |
    String
    1587 | 1588 |
    Default:
    1589 |
    NULL
    1590 |
    1591 | 1592 |
    1593 | 1594 |
    1595 | 1596 |
    Description
    1597 | 1598 | 1599 |

    1600 | This is the class attribute that will be appended to the map.

    1601 | 1602 | 1603 |
    Code Examples
    1604 | 1605 | 1606 | {exp:gmap:init id="center_demo" address="Broadripple Village, Indianapolis" center="Indianapolis, IN" class="map"} 1607 | 1608 | 1609 | 1610 |
    1611 | 1612 |
  • 1613 | 1614 |
  • 1615 | 1616 |
    1617 | 1618 | style 1619 | 1620 |
    1621 |
    Type:
    1622 |
    String
    1623 | 1624 | 1625 |
    Default:
    1626 |
    NULL
    1627 |
    1628 | 1629 |
    1630 | 1631 |
    1632 | 1633 |
    Description
    1634 | 1635 |

    1636 | 1637 | This is the style attribute that will be appended to the map.

    1638 | 1639 | 1640 |
    Code Examples
    1641 | 1642 | 1643 | {exp:gmap:init id="map_demo" address="Broadripple Village, Indianapolis" center="Indianapolis, IN" style="width:400px; height:300px"} 1644 | 1645 | 1646 |
    1647 | 1648 | 1649 |
  • 1650 | 1651 |
  • 1652 | 1653 |
    1654 | 1655 | address 1656 | 1657 |
    1658 |
    Type:
    1659 |
    Address
    1660 | 1661 | 1662 |
    Default:
    1663 |
    NULL
    1664 |
    1665 | 1666 |
    1667 | 1668 |
    1669 | 1670 |
    Description
    1671 | 1672 |

    1673 | 1674 | The address is required to create a static map unless you define a latitude and longitude.

    1675 | 1676 | 1677 |
    Code Examples
    1678 | 1679 | 1680 | 1681 | {exp:gmap:init id="map_demo" address="Denver, CO"} 1682 | 1683 | 1684 |
    1685 | 1686 |
  • 1687 | 1688 |
  • 1689 | 1690 |
    1691 | 1692 | latitude 1693 | 1694 |
    1695 | 1696 |
    Type:
    1697 |
    Degree
    1698 | 1699 |
    Default:
    1700 |
    0
    1701 |
    1702 | 1703 |
    1704 | 1705 |
    1706 | 1707 | 1708 |
    Description
    1709 | 1710 |

    1711 | You can define a single latitude and longitude degree if you don't need to use the geocoder.

    1712 | 1713 | 1714 |
    Code Examples
    1715 | 1716 | 1717 | {exp:gmap:init id="map_canvas" latitude="0" longitude="0"} 1718 | 1719 | 1720 | 1721 |
    1722 | 1723 |
  • 1724 | 1725 |
  • 1726 | 1727 |
    1728 | 1729 | longitude 1730 | 1731 |
    1732 |
    Type:
    1733 | 1734 |
    Degree
    1735 | 1736 |
    Default:
    1737 |
    0
    1738 |
    1739 | 1740 |
    1741 | 1742 |
    1743 | 1744 |
    Description
    1745 | 1746 | 1747 |

    1748 | You can define a single latitude and longitude degree if you don't need to use the geocoder.

    1749 | 1750 | 1751 |
    Code Examples
    1752 | 1753 | 1754 | {exp:gmap:init id="map_canvas" latitude="0" longitude="0"} 1755 | 1756 | 1757 | 1758 |
    1759 | 1760 |
  • 1761 | 1762 |
  • 1763 | 1764 |
    1765 | 1766 | center 1767 | 1768 |
    1769 |
    Type:
    1770 |
    Address
    1771 | 1772 | 1773 |
    Default:
    1774 |
    NULL
    1775 |
    1776 | 1777 |
    1778 | 1779 |
    1780 | 1781 |
    Description
    1782 | 1783 |

    1784 | 1785 | When the center is set, it will override the default center location.

    1786 | 1787 | 1788 |
    Code Examples
    1789 | 1790 | 1791 | {exp:gmap:init id="center_demo" address="Broadripple Village, Indianapolis" center="Indianapolis, IN"} 1792 | 1793 | 1794 | 1795 |
    1796 | 1797 |
  • 1798 | 1799 |
  • 1800 | 1801 |
    1802 | 1803 | zoom 1804 | 1805 |
    1806 |
    Type:
    1807 |
    Integer (1-20)
    1808 | 1809 | 1810 |
    Default:
    1811 |
    FALSE
    1812 |
    1813 | 1814 |
    1815 | 1816 |
    1817 | 1818 |
    Description
    1819 | 1820 |

    1821 | 1822 | The zoom the same field that the Google Maps API implements.

    1823 | 1824 | 1825 |
    Code Examples
    1826 | 1827 | 1828 | {exp:gmap:init id="center_demo" address="Broadripple Village, Indianapolis" center="Indianapolis, IN" zoom="5"} 1829 | 1830 | 1831 | 1832 |
    1833 | 1834 |
  • 1835 | 1836 |
  • 1837 | 1838 |
    1839 | 1840 | map_type 1841 | 1842 |
    1843 |
    Type:
    1844 |
    mapTypeId
    1845 | 1846 | 1847 |
    Default:
    1848 |
    ROADMAP
    1849 |
    1850 | 1851 |
    1852 | 1853 |
    1854 | 1855 |
    Description
    1856 | 1857 |

    1858 | 1859 | This attribute is an alias for the mapTypeId property of the Google Map API.

    1860 | 1861 | 1862 |
    Code Examples
    1863 | 1864 | 1865 | {exp:gmap id="center_demo" address="Broadripple Village, Indianapolis" center="Indianapolis, IN" map_type="TERRAIN"} 1866 | 1867 | 1868 | 1869 |
    1870 | 1871 |
  • 1872 | 1873 |
  • 1874 | 1875 |
    1876 | 1877 | address_field 1878 | 1879 |
    1880 |
    Type:
    1881 |
    Channel Field Name
    1882 | 1883 | 1884 |
    Default:
    1885 |
    NULL
    1886 |
    1887 | 1888 |
    1889 | 1890 |
    1891 | 1892 |
    Description
    1893 | 1894 |

    1895 | 1896 | The address_field attribute is the first part of the address string. You can use any field in the channel attribute is required to use this attribute.

    1897 |

    1898 | The channel attribute is required to use this attribute.

    1899 | 1900 | 1901 |
    Code Examples
    1902 | 1903 | 1904 | {exp:gmap:init id="map_demo" channel="map_demo" address_field="map_address"} 1905 | 1906 | 1907 |
    1908 | 1909 |
  • 1910 | 1911 |
  • 1912 | 1913 |
    1914 | 1915 | 1916 | city_field 1917 | 1918 |
    1919 |
    Type:
    1920 |
    Channel Field Name
    1921 | 1922 |
    Default:
    1923 |
    NULL
    1924 | 1925 |
    1926 | 1927 |
    1928 | 1929 |
    1930 | 1931 |
    Description
    1932 | 1933 |

    1934 | The city_field attribute is the second part of the address string. You can use any field in the channel attribute is required to use this attribute.

    1935 | 1936 |

    1937 | The channel attribute is required to use this attribute.

    1938 | 1939 | 1940 |
    Code Examples
    1941 | 1942 | 1943 | {exp:gmap id="map_demo" channel="map_demo" address_field="map_address" city_field="map_city"} 1944 | 1945 | 1946 | 1947 |
    1948 | 1949 |
  • 1950 | 1951 |
  • 1952 | 1953 |
    1954 | 1955 | state_field 1956 | 1957 |
    1958 |
    Type:
    1959 |
    Channel Field Name
    1960 | 1961 | 1962 |
    Default:
    1963 |
    NULL
    1964 |
    1965 | 1966 |
    1967 | 1968 |
    1969 | 1970 |
    Description
    1971 | 1972 |

    1973 | 1974 | The state_field is used for the third part of the address string. You can use any field in the channel.

    1975 |

    1976 | The channel attribute is required to use this attribute.

    1977 | 1978 | 1979 |
    Code Examples
    1980 | 1981 | 1982 | 1983 | {exp:gmap:init id="map_demo" channel="map_demo" address_field="map_address" city_field="map_city" state_field="map_state"} 1984 | 1985 | 1986 |
    1987 | 1988 |
  • 1989 | 1990 |
  • 1991 | 1992 |
    1993 | 1994 | zipcode_field 1995 | 1996 | 1997 |
    1998 |
    Type:
    1999 |
    Channel Field Name
    2000 | 2001 |
    Default:
    2002 |
    NULL
    2003 |
    2004 | 2005 |
    2006 | 2007 | 2008 |
    2009 | 2010 |
    Description
    2011 | 2012 |

    2013 | The zipcode_field is used for the fourth part of the address string. You can use any field in the channel.

    2014 |

    2015 | The channel attribute is required to use this attribute.

    2016 | 2017 | 2018 |
    Code Examples
    2019 | 2020 | 2021 | {exp:gmap:init id="map_demo" channel="map_demo" address_field="map_address" city_field="map_city" state_field="map_state" zipcode_field="map_zipcode"} 2022 | 2023 | 2024 |
    2025 | 2026 |
  • 2027 | 2028 |
  • 2029 | 2030 | 2031 |
    2032 | 2033 | country_field 2034 | 2035 |
    2036 |
    Type:
    2037 |
    Channel Field Name
    2038 | 2039 |
    Default:
    2040 |
    NULL
    2041 | 2042 |
    2043 | 2044 |
    2045 | 2046 |
    2047 | 2048 |
    Description
    2049 | 2050 |

    2051 | The country_field is used for the final part of the address string. You can use any field in the channel attribute is required to use this attribute.

    2052 | 2053 |

    2054 | The channel attribute is required to use this attribute.

    2055 | 2056 | 2057 |
    Code Examples
    2058 | 2059 | 2060 | {exp:gmap:init id="map_demo" channel="map_demo" address_field="map_address" city_field="map_city" state_field="map_state" zipcode_field="map_zipcode" country_field="map_zipcode"} 2061 | 2062 | 2063 | 2064 |
    2065 | 2066 |
  • 2067 | 2068 |
  • 2069 | 2070 |
    2071 | 2072 | latitude_field 2073 | 2074 |
    2075 |
    Type:
    2076 |
    Channel Field Name
    2077 | 2078 | 2079 |
    Default:
    2080 |
    NULL
    2081 |
    2082 | 2083 |
    2084 | 2085 |
    2086 | 2087 |
    Description
    2088 | 2089 |

    2090 | 2091 | The latitude_field is used to retrieve the latitude from a channel, just like the address fields.

    2092 |

    2093 | The channel attribute is required to use this attribute.

    2094 | 2095 | 2096 |
    Code Examples
    2097 | 2098 | 2099 | 2100 | {exp:gmap:init id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude="map_longitude"} 2101 | 2102 | 2103 |
    2104 | 2105 |
  • 2106 | 2107 |
  • 2108 | 2109 |
    2110 | 2111 | longitude_field 2112 | 2113 | 2114 |
    2115 |
    Type:
    2116 |
    Channel Field Name
    2117 | 2118 |
    Default:
    2119 |
    NULL
    2120 |
    2121 | 2122 |
    2123 | 2124 | 2125 |
    2126 | 2127 |
    Description
    2128 | 2129 |

    2130 | The longitude_field is used to retrieve the longitude from a channel, just like the address fields.

    2131 |

    2132 | The channel attribute is required to use this attribute.

    2133 | 2134 | 2135 |
    Code Examples
    2136 | 2137 | 2138 | {exp:gmap:init id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude="map_longitude"} 2139 | 2140 | 2141 |
    2142 | 2143 |
  • 2144 | 2145 |
  • 2146 | 2147 | 2148 |
    2149 | 2150 | zoom_field 2151 | 2152 |
    2153 |
    Type:
    2154 |
    Channel Field Name
    2155 | 2156 |
    Default:
    2157 |
    NULL
    2158 | 2159 |
    2160 | 2161 |
    2162 | 2163 |
    2164 | 2165 |
    Description
    2166 | 2167 |

    2168 | The zoom_field is used to retrieve a custom zoom from a channel, just like the address and long/lat fields.

    2169 | 2170 |

    2171 | The channel attribute is required to use this attribute.

    2172 | 2173 | 2174 |
    Code Examples
    2175 | 2176 | 2177 | {exp:gmap:init id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude="map_longitude" zoom_field="map_zoom"} 2178 | 2179 | 2180 | 2181 |
    2182 | 2183 |
  • 2184 | 2185 |
  • 2186 | 2187 |
    2188 | 2189 | gmap_field 2190 | 2191 |
    2192 |
    Type:
    2193 |
    Custom Field Name
    2194 | 2195 | 2196 |
    Default:
    2197 |
    NULL
    2198 |
    2199 | 2200 |
    2201 | 2202 |
    2203 | 2204 |
    Description
    2205 | 2206 |

    2207 | 2208 | The gmap_field is used to retrieve the longitude from a channel, just like the address fields. Except the main difference is this field specfically refers the fieldtype that is included with the plugin.

    2209 |

    2210 | The channel attribute is required to use this attribute.

    2211 | 2212 | 2213 |
    Code Examples
    2214 | 2215 | 2216 | 2217 | {exp:gmap:init id="map_canvas" channel="map_demo" gmap_field="map_gmap"} 2218 | 2219 | 2220 |
    2221 | 2222 |
  • 2223 | 2224 |
  • 2225 | 2226 |
    2227 | 2228 | lat_lng 2229 | 2230 | 2231 |
    2232 |
    Type:
    2233 |
    Coordinate String
    2234 | 2235 |
    Default:
    2236 |
    NULL
    2237 |
    2238 | 2239 |
    2240 | 2241 | 2242 |
    2243 | 2244 |
    Description
    2245 | 2246 | 2247 | 2248 |
    Code Examples
    2249 | 2250 | 2251 | {exp:gmap:init id="map_canvas" channel="map_demo" lat_lng="(0, 0)(10, 10)(20, 20)"} 2252 | 2253 | 2254 |
    2255 | 2256 | 2257 |
  • 2258 | 2259 |
  • 2260 | 2261 |
    2262 | 2263 | hide_markers 2264 | 2265 |
    2266 |
    Type:
    2267 |
    Boolean
    2268 | 2269 | 2270 |
    Default:
    2271 |
    FALSE
    2272 |
    2273 | 2274 |
    2275 | 2276 |
    2277 | 2278 |
    Description
    2279 | 2280 | 2281 | 2282 |
    Code Examples
    2283 | 2284 | 2285 | 2286 | {exp:gmap:init id="map_canvas" latitude="32" longitude="-85" zoom="9" hide_markers="true"} 2287 | 2288 | 2289 |
    2290 | 2291 |
  • 2292 | 2293 |
  • 2294 | 2295 |
    2296 | 2297 | open_windows 2298 | 2299 | 2300 |
    2301 |
    Type:
    2302 |
    Boolean
    2303 | 2304 |
    Default:
    2305 |
    FALSE
    2306 |
    2307 | 2308 |
    2309 | 2310 | 2311 |
    2312 | 2313 |
    Description
    2314 | 2315 | 2316 | 2317 |
    Code Examples
    2318 | 2319 | 2320 | {exp:gmap:init id="map_canvas" latitude="32" longitude="-85" zoom="9" open_windows="true"} 2321 | 2322 | 2323 |
    2324 | 2325 | 2326 |
  • 2327 | 2328 | 2361 | 2362 |
  • 2363 | 2364 |
    2365 | 2366 | 2367 | style_object 2368 | 2369 |
    2370 |
    Type:
    2371 |
    String
    2372 | 2373 |
    Default:
    2374 |
    stylez
    2375 | 2376 |
    2377 | 2378 |
    2379 | 2380 |
    2381 | 2382 |
    Description
    2383 | 2384 | 2385 | 2386 |
    Code Examples
    2387 | 2388 | 2389 | {exp:gmap:init id="map_canvas" style_link="/-/script/gmap-styles.js" style_object="myStyles" address="Canada"}Marker 1{/exp:gmap:init} 2390 | 2391 | 2392 | 2393 |
    2394 | 2395 |
  • 2396 | 2397 |
  • 2398 | 2399 |
    2400 | 2401 | extend_bounds 2402 | 2403 |
    2404 |
    Type:
    2405 | 2406 |
    Boolean
    2407 | 2408 |
    Default:
    2409 |
    TRUE
    2410 |
    2411 | 2412 |
    2413 | 2414 |
    2415 | 2416 |
    Description
    2417 | 2418 | 2419 | 2420 | 2421 |
    Code Examples
    2422 | 2423 | 2424 | {exp:gmap:init id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude_field="map_longitude" extend_bounds="false" zoom="10"} 2425 | 2426 | 2427 |
    2428 | 2429 |
  • 2430 | 2431 |
  • 2432 | 2433 |
    2434 | 2435 | 2436 | show_one_window 2437 | 2438 |
    2439 |
    Type:
    2440 |
    Boolean
    2441 | 2442 |
    Default:
    2443 |
    FALSE
    2444 | 2445 |
    2446 | 2447 |
    2448 | 2449 |
    2450 | 2451 |
    Description
    2452 | 2453 | 2454 | 2455 |
    Code Examples
    2456 | 2457 | 2458 | {exp:gmap:init id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude_field="map_longitude" show_one_window="true"} 2459 | 2460 | 2461 | 2462 |
    2463 | 2464 |
  • 2465 | 2466 |
  • 2467 | 2468 |
    2469 | 2470 | icon 2471 | 2472 |
    2473 |
    Type:
    2474 | 2475 |
    String
    2476 | 2477 |
    Default:
    2478 |
    NULL
    2479 |
    2480 | 2481 |
    2482 | 2483 |
    2484 | 2485 |
    Description
    2486 | 2487 | 2488 | 2489 | 2490 |
    Code Examples
    2491 | 2492 | 2493 | {exp:gmap:init id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude_field="map_longitude" icon="/some/file/path/icon.png"} 2494 | 2495 | 2496 |
    2497 | 2498 |
  • 2499 | 2500 |
  • 2501 | 2502 |
    2503 | 2504 | 2505 | show_coordinate 2506 | 2507 |
    2508 |
    Type:
    2509 |
    Boolean
    2510 | 2511 |
    Default:
    2512 |
    FALSE
    2513 | 2514 |
    2515 | 2516 |
    2517 | 2518 |
    2519 | 2520 |
    Description
    2521 | 2522 | 2523 | 2524 |
    Code Examples
    2525 | 2526 | 2527 | {exp:gmap:init id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude_field="map_longitude" show_coordinate="true"} 2528 | 2529 | 2530 | 2531 |
    2532 | 2533 |
  • 2534 | 2535 |
  • 2536 | 2537 |
    2538 | 2539 | add_title_to_dropdown 2540 | 2541 |
    2542 |
    Type:
    2543 | 2544 |
    Boolean
    2545 | 2546 |
    Default:
    2547 |
    TRUE
    2548 |
    2549 | 2550 |
    2551 | 2552 |
    2553 | 2554 |
    Description
    2555 | 2556 | 2557 | 2558 | 2559 |
    Code Examples
    2560 | 2561 | 2562 | {exp:gmap:init id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude_field="map_longitude" show_coordinate="true" add_title_to_dropdown="true"} 2563 | 2564 | 2565 |
    2566 | 2567 |
  • 2568 | 2569 |
2570 | 2571 |
2572 | 2573 | 2574 | 2575 |
2576 | 2577 |
{exp:gmap:marker}
2578 | 2579 |
2580 |

2581 | This method allows you the freedom to initialize a Google Map outside of the exp:channel:entries tag. You can save coordinates inside a Matrix table, for example, and add them to a map you have initialized.

2582 | 2583 |

2584 | Most of the same parameters can be used along with exp:gmap. You can even use this method to loop through your entries with all the same channel parameters just as a exp:channel:entries tag.

2585 |

2586 | Note, if you use this method you must use it in conjunction with the exp:gmap:init method.

2587 | 2588 |
2589 | 2590 | 2591 |
    2592 | 2593 |
  • 2594 | 2595 |
    2596 | 2597 | id 2598 | 2599 |
    2600 |
    Type:
    2601 |
    String
    2602 | 2603 | 2604 |
    Default:
    2605 |
    NULL
    2606 |
    2607 | 2608 |
    2609 | 2610 |
    2611 | 2612 |
    Description
    2613 | 2614 |

    2615 | 2616 | This should be the same value used as the id parameter used to initialize the map. This is how the method knows which map to add a marker to. This is also helpful if you have two maps on a page and want to dynamically add them to one or the other. (Why you would want to do that, I don't know, but now you can.)

    2617 | 2618 | 2619 |
    Code Examples
    2620 | 2621 | 2622 | {exp:gmap:marker id="map1" address="South Africa"}South Africa{/exp:gmap:marker} 2623 | 2624 | 2625 | 2626 |
    2627 | 2628 |
  • 2629 | 2630 |
  • 2631 | 2632 |
    2633 | 2634 | address 2635 | 2636 |
    2637 |
    Type:
    2638 | 2639 |
    Address
    2640 | 2641 |
    Default:
    2642 |
    NULL
    2643 |
    2644 | 2645 |
    2646 | 2647 |
    2648 | 2649 |
    Description
    2650 | 2651 | 2652 |

    2653 | The address is required to create a static map unless you define a latitude and longitude.

    2654 | 2655 | 2656 |
    Code Examples
    2657 | 2658 | 2659 | 2660 | {exp:gmap id="map_demo" address="Denver, CO"} 2661 | 2662 | 2663 |
    2664 | 2665 |
  • 2666 | 2667 |
  • 2668 | 2669 |
    2670 | 2671 | latitude 2672 | 2673 | 2674 |
    2675 |
    Type:
    2676 |
    Degree
    2677 | 2678 |
    Default:
    2679 |
    0
    2680 |
    2681 | 2682 |
    2683 | 2684 | 2685 |
    2686 | 2687 |
    Description
    2688 | 2689 |

    2690 | You can define a single latitude and longitude degree if you don't need to use the geocoder.

    2691 | 2692 | 2693 |
    Code Examples
    2694 | 2695 | 2696 | 2697 | {exp:gmap id="map_demo" address="Denver, CO"} 2698 | 2699 | 2700 |
    2701 | 2702 |
  • 2703 | 2704 |
  • 2705 | 2706 |
    2707 | 2708 | longitude 2709 | 2710 |
    2711 | 2712 |
    Type:
    2713 |
    Degree
    2714 | 2715 |
    Default:
    2716 |
    0
    2717 |
    2718 | 2719 |
    2720 | 2721 |
    2722 | 2723 | 2724 |
    Description
    2725 | 2726 |

    2727 | You can define a single latitude and longitude degree if you don't need to use the geocoder.

    2728 | 2729 | 2730 |
    Code Examples
    2731 | 2732 | 2733 | {exp:gmap id="map_canvas" latitude="0" longitude="0"} 2734 | 2735 | 2736 | 2737 |
    2738 | 2739 |
  • 2740 | 2741 |
  • 2742 | 2743 |
    2744 | 2745 | center 2746 | 2747 |
    2748 |
    Type:
    2749 | 2750 |
    Address
    2751 | 2752 |
    Default:
    2753 |
    NULL
    2754 |
    2755 | 2756 |
    2757 | 2758 |
    2759 | 2760 |
    Description
    2761 | 2762 | 2763 |

    2764 | When the center is set, it will override the default center location.

    2765 | 2766 | 2767 |
    Code Examples
    2768 | 2769 | 2770 | {exp:gmap id="center_demo" address="Broadripple Village, Indianapolis" center="Indianapolis, IN"} 2771 | 2772 | 2773 | 2774 |
    2775 | 2776 |
  • 2777 | 2778 |
  • 2779 | 2780 |
    2781 | 2782 | zoom 2783 | 2784 |
    2785 |
    Type:
    2786 | 2787 |
    Integer (1-20)
    2788 | 2789 |
    Default:
    2790 |
    FALSE
    2791 |
    2792 | 2793 |
    2794 | 2795 |
    2796 | 2797 |
    Description
    2798 | 2799 | 2800 |

    2801 | The zoom the same field that the Google Maps API implements.

    2802 | 2803 | 2804 |
    Code Examples
    2805 | 2806 | 2807 | {exp:gmap id="center_demo" address="Broadripple Village, Indianapolis" center="Indianapolis, IN" zoom="5"} 2808 | 2809 | 2810 | 2811 |
    2812 | 2813 |
  • 2814 | 2815 |
  • 2816 | 2817 |
    2818 | 2819 | address_field 2820 | 2821 |
    2822 |
    Type:
    2823 | 2824 |
    Channel Field Name
    2825 | 2826 |
    Default:
    2827 |
    NULL
    2828 |
    2829 | 2830 |
    2831 | 2832 |
    2833 | 2834 |
    Description
    2835 | 2836 | 2837 |

    2838 | The address_field attribute is the first part of the address string. You can use any field in the channel attribute is required to use this attribute.

    2839 |

    2840 | The channel attribute is required to use this attribute.

    2841 | 2842 | 2843 |
    Code Examples
    2844 | 2845 | 2846 | {exp:gmap id="map_demo" channel="map_demo" address_field="map_address"} 2847 | 2848 | 2849 |
    2850 | 2851 |
  • 2852 | 2853 |
  • 2854 | 2855 | 2856 |
    2857 | 2858 | city_field 2859 | 2860 |
    2861 |
    Type:
    2862 |
    Channel Field Name
    2863 | 2864 |
    Default:
    2865 |
    NULL
    2866 | 2867 |
    2868 | 2869 |
    2870 | 2871 |
    2872 | 2873 |
    Description
    2874 | 2875 |

    2876 | The city_field attribute is the second part of the address string. You can use any field in the channel attribute is required to use this attribute.

    2877 | 2878 |

    2879 | The channel attribute is required to use this attribute.

    2880 | 2881 | 2882 |
    Code Examples
    2883 | 2884 | 2885 | {exp:gmap id="map_demo" channel="map_demo" address_field="map_address" city_field="map_city"} 2886 | 2887 | 2888 | 2889 |
    2890 | 2891 |
  • 2892 | 2893 |
  • 2894 | 2895 |
    2896 | 2897 | state_field 2898 | 2899 |
    2900 |
    Type:
    2901 |
    Channel Field Name
    2902 | 2903 | 2904 |
    Default:
    2905 |
    NULL
    2906 |
    2907 | 2908 |
    2909 | 2910 |
    2911 | 2912 |
    Description
    2913 | 2914 |

    2915 | 2916 | The state_field is used for the third part of the address string. You can use any field in the channel.

    2917 |

    2918 | The channel attribute is required to use this attribute.

    2919 | 2920 | 2921 |
    Code Examples
    2922 | 2923 | 2924 | 2925 | {exp:gmap id="map_demo" channel="map_demo" address_field="map_address" city_field="map_city" state_field="map_state"} 2926 | 2927 | 2928 |
    2929 | 2930 |
  • 2931 | 2932 |
  • 2933 | 2934 |
    2935 | 2936 | zipcode_field 2937 | 2938 | 2939 |
    2940 |
    Type:
    2941 |
    Channel Field Name
    2942 | 2943 |
    Default:
    2944 |
    NULL
    2945 |
    2946 | 2947 |
    2948 | 2949 | 2950 |
    2951 | 2952 |
    Description
    2953 | 2954 |

    2955 | The zipcode_field is used for the fourth part of the address string. You can use any field in the channel.

    2956 |

    2957 | The channel attribute is required to use this attribute.

    2958 | 2959 | 2960 |
    Code Examples
    2961 | 2962 | 2963 | {exp:gmap id="map_demo" channel="map_demo" address_field="map_address" city_field="map_city" state_field="map_state" zipcode_field="map_zipcode"} 2964 | 2965 | 2966 |
    2967 | 2968 |
  • 2969 | 2970 |
  • 2971 | 2972 | 2973 |
    2974 | 2975 | country_field 2976 | 2977 |
    2978 |
    Type:
    2979 |
    Channel Field Name
    2980 | 2981 |
    Default:
    2982 |
    NULL
    2983 | 2984 |
    2985 | 2986 |
    2987 | 2988 |
    2989 | 2990 |
    Description
    2991 | 2992 |

    2993 | The country_field is used for the final part of the address string. You can use any field in the channel attribute is required to use this attribute.

    2994 | 2995 |

    2996 | The channel attribute is required to use this attribute.

    2997 | 2998 | 2999 |
    Code Examples
    3000 | 3001 | 3002 | {exp:gmap id="map_demo" channel="map_demo" address_field="map_address" city_field="map_city" state_field="map_state" zipcode_field="map_zipcode" country_field="map_zipcode"} 3003 | 3004 | 3005 | 3006 |
    3007 | 3008 |
  • 3009 | 3010 |
  • 3011 | 3012 |
    3013 | 3014 | latitude_field 3015 | 3016 |
    3017 |
    Type:
    3018 |
    Channel Field Name
    3019 | 3020 | 3021 |
    Default:
    3022 |
    NULL
    3023 |
    3024 | 3025 |
    3026 | 3027 |
    3028 | 3029 |
    Description
    3030 | 3031 |

    3032 | 3033 | The latitude_field is used to retrieve the latitude from a channel, just like the address fields.

    3034 |

    3035 | The channel attribute is required to use this attribute.

    3036 | 3037 | 3038 |
    Code Examples
    3039 | 3040 | 3041 | 3042 | {exp:gmap id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude="map_longitude"} 3043 | 3044 | 3045 |
    3046 | 3047 |
  • 3048 | 3049 |
  • 3050 | 3051 |
    3052 | 3053 | longitude_field 3054 | 3055 | 3056 |
    3057 |
    Type:
    3058 |
    Channel Field Name
    3059 | 3060 |
    Default:
    3061 |
    NULL
    3062 |
    3063 | 3064 |
    3065 | 3066 | 3067 |
    3068 | 3069 |
    Description
    3070 | 3071 |

    3072 | The longitude_field is used to retrieve the longitude from a channel, just like the address fields.

    3073 |

    3074 | The channel attribute is required to use this attribute.

    3075 | 3076 | 3077 |
    Code Examples
    3078 | 3079 | 3080 | {exp:gmap id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude="map_longitude"} 3081 | 3082 | 3083 |
    3084 | 3085 |
  • 3086 | 3087 |
  • 3088 | 3089 | 3090 |
    3091 | 3092 | zoom_field 3093 | 3094 |
    3095 |
    Type:
    3096 |
    Channel Field Name
    3097 | 3098 |
    Default:
    3099 |
    NULL
    3100 | 3101 |
    3102 | 3103 |
    3104 | 3105 |
    3106 | 3107 |
    Description
    3108 | 3109 |

    3110 | The zoom_field is used to retrieve a custom zoom from a channel, just like the address and long/lat fields.

    3111 | 3112 |

    3113 | The channel attribute is required to use this attribute.

    3114 | 3115 | 3116 |
    Code Examples
    3117 | 3118 | 3119 | {exp:gmap id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude="map_longitude" zoom_field="map_zoom"} 3120 | 3121 | 3122 | 3123 |
    3124 | 3125 |
  • 3126 | 3127 |
  • 3128 | 3129 |
    3130 | 3131 | gmap_field 3132 | 3133 |
    3134 |
    Type:
    3135 |
    Custom Field Name
    3136 | 3137 | 3138 |
    Default:
    3139 |
    NULL
    3140 |
    3141 | 3142 |
    3143 | 3144 |
    3145 | 3146 |
    Description
    3147 | 3148 |

    3149 | 3150 | The gmap_field is used to retrieve the longitude from a channel, just like the address fields. Except the main difference is this field specfically refers the fieldtype that is included with the plugin.

    3151 |

    3152 | The channel attribute is required to use this attribute.

    3153 | 3154 | 3155 |
    Code Examples
    3156 | 3157 | 3158 | 3159 | {exp:gmap id="map_canvas" channel="map_demo" gmap_field="map_gmap"} 3160 | 3161 | 3162 |
    3163 | 3164 |
  • 3165 | 3166 |
  • 3167 | 3168 |
    3169 | 3170 | lat_lng 3171 | 3172 | 3173 |
    3174 |
    Type:
    3175 |
    Coordinate String
    3176 | 3177 |
    Default:
    3178 |
    NULL
    3179 |
    3180 | 3181 |
    3182 | 3183 | 3184 |
    3185 | 3186 |
    Description
    3187 | 3188 |

    3189 | You can define a custom coordinate string with a specific format. This format is used by the fieldtype to plot the coordinates. If you need to, you can plot the string, rather than the field.

    3190 | 3191 | 3192 |
    Code Examples
    3193 | 3194 | 3195 | {exp:gmap id="map_canvas" channel="map_demo" lat_lng="(0, 0)(10, 10)(20, 20)"} 3196 | 3197 | 3198 | 3199 |
    3200 | 3201 |
  • 3202 | 3203 |
  • 3204 | 3205 |
    3206 | 3207 | open_windows 3208 | 3209 |
    3210 |
    Type:
    3211 | 3212 |
    Boolean
    3213 | 3214 |
    Default:
    3215 |
    FALSE
    3216 |
    3217 | 3218 |
    3219 | 3220 |
    3221 | 3222 |
    Description
    3223 | 3224 | 3225 |

    3226 | If you want to open the info windows by default, set this property to true.

    3227 | 3228 | 3229 |
    Code Examples
    3230 | 3231 | 3232 | {exp:gmap id="map_canvas" latitude="32" longitude="-85" zoom="9" open_windows="true"} 3233 | 3234 | 3235 |
    3236 | 3237 | 3238 |
  • 3239 | 3240 |
  • 3241 | 3242 |
    3243 | 3244 | extend_bounds 3245 | 3246 |
    3247 |
    Type:
    3248 |
    Boolean
    3249 | 3250 | 3251 |
    Default:
    3252 |
    TRUE
    3253 |
    3254 | 3255 |
    3256 | 3257 |
    3258 | 3259 |
    Description
    3260 | 3261 |

    3262 | 3263 | By default the plugin extends the map of bounds to automically adjust the center and zoom to fit all the points. If you want to disable this feature, set this parameter false.

    3264 | 3265 | 3266 |
    Code Examples
    3267 | 3268 | 3269 | {exp:gmap id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude_field="map_longitude" extend_bounds="false" zoom="10"} 3270 | 3271 | 3272 |
    3273 | 3274 | 3275 |
  • 3276 | 3277 |
  • 3278 | 3279 |
    3280 | 3281 | show_one_window 3282 | 3283 |
    3284 |
    Type:
    3285 |
    Boolean
    3286 | 3287 | 3288 |
    Default:
    3289 |
    FALSE
    3290 |
    3291 | 3292 |
    3293 | 3294 |
    3295 | 3296 |
    Description
    3297 | 3298 |

    3299 | 3300 | If you want to limit the amount of windows that are open at a time to one, set this parameter to true.

    3301 | 3302 | 3303 |
    Code Examples
    3304 | 3305 | 3306 | {exp:gmap id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude_field="map_longitude" show_one_window="true"} 3307 | 3308 | 3309 |
    3310 | 3311 | 3312 |
  • 3313 | 3314 |
  • 3315 | 3316 |
    3317 | 3318 | icon 3319 | 3320 |
    3321 |
    Type:
    3322 |
    String
    3323 | 3324 | 3325 |
    Default:
    3326 |
    NULL
    3327 |
    3328 | 3329 |
    3330 | 3331 |
    3332 | 3333 |
    Description
    3334 | 3335 |

    3336 | 3337 | If you want to define a custom image to use for the map icon, use this parameter.

    3338 | 3339 | 3340 |
    Code Examples
    3341 | 3342 | 3343 | {exp:gmap id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude_field="map_longitude" icon="/some/file/path/icon.png"} 3344 | 3345 | 3346 |
    3347 | 3348 |
  • 3349 | 3350 | 3351 |
  • 3352 | 3353 |
    3354 | 3355 | show_coordinate 3356 | 3357 |
    3358 |
    Type:
    3359 |
    Boolean
    3360 | 3361 |
    Default:
    3362 | 3363 |
    TRUE
    3364 |
    3365 | 3366 |
    3367 | 3368 |
  • 3369 | 3370 |
3371 | 3372 |
3373 | 3374 | 3375 | 3376 |
3377 | 3378 |
{exp:gmap:center}
3379 | 3380 |
3381 | 3382 |

3383 | This is a stand-alone method that allows you to change the map's center after it's been initialized and the markers have been added.

3384 |

3385 | Note, if you intend to change the center point after the map has been initialized and points have been added, make sure you set the extend_bounds parameter to false.

3386 | 3387 |
3388 | 3389 | 3390 |
    3391 | 3392 |
  • 3393 | 3394 |
    3395 | 3396 | id 3397 | 3398 |
    3399 |
    Type:
    3400 |
    String
    3401 | 3402 | 3403 |
    Default:
    3404 |
    NULL
    3405 |
    3406 | 3407 |
    3408 | 3409 |
    3410 | 3411 |
    Description
    3412 | 3413 |

    3414 | 3415 | This should be the same value used as the id parameter used to initialize the map. This is how the method knows which map to add a marker to. This is also helpful if you have two maps on a page and want to dynamically add them to one or the other. (Why you would want to do that, I don't know, but now you can.)

    3416 | 3417 | 3418 |
    Code Examples
    3419 | 3420 | 3421 | {exp:gmap:center id="map_canvas" address="New Zealand"} 3422 | 3423 | 3424 | 3425 |
    3426 | 3427 |
  • 3428 | 3429 |
  • 3430 | 3431 |
    3432 | 3433 | address 3434 | 3435 |
    3436 |
    Type:
    3437 |
    String
    3438 | 3439 | 3440 |
    Default:
    3441 |
    NULL
    3442 |
    3443 | 3444 |
    3445 | 3446 |
    3447 | 3448 |
    Description
    3449 | 3450 |

    3451 | 3452 | The address is required to center the map unless you define a latitude and longitude.

    3453 | 3454 | 3455 |
    Code Examples
    3456 | 3457 | 3458 | 3459 | {exp:gmap:center id="map_canvas" address="New Zealand"} 3460 | 3461 | 3462 |
    3463 | 3464 |
  • 3465 | 3466 |
  • 3467 | 3468 |
    3469 | 3470 | latitude 3471 | 3472 |
    3473 | 3474 |
    Type:
    3475 |
    Degree
    3476 | 3477 |
    Default:
    3478 |
    NULL
    3479 |
    3480 | 3481 |
    3482 | 3483 |
    3484 | 3485 | 3486 |
    Description
    3487 | 3488 |

    3489 | You can define a single latitude and longitude degree if you don't need to use the geocoder.

    3490 | 3491 | 3492 |
    Code Examples
    3493 | 3494 | 3495 | {exp:gmap:center id="map_canvas" latitude="50" longitude="-21"} 3496 | 3497 | 3498 | 3499 |
    3500 | 3501 |
  • 3502 | 3503 |
3504 | 3505 |
3506 | 3507 | 3508 | 3509 |
3510 | 3511 |
{exp:gmap:zoom}
3512 | 3513 |
3514 |

3515 | This is a stand-alone method that allows you to change the map's zoom after it's been initialized and the markers have been added.

3516 |

3517 | Note, if you intend to change the zoom after the map has been initialized and points have been added, make sure you set the extend_bounds parameter to false.

3518 | 3519 |
3520 | 3521 | 3522 |
    3523 | 3524 |
  • 3525 | 3526 |
    3527 | 3528 | id 3529 | 3530 |
    3531 |
    Type:
    3532 | 3533 |
    String
    3534 | 3535 |
    Default:
    3536 |
    NULL
    3537 |
    3538 | 3539 |
    3540 | 3541 |
    3542 | 3543 |
    Description
    3544 | 3545 | 3546 |

    This should be the same value used as the id parameter used to initialize the map. This is how the method knows which map to add a marker to. This is also helpful if you have two maps on a page and want to dynamically add them to one or the other. (Why you would want to do that, I don't know, but now you can.)

    3547 | 3548 |
    Code Examples
    3549 | 3550 | 3551 | {exp:gmap:zoom id="map_canvas" zoom="5"} 3552 | 3553 | 3554 |
    3555 | 3556 | 3557 |
  • 3558 | 3559 |
  • 3560 | 3561 |
    3562 | 3563 | zoom 3564 | 3565 |
    3566 |
    Type:
    3567 |
    Integer (1-20)
    3568 | 3569 | 3570 |
    Default:
    3571 |
    FALSE
    3572 |
    3573 | 3574 |
    3575 | 3576 |
    3577 | 3578 |
    Description
    3579 | 3580 |

    3581 | 3582 | The zoom sets the zoom on the map and is the property that can be found in the Google Map's API. Since it's so common, it's listed here for referrence.

    3583 | 3584 | 3585 |
    Code Examples
    3586 | 3587 | 3588 | {exp:gmap:zoom id="map_canvas" zoom="5"} 3589 | 3590 | 3591 | 3592 |
    3593 | 3594 |
  • 3595 | 3596 |
3597 | 3598 |
3599 | 3600 | 3601 | 3602 |
3603 | 3604 |
3605 | 3606 | 3607 | 3608 |
3609 | 3610 |
3621 | 3622 | 3623 | 3624 | 3625 | 3626 | 3627 | 3628 | 3629 | -------------------------------------------------------------------------------- /third_party/gmap/config.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Copyright (c) 2011 Justin Kimbrell 9 | * @license Creative Commons Attribution 3.0 Unported License - 10 | please see LICENSE file included with this distribution 11 | * @link http://objectivehtml.com/documentation/google-maps-for-expressionengine 12 | */ 13 | 14 | /* 15 | | ------------------------------------------------------------------- 16 | | Plugin Name 17 | | ------------------------------------------------------------------- 18 | */ 19 | 20 | $config['name'] = 'Google Maps For ExressionEngine'; 21 | 22 | 23 | /* 24 | | ------------------------------------------------------------------- 25 | | Version 26 | | ------------------------------------------------------------------- 27 | */ 28 | 29 | $config['version'] = '2.5'; 30 | 31 | 32 | /* End of file gmap.php */ 33 | /* Location: ./system/expressionengine/third_part/gmap/config.php */ -------------------------------------------------------------------------------- /third_party/gmap/config/gmap.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Copyright (c) 2012 Justin Kimbrell 9 | * @license Creative Commons Attribution 3.0 Unported License - 10 | please see LICENSE file included with this distribution 11 | * @link http://objectivehtml.com/google-maps 12 | */ 13 | 14 | class Gmap_ft extends EE_Fieldtype { 15 | 16 | var $info = array( 17 | 'name' => 'Google Maps for ExpressionEngine', 18 | 'version' => '2.5' 19 | ); 20 | 21 | // -------------------------------------------------------------------- 22 | 23 | 24 | function install() 25 | { 26 | return array( 27 | 'gmap_map_height' => '500px', 28 | 'gmap_latitude' => '0', 29 | 'gmap_longitude' => '0', 30 | 'gmap_zoom' => 0, 31 | 'gmap_total_points' => 0, 32 | 'gmap_latitude_field' => NULL, 33 | 'gmap_longitude_field' => NULL 34 | ); 35 | } 36 | 37 | function display_field($coords) 38 | { 39 | $this->EE->load->config('gmap'); 40 | 41 | $field = $this->EE->db->get_where('channel_fields', array('field_id' => $this->settings['field_id']))->row_array(); 42 | 43 | $this->settings = unserialize(base64_decode($field['field_settings'])); 44 | 45 | $coord_string = $coords; 46 | $coords = explode('|', str_replace(')', '', str_replace('(', '', str_replace(')(', '|', $coords)))); 47 | 48 | foreach($coords as $index => $value) 49 | { 50 | $coord = explode(', ', $value); 51 | 52 | if(count($coord) > 1) 53 | { 54 | $coords[$index] = array( 55 | 'lat' => $coord[0], 56 | 'lng' => $coord[1] 57 | ); 58 | } 59 | } 60 | 61 | $options = array( 62 | 'gmap_map_height' => $this->settings['gmap_map_height'], 63 | 'gmap_latitude' => $this->settings['gmap_latitude'], 64 | 'gmap_longitude' => $this->settings['gmap_longitude'], 65 | 'gmap_zoom' => (int) $this->settings['gmap_zoom'], 66 | 'gmap_total_points' => (int) $this->settings['gmap_total_points'], 67 | 'gmap_latitude_field' => $this->settings['gmap_latitude_field'], 68 | 'gmap_longitude_field' => $this->settings['gmap_longitude_field'] 69 | ); 70 | 71 | if($options['gmap_latitude_field'] || $options['gmap_longitude_field']) 72 | { 73 | $this->EE->load->model('field_model'); 74 | 75 | $lat_field = $this->EE->field_model->get_fields('', array( 76 | 'field_name' => $options['gmap_latitude_field'] 77 | ))->row_array(); 78 | 79 | $lng_field = $this->EE->field_model->get_fields('', array( 80 | 'field_name' => $options['gmap_longitude_field'] 81 | ))->row_array(); 82 | } 83 | 84 | 85 | $this->EE->cp->add_to_head(''); 86 | 87 | //$this->EE->javascript->set_global('gmap.'.$this->field_name.'.settings', $options); 88 | 89 | 90 | $script = ''; 91 | foreach($options as $option => $value) 92 | $script .= $option.': \''.$value.'\', '; 93 | 94 | $script = '{'.rtrim(trim($script), ',').'}'; 95 | 96 | $center = ''; 97 | $populate_lat_lng = ''; 98 | 99 | $lat_field['field_id'] = isset($lat_field['field_id']) ? $lat_field['field_id'] : ''; 100 | $lng_field['field_id'] = isset($lng_field['field_id']) ? $lng_field['field_id'] : ''; 101 | $lat_field['field_name'] = isset($lat_field['field_name']) ? $lat_field['field_name'] : ''; 102 | $lng_field['field_name'] = isset($lng_field['field_name']) ? $lng_field['field_name'] : ''; 103 | 104 | 105 | $populate_lat_lng_fn = ' 106 | function populate_lat_lng(lat, lng) { 107 | $("#field_id_'.$lat_field['field_id'].', input[name=\''.$lat_field['field_name'].'\']").val(lat); 108 | $("#field_id_'.$lng_field['field_id'].', input[name=\''.$lng_field['field_name'].'\']").val(lng); 109 | }'; 110 | 111 | if(isset($lat_field) && count($lat_field) > 0 && isset($lng_field) && count($lng_field) > 0) 112 | { 113 | $populate_lat_lng = ' 114 | fieldOpts.gmap_total_points = 1; 115 | populate_lat_lng(location.lat(), location.lng()); 116 | '; 117 | } 118 | 119 | foreach($coords as $coord) 120 | { 121 | $js_coords = ''; 122 | if(is_array($coord)) 123 | { 124 | $js_coords .= ' 125 | location = new google.maps.LatLng('.$coord['lat'].', '.$coord['lng'].'); 126 | 127 | gmap_add_marker(location); 128 | gmap_bounds.extend(location); 129 | gmap.fitBounds(gmap_bounds); 130 | '; 131 | } 132 | } 133 | 134 | $this->EE->javascript->output(' 135 | 136 | var fieldOpts = '.$script.'; 137 | 138 | var location = new google.maps.LatLng(fieldOpts.gmap_latitude, fieldOpts.gmap_longitude); 139 | var gmap_geocoder = new google.maps.Geocoder(); 140 | 141 | var myOptions = { 142 | zoom: parseInt(fieldOpts.gmap_zoom), 143 | center: location, 144 | scrollwheel: false, 145 | mapTypeId: google.maps.MapTypeId.ROADMAP, 146 | disableDoubleClickZoom: true 147 | } 148 | 149 | var gmap_canvas = $("#gmap_canvas").get(0); 150 | var gmap_coords = $("#gmap_coords"); 151 | var gmap_button = document.getElementById("#gmap_submit"); 152 | 153 | var gmap = null; 154 | var gmap_bounds = null; 155 | 156 | var gmap_markers = []; 157 | var gmap_marker_count = 0; 158 | 159 | '.$populate_lat_lng_fn.' 160 | 161 | function gmap_remove_all_markers() { 162 | $(gmap_markers).each(function(i) { 163 | remove_marker(i); 164 | }); 165 | 166 | gmap_coords.val(""); 167 | } 168 | 169 | function remove_marker(id, title) 170 | { 171 | if(title) gmap_coords.val(gmap_coords.val().replace(title, "")); 172 | 173 | gmap_markers[id].setMap(null); 174 | 175 | if(gmap_marker_count > 0) 176 | gmap_marker_count--; 177 | else 178 | gmap_marker_count = 0; 179 | } 180 | 181 | function gmap_add_marker(location, cancelCenter) { 182 | var element = gmap_marker_count; 183 | 184 | if(fieldOpts.gmap_total_points == 0 || fieldOpts.gmap_total_points > gmap_marker_count) { 185 | '.$populate_lat_lng.' 186 | 187 | var marker = new google.maps.Marker({ 188 | map: gmap, 189 | position: location, 190 | draggable: true, 191 | raiseOnDrag: true 192 | }); 193 | 194 | gmap_markers[gmap_marker_count] = marker; 195 | 196 | if(!cancelCenter) { 197 | gmap_bounds.extend(location); 198 | gmap.fitBounds(gmap_bounds); 199 | } 200 | 201 | var html = "
" + location + "

" + "Remove from Map
"; 202 | 203 | var infowindow = new google.maps.InfoWindow({ 204 | content: html 205 | }); 206 | 207 | google.maps.event.addListener(marker, \'dragstart\', function(event) { 208 | gmap_coords.val(gmap_coords.val().replace(String(event.latLng), \'\')); 209 | }); 210 | 211 | google.maps.event.addListener(marker, \'dragend\', function(event) { 212 | var new_location = event.latLng; 213 | 214 | infowindow.setContent("
" + new_location + "

" + "Remove from Map
"); 215 | 216 | gmap_coords.val(new_location + gmap_coords.val()); 217 | }); 218 | 219 | google.maps.event.addListener(marker, \'click\', function(event) { 220 | infowindow.open(gmap, marker); 221 | }); 222 | 223 | gmap_coords.val(location + gmap_coords.val()); 224 | 225 | gmap_marker_count++; 226 | } else { 227 | alert("You can only add "+fieldOpts.gmap_total_points+" point(s) on the map."); 228 | } 229 | } 230 | 231 | $("#gmap_canvas").click(function(e) { 232 | $(this).unbind("click"); 233 | 234 | // before we go any further, clear out input because we will recreate it via js 235 | gmap_coords.val(""); 236 | 237 | gmap = new google.maps.Map(gmap_canvas, myOptions); 238 | gmap_bounds = new google.maps.LatLngBounds(); 239 | 240 | google.maps.event.addListener(gmap, \'dblclick\', function(event) { 241 | gmap_add_marker(event.latLng, true); 242 | 243 | }); 244 | 245 | $(".gmap-remove").live("click", function() { 246 | var $t = $(this); 247 | var id = String($t.attr("id")); 248 | var title = $t.attr("title"); 249 | 250 | remove_marker(id, title); 251 | 252 | return false; 253 | }); 254 | 255 | $(".gmap-remove-all").click(function() { 256 | gmap_remove_all_markers(); 257 | 258 | return false; 259 | }); 260 | 261 | $("#gmap_address").keypress(function(event) { 262 | if(event.keyCode == 13) { 263 | $("#gmap_submit").click(); 264 | return false; 265 | } 266 | }); 267 | 268 | $("#gmap_submit").click(function() { 269 | (function () { /* Fixes a known bug with Google\'s API with displaying the InfoWindow(s) */ 270 | var address = $("#gmap_address").val(); 271 | 272 | gmap_geocoder.geocode( { \'address\': address}, function(results, status) { 273 | if (status == google.maps.GeocoderStatus.OK) { 274 | 275 | var coord = results[0].geometry.location; 276 | 277 | gmap_add_marker(coord); 278 | 279 | $("#gmap_address").val("").focus(); 280 | } else { 281 | alert("Geocode was not successful for the following reason: " + status); 282 | } 283 | }); 284 | })(); 285 | }); 286 | 287 | gmap_coords.blur(function() { 288 | coord_string = $(this).val(); 289 | coords = coord_string.split(\')(\'); 290 | 291 | gmap_remove_all_markers(); 292 | 293 | if(coord_string != \'\') { 294 | for(i = 0; i < coords.length; i++) { 295 | var coord = coords[i].split(\', \'); 296 | 297 | if(coord.length >= 2) { 298 | var new_latitude = coord[0].replace(\'(\', \'\').replace(\')\', \'\'); 299 | var new_longitude = coord[1].replace(\')\', \'\').replace(\'(\', \'\'); 300 | 301 | var location = new google.maps.LatLng(new_latitude, new_longitude); 302 | 303 | gmap_add_marker(location); 304 | } else { 305 | alert("There is an error in the coordinate formatting: "+coord); 306 | } 307 | } 308 | } 309 | 310 | }); 311 | 312 | ' . $js_coords . ' 313 | }); 314 | 315 | '); 316 | 317 | 318 | $vars = array( 319 | 'height' => $options['gmap_map_height'], 320 | 'coords' => $coord_string, 321 | 'field_name' => $this->field_name 322 | ); 323 | 324 | 325 | return $this->EE->load->view('map', $vars, TRUE); 326 | } 327 | 328 | function display_settings($data) 329 | { 330 | // load the language file 331 | $this->EE->lang->loadfile('gmap'); 332 | 333 | $data = array( 334 | 'gmap_latitude' => isset($data['gmap_longitude']) ? $data['gmap_latitude'] : 335 | $this->settings['gmap_latitude'], 'gmap_longitude' => isset($data['gmap_longitude']) ? $data['gmap_longitude'] : 336 | $this->settings['gmap_longitude'], 'gmap_zoom' => isset($data['gmap_zoom']) ? $data['gmap_zoom'] : 337 | $this->settings['gmap_zoom'], 338 | 'gmap_total_points' => isset($data['gmap_total_points']) ? $data['gmap_total_points'] : 339 | $this->settings['gmap_total_points'], 340 | 'gmap_map_height' => isset($data['gmap_map_height']) ? $data['gmap_map_height'] : 341 | $this->settings['gmap_map_height'], 342 | 'gmap_latitude_field' => isset($data['gmap_latitude_field']) ? $data['gmap_latitude_field'] : 343 | $this->settings['gmap_latitude_field'], 344 | 'gmap_longitude_field' => isset($data['gmap_longitude_field']) ? $data['gmap_longitude_field'] : 345 | $this->settings['gmap_longitude_field'] 346 | ); 347 | 348 | if(empty($data['gmap_latitude'])) 349 | $data['gmap_latitude'] = 0; 350 | 351 | if(empty($data['gmap_longitude'])) 352 | $data['gmap_longitude'] = 0; 353 | 354 | $this->EE->cp->add_to_head(''); 355 | 356 | $this->EE->javascript->output(' 357 | 358 | var timer = setInterval(shouldInit, 1000); // check if map should be inited 359 | var mapInited = false; 360 | 361 | var gmap_canvas; 362 | var gmap; 363 | 364 | function shouldInit() 365 | { 366 | if(mapInited) return; 367 | 368 | if($("#gmap_wrapper").is(":visible")) { 369 | 370 | mapInited = true; 371 | clearInterval(timer); 372 | 373 | gmap_canvas = $("#gmap_canvas").get(0); 374 | 375 | var location = new google.maps.LatLng('.$data['gmap_latitude'].', '.$data['gmap_longitude'].'); 376 | var gmap_geocoder = new google.maps.Geocoder(); 377 | 378 | var myOptions = { 379 | zoom: '.$data['gmap_zoom'].', 380 | center: location, 381 | mapTypeId: google.maps.MapTypeId.ROADMAP 382 | } 383 | 384 | gmap = new google.maps.Map(gmap_canvas, myOptions); 385 | 386 | google.maps.event.addListener(gmap, \'center_changed\', function() { 387 | var center = gmap.getCenter(); 388 | $("#gmap_latitude").val(center.lat()); 389 | $("#gmap_longitude").val(center.lng()); 390 | }); 391 | 392 | google.maps.event.addListener(gmap, \'zoom_changed\', function() { 393 | var zoom = gmap.getZoom(); 394 | $("#gmap_zoom").val(zoom); 395 | }); 396 | } 397 | } 398 | 399 | var gmap_canvas = $("#gmap_canvas").get(0); 400 | 401 | var location = new google.maps.LatLng('.$data['gmap_latitude'].', '.$data['gmap_longitude'].'); 402 | var gmap_geocoder = new google.maps.Geocoder(); 403 | 404 | var myOptions = { 405 | zoom: '.$data['gmap_zoom'].', 406 | center: location, 407 | scrollwheel : false, 408 | mapTypeId: google.maps.MapTypeId.ROADMAP 409 | } 410 | 411 | var gmap = new google.maps.Map(gmap_canvas, myOptions); 412 | 413 | google.maps.event.addListener(gmap, \'center_changed\', function() { 414 | var center = gmap.getCenter(); 415 | $("#gmap_latitude").val(center.lat()); 416 | $("#gmap_longitude").val(center.lng()); 417 | }); 418 | 419 | google.maps.event.addListener(gmap, \'zoom_changed\', function() { 420 | var zoom = gmap.getZoom(); 421 | $("#gmap_zoom").val(zoom); 422 | }); 423 | 424 | $("#gmap_latitude, #gmap_longitude").blur(function() { 425 | var lat = parseFloat($("#gmap_latitude").val()); 426 | var lng = parseFloat($("#gmap_longitude").val()); 427 | 428 | if(!isNaN(lat) && !isNaN(lat)) { 429 | var new_location = new google.maps.LatLng(lat, lng); 430 | 431 | gmap.setCenter(new_location); 432 | 433 | } else { 434 | alert("Invalid latitude or longitude: "+lat+", "+lng); 435 | } 436 | }); 437 | 438 | $("#gmap_zoom").blur(function() { 439 | var zoom = parseInt($("#gmap_zoom").val()); 440 | 441 | if(zoom <= 20 && zoom >= 0) { 442 | gmap.setZoom(zoom); 443 | } else { 444 | alert("Invalid zoom: "+zoom+". The zoom must be between 0 and 20."); 445 | } 446 | }); 447 | 448 | $("#gmap_map_height").blur(function() { 449 | $("#gmap_wrapper").css("height", $(this).val()); 450 | }); 451 | '); 452 | 453 | $this->EE->table->add_row( 454 | lang('gmap_latitude', 'gmap_latitude').'
'.lang('gmap_latitude_description'), 455 | form_input(array( 456 | 'name' => 'gmap_latitude', 457 | 'id' => 'gmap_latitude', 458 | 'value' => $data['gmap_latitude'] 459 | )) 460 | ); 461 | 462 | $this->EE->table->add_row( 463 | lang('gmap_longitude', 'gmap_longitude').'
'.lang('gmap_longitude_description'), 464 | form_input(array( 465 | 'name' => 'gmap_longitude', 466 | 'id' => 'gmap_longitude', 467 | 'value' => $data['gmap_longitude'] 468 | )) 469 | ); 470 | 471 | $this->EE->table->add_row( 472 | lang('gmap_zoom', 'gmap_zoom').'
'.lang('gmap_zoom_description'), 473 | form_input(array( 474 | 'name' => 'gmap_zoom', 475 | 'id' => 'gmap_zoom', 476 | 'value' => $data['gmap_zoom'] 477 | )) 478 | ); 479 | 480 | $this->EE->table->add_row( 481 | lang('gmap_total_points', 'gmap_total_points').'
'.lang('gmap_total_points_description'), 482 | form_input(array( 483 | 'name' => 'gmap_total_points', 484 | 'id' => 'gmap_total_points', 485 | 'value' => $data['gmap_total_points'] 486 | )) 487 | ); 488 | 489 | $this->EE->table->add_row( 490 | lang('gmap_latitude_field', 'gmap_latitude_field').'
'.lang('gmap_latitude_field_description'), 491 | form_input(array( 492 | 'name' => 'gmap_latitude_field', 493 | 'id' => 'gmap_latitude_field', 494 | 'value' => $data['gmap_latitude_field'] 495 | )) 496 | ); 497 | 498 | $this->EE->table->add_row( 499 | lang('gmap_longitude_field', 'gmap_longitude_field').'
'.lang('gmap_longitude_field_description'), 500 | form_input(array( 501 | 'name' => 'gmap_longitude_field', 502 | 'id' => 'gmap_longitude_field', 503 | 'value' => $data['gmap_longitude_field'] 504 | )) 505 | ); 506 | 507 | $this->EE->table->add_row( 508 | lang('gmap_map_height', 'gmap_map_height').'
'.lang('gmap_map_height_description'), 509 | form_input(array( 510 | 'name' => 'gmap_map_height', 511 | 'id' => 'gmap_map_height', 512 | 'value' => $data['gmap_map_height'] 513 | )) 514 | ); 515 | 516 | $this->EE->table->add_row( 517 | lang('gmap_preview', 'gmap_preview').'
'. 518 | lang('gmap_preview_description').'
'.'
'. 519 | ''.lang('gmap_google_map_render_bug').'', 520 | '
click to activate map
' 521 | ); 522 | 523 | } 524 | 525 | /*function display_global_settings() 526 | { 527 | 528 | $val = array_merge($this->settings, $_POST); 529 | 530 | return $this->EE->load->view('field_type/settings', $val, TRUE); 531 | } 532 | 533 | function save_global_settings() 534 | { 535 | return array_merge($this->settings, $_POST); 536 | }*/ 537 | 538 | function save_settings() 539 | { 540 | return array_merge($this->settings, $_POST); 541 | } 542 | 543 | function replace_tag($data, $params = array(), $tagdata = FALSE) 544 | { 545 | return $data; 546 | } 547 | 548 | } 549 | // END Google_maps_ft class 550 | 551 | /* End of file ft.google_maps.php */ 552 | /* Location: ./system/expressionengine/third_party/google_maps/ft.google_maps.php */ -------------------------------------------------------------------------------- /third_party/gmap/language/dutch/lang.gmap.php: -------------------------------------------------------------------------------- 1 | 'Google Maps voor ExpressionEngine', 6 | 'gmap_module_description' => 'De volledige Google Maps implementatie voor ExpressionEngine.', 7 | 8 | 'gmap_center' => 'Locatie van het middelpunt', 9 | 'gmap_center_description' => 'Als alternatief geef een locatie (adres, stad, staat, postcode, etc) die door middel van Google\'s geocoder zal gebruikt worden om de coördinaten op te zoeken van het middelpunt waarop de map zal gecentreerd worden.', 10 | 11 | 'gmap_latitude' => 'Breedtegraad', 12 | 'gmap_latitude_description' => 'U kan het standaard middelpunt van de map bepalen door het invoeren van een breedte-en lengtegraad', 13 | 14 | 'gmap_longitude' => 'Lengtegraad', 15 | 'gmap_longitude_description' => 'U kan het standaard middelpunt van de map bepalen door het invoeren van een breedte-en lengtegraad.', 16 | 17 | 'gmap_zoom' => 'Zoom', 18 | 'gmap_zoom_description' => 'Stel het standaard zoomniveau in.', 19 | 20 | 'gmap_total_points' => 'Totaal aantal punten', 21 | 'gmap_total_points_description' => 'Het totaal aantal locaties dat de gebruiker mag toevoegen op de map.
(0 = ongelimiteerd)', 22 | 23 | 'gmap_map_height' => 'Hoogte van de map', 24 | 'gmap_map_height_description' => 'Voer een aangepaste hoogte voor de map in. (De standaard hoogte is "500px")', 25 | 26 | 'gmap_preview' => 'Map Voorbeeld', 27 | 'gmap_preview_description' => 'Dit is een voorbeeld van hoe de map er zal uitzien zonder toegevoegde locaties', 28 | 'gmap_google_map_render_bug' => 'Map niet correct weergegeven? Als dit gebeurt, vernieuw uw browser pagina.', 29 | 30 | 'gmap_latitude_field' => 'Breedtegraad Veld', 31 | 'gmap_latitude_field_description' => 'U kan een ander veld definiëren in het kanaal die de waarde van één breedtegraad bewaard. Als u dit veld gebruikt, zal de gebruiker gelimiteerd zijn tot 1 locatie per item (entry). Gebruik dit veld als u de breedtegraad wil bijhouden in één kolom. Dit veld is nodig om locaties binnen een bepaalde straal te bepalen.', 32 | 33 | 'gmap_longitude_field' => 'Lengtegraad veld', 34 | 'gmap_longitude_field_description' => 'U kan een ander veld definiëren in het kanaal die de waarde van één lengtegraad bewaard. Als u dit veld gebruikt, zal de gebruiker gelimiteerd zijn tot 1 locatie per item (entry). Gebruik dit veld als u de lengtegraad wil bijhouden in één kolom. Dit veld is nodig om locaties binnen een bepaalde straal te bepalen.', 35 | 36 | // 37 | ''=>'' 38 | ); -------------------------------------------------------------------------------- /third_party/gmap/language/english/lang.gmap.php: -------------------------------------------------------------------------------- 1 | 'Google Maps for ExpressionEngine', 6 | 'gmap_module_description' => 'insert description here.', 7 | 8 | 'gmap_center' => 'Center Location', 9 | 'gmap_center_description' => 'Alternatively, enter an location (address, city, state, zip code, etc) that will be use Google\'s geocoder to get the coordinate to be used as the center.', 10 | 11 | 'gmap_latitude' => 'Latitude', 12 | 'gmap_latitude_description' => 'You can set the default map center by entering a latitude & longitude.', 13 | 14 | 'gmap_longitude' => 'Longitude', 15 | 'gmap_longitude_description' => 'You can set the default map center by entering a latitude & longitude.', 16 | 17 | 'gmap_zoom' => 'Zoom', 18 | 'gmap_zoom_description' => 'Set the default zoom level.', 19 | 20 | 'gmap_total_points' => 'Total Points', 21 | 'gmap_total_points_description' => 'The total points the user is allowed to add to the map.
(0 = Unlimited)', 22 | 23 | 'gmap_map_height' => 'Map Height', 24 | 'gmap_map_height_description' => 'Enter a custom height for the map to appear in the control panel. (The default height is "500px")', 25 | 26 | 'gmap_preview' => 'Map Preview', 27 | 'gmap_preview_description' => 'This map represent want a map will look like in the channel without any points added to the map', 28 | 'gmap_google_map_render_bug' => 'Map not displaying properly? Sometimes Google Maps bugs out and the map won\'t render properly. If this happens, refresh your browser.', 29 | 30 | 'gmap_latitude_field' => 'Latitude Field', 31 | 'gmap_latitude_field_description' => 'You can define another custom field within the channel to store a single latitude degree. If you use this field, the user will be limited to one location per entry. Use this field anytime you need the latitude stored inside a single column. This field is required to recall entries with a defined radius.', 32 | 33 | 'gmap_longitude_field' => 'Longitude Field', 34 | 'gmap_longitude_field_description' => 'You can define another custom field within the channel to store a single longitude degree. If you use this field, the user will be limited to one location per entry. Use this field anytime you need the longitude stored inside a single column. This field is required to recall entries within a defined radius.', 35 | 36 | // 37 | ''=>'' 38 | ); -------------------------------------------------------------------------------- /third_party/gmap/language/french/lang.gmap.php: -------------------------------------------------------------------------------- 1 | 'Google Maps pour ExpressionEngine', 8 | 'gmap_module_description' => 'Une implémentation complète de Google Map pour ExpressionEngine.', 9 | 10 | 'gmap_center' => 'Centrer sur la localisation', 11 | 'gmap_center_description' => 'Vous pouvez aussi spécifier une localisation (adresse, ville, état, code postal, etc. ). Le geocodeur de Google utilisera cette localisation comme centre de la carte', 12 | 13 | 'gmap_latitude' => 'Latitude', 14 | 'gmap_latitude_description' => 'Spécifiez le centre de la carte par défaut en précisant une latitude et une longitude', 15 | 16 | 'gmap_longitude' => 'Longitude', 17 | 'gmap_longitude_description' => 'Spécifiez le centre de la carte par défaut en précisant une latitude et une longitude.', 18 | 19 | 'gmap_zoom' => 'Zoom', 20 | 'gmap_zoom_description' => 'Le niveau de zoom par défaut.', 21 | 22 | 'gmap_total_points' => 'Nombre total de points', 23 | 'gmap_total_points_description' => 'Le nombre total de points que l\'utilisateur peut ajouter à la carte..
; (0 = Illimité)', 24 | 25 | 'gmap_map_height' => 'Hauteur de la carte', 26 | 'gmap_map_height_description' => 'Spécifiez une hauteur pour la carte dans le control panel (la hauteur par défaut est de 500px)', 27 | 28 | 'gmap_preview' => 'Prévisualisation', 29 | 'gmap_preview_description' => 'Cette carte représente une carte sans aucun point spécifié, telle qu\'elle aparaîtra dans le channel.', 30 | 'gmap_google_map_render_bug' => 'Votre carte ne s\'affiche pas comme elle le devrait ? Il s\'agit parfois d\'un bug de Google Map qui se règle en rafraichissant la fenêtre de votre navigateur.', 31 | 32 | 'gmap_latitude_field' => 'Champ latitude', 33 | 'gmap_latitude_field_description' => 'Vous pouvez définir un autre custom field contenant une latitude spécifique pour un channel. Si vous utilisez ce champ, l\'utilisateur sera limité à une localisation par entrée. Utilisez ce champ à chaque fois que vous avez besoin d\'une latitude stockée dans une simple colonne. Ce champ est obligatoire pour rapeller des entrée dans une certaine circonférence.', 34 | 35 | 'gmap_longitude_field' => 'Champ longitude', 36 | 'gmap_longitude_field_description' => 'Vous pouvez définir un autre custom field contenant une latitude spécifique pour un channel. Si vous utilisez ce champ, l\'utilisateur sera limité à une localisation par entrée. Utilisez ce champ à chaque fois que vous avez besoin d\'une latitude stockée dans une simple colonne. Ce champ est obligatoire pour rapeller des entrée dans une certaine circonférence.', 37 | 38 | // 39 | ''=>'' 40 | ); -------------------------------------------------------------------------------- /third_party/gmap/language/norwegian/lang.gmap.php: -------------------------------------------------------------------------------- 1 | 'Google Maps for ExpressionEngine', 6 | 'gmap_module_description' => 'skriv inn beskrivelse her.', 7 | 8 | 'gmap_center' => 'Sentrer plasseringen', 9 | 'gmap_center_description' => 'Alternativt, skriv inn en adresse (gateadresse, by, postnummer, etc) og Googles Geocoder finner koordinatene for deg', 10 | 11 | 'gmap_latitude' => 'Breddegrad', 12 | 'gmap_latitude_description' => 'Du kan sette standard sentrering av kartet ved å skrive inn bredde- og lengdegrad.', 13 | 14 | 'gmap_longitude' => 'Lengdegrad', 15 | 'gmap_longitude_description' => 'Du kan sette standard sentrering av kartet ved å skrive inn bredde- og lengdegrad.', 16 | 17 | 'gmap_zoom' => 'Zoom', 18 | 'gmap_zoom_description' => 'Skriv inn standard zoom-nivå.', 19 | 20 | 'gmap_total_points' => 'Antall punkter', 21 | 'gmap_total_points_description' => 'Antall punkter brukeren kan sett inn på kartet.
(0 = Ubegrenset)', 22 | 23 | 'gmap_map_height' => 'Kartets høyde', 24 | 'gmap_map_height_description' => 'Skriv inn en egendefinert høyde for kartvisning i kontrollpanelet. (Standard høyde er "500px")', 25 | 26 | 'gmap_preview' => 'Forhåndsvisning kart', 27 | 'gmap_preview_description' => 'Slik vil kartet se ut på nettsidene dersom ingen plasseringer er lagt inn.', 28 | 'gmap_google_map_render_bug' => 'Ser ikke kartet riktig ut? Noen ganger kan feil hos Google Maps føre til feil i kartvisningen. Dersom det skjer, prøv å laste sidene på nytt.', 29 | 30 | 'gmap_latitude_field' => 'Breddegrad', 31 | 'gmap_latitude_field_description' => 'Dette feltet brukes dersom kart skal vises med en bestemt radius. Ved å bruke dette feltet kan brukeren kun sette inn en plassering pr. artikkel.', 32 | 33 | 'gmap_longitude_field' => 'Lengdegrad', 34 | 'gmap_longitude_field_description' => 'Dette feltet brukes dersom kart skal vises med en bestemt radius. Ved å bruke dette feltet kan brukeren kun sette inn en plassering pr. artikkel.', 35 | 36 | // 37 | ''=>'' 38 | ); -------------------------------------------------------------------------------- /third_party/gmap/language/spanish/lang.gmap.php: -------------------------------------------------------------------------------- 1 | 'Mapas de Google para ExpressionEngine', 6 | 'gmap_module_description' => 'La implementación completa de Mapas de Google para ExpressionEngine.', 7 | 8 | 'gmap_center' => 'Centre la ubicación', 9 | 'gmap_center_description' => 'Ingrese una ubicación (Dirección, Ciudad, Estado, Código Postal, Etc) Que usara el geocodificador de Google\'s para centrar el mapa.', 10 | 11 | 'gmap_latitude' => 'Latitud', 12 | 'gmap_latitude_description' => 'Tu puedes establecer el mapa automático al ingresar la latitud y longitud.', 13 | 14 | 'gmap_longitude' => 'Longitud', 15 | 'gmap_longitude_description' => 'Tu puedes establecer el mapa automático al ingresar la latitud y longitud.', 16 | 17 | 'gmap_zoom' => 'Zoom', 18 | 'gmap_zoom_description' => 'Establece el nivel de zoom automatizado.', 19 | 20 | 'gmap_total_points' => 'Puntos totales', 21 | 'gmap_total_points_description' => 'Los puntos totales que al usuario le es permitido añadir en el mapa.
(0 = Ilimitado)', 22 | 23 | 'gmap_map_height' => 'Altura del Mapa', 24 | 'gmap_map_height_description' => 'Ingrese una altura determinada para el mapa en el panel de control. (La altura automática es de "500px")', 25 | 26 | 'gmap_preview' => 'Vision previa del mapa', 27 | 'gmap_preview_description' => 'Este mapa representa el cómo se verá el producto final en el canal sin puntos añadidos.', 28 | 'gmap_google_map_render_bug' => 'El mapa no se muestra correctamente? Algunas veces los mapas de google tienen errores y el mapa no se expondrá adecuadamente. Si esto sucede, solo recargue su navegador', 29 | 30 | 'gmap_latitude_field' => 'Campo para Latutud', 31 | 'gmap_latitude_field_description' => 'Usted puede definir otro campo dentro del canal para guardar cualquier grado de latitud. Si usted utiliza este campo, el usuario estará limitado a una ubicación por entrada. Utilice este campo cada vez que usted necesite guardar una latitud en una columna. Este campo requiere entradas dentro de un radio definido.', 32 | 33 | 'gmap_longitude_field' => 'Campo para Longitud.', 34 | 'gmap_longitude_field_description' => 'Usted puede definir otro campo dentro del canal para guardar cualquier grado de longitud. Si usted utiliza este campo, el usuario estará limitado a una ubicación por entrada. Utilice este campo cada vez que usted necesite guardar una longitud en una columna. Este campo requiere entradas dentro de un radio definido.', 35 | 36 | // 37 | ''=>'' 38 | ); -------------------------------------------------------------------------------- /third_party/gmap/pi.gmap.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Copyright (c) 2012 Justin Kimbrell 9 | * @license Creative Commons Attribution 3.0 Unported License - 10 | please see LICENSE file included with this distribution 11 | * @link http://objectivehtml.com/google-maps 12 | */ 13 | 14 | $plugin_info = array( 15 | 'pi_name' => 'Google Maps for ExpressionEngine', 16 | 'pi_version' => '2.5', 17 | 'pi_author' => 'Justin Kimbrell', 18 | 'pi_author_url' => 'http://objectivehtml.com/documentation/google-maps-for-expressionengine', 19 | 'pi_description' => 'Creates static and dynamic maps from content channels.', 20 | 'pi_usage' => Gmap::usage() 21 | ); 22 | 23 | 24 | Class Gmap { 25 | 26 | private $args = array( 27 | 28 | /* Google Map Parameters */ 29 | 'map' => array( 30 | 'backgroundColor', 'disableDefaultUI', 'disableDoubleClickZoom', 'draggable', 31 | 'draggableCursor', 'heading', 'keyboardShortcuts', 'mapTypeControl', 32 | 'mapTypeControlOptions', 'mapTypeId', 'maxZoom', 'minZoom', 'noClear', 33 | 'overviewMapControl', 'overviewMapControlOptions', 'panControl', 'panControlOptions', 'rotateControl', 'rotateControlOptions', 'scaleControl', 'scaleControlOptions', 34 | 'scrollwheel', 'streetView', 'streetViewControl', 'streetViewControlOptions', 35 | 'tilt', 'title', 'zoomControl', 'zoomControlOptions', 'zoom' 36 | ), 37 | 38 | /* EE Channel Parameters */ 39 | 'channel' => array( 40 | 'author_id', 'backspace', 'cache', 'refresh', 'cat_limit', 'category', 41 | 'category_group', 'isable','channel', 'display_by', 'dynamic', 'dynamic_start', 42 | 'entry_id', 'entry_id_from', 'entry_id_to', 'fixed_order', 'group_id', 'limit', 43 | 'month_limit', 'offset', 'orderby', 'paginate', 'paginate_base', 'paginate_type', 'related_categories_mode', 'relaxed_categories', 'require_entry', 'show_current_week', 44 | 'show_expired', 'show_future_entries', 'show_pages', 'sort', 'start_day', 'start_on', 45 | 'status', 'stop_before', 'sticky', 'track_views', 'uncategorized_entries', 'url_title', 46 | 'username', 'week_sort', 'year', 'month', 'day' 47 | ), 48 | 49 | /* Plugin & Convenience Parameters */ 50 | 'plugin' => array( 51 | 'center', 'channel', 'hide_markers', 'open_windows', 'map_type', 'id', 'class', 'style', 52 | 'style_link', 'style_obj', 'extend_bounds', 'show_one_window', 'icon', 'show_coordinate', 53 | 'add_title_to_dropdown', 'metric', 'offset', 'distance', 'cache_post', 'show_sql', 'require', 54 | 'name' 55 | ), 56 | 57 | /* Dynamic and Static fields */ 58 | 'fields' => array( 59 | 'address_field', 'city_field', 'state_field', 'zipcode_field', 'country_field', 60 | 'latitude_field', 'longitude_field', 'zoom_field', 'address', 'latitude', 'longitude', 61 | 'gmap_field', 'lat_lng' 62 | ) 63 | 64 | ); 65 | 66 | public $geocoder_response; 67 | 68 | public function __construct() 69 | { 70 | $this->EE =& get_instance(); 71 | 72 | $this->EE->load->config('gmap'); 73 | } 74 | 75 | public function init() 76 | { 77 | $this->args = $this->_fetch_params(FALSE); 78 | 79 | return $this->_init_map(); 80 | } 81 | 82 | public function center() 83 | { 84 | $this->args = $this->_fetch_params(FALSE); 85 | 86 | $data = ''; 105 | 106 | return $data; 107 | } 108 | 109 | public function marker($manual_zoom = FALSE) 110 | { 111 | $this->args = $this->_fetch_params(FALSE); 112 | 113 | $tagdata = trim($this->EE->TMPL->advanced_conditionals($this->EE->TMPL->tagdata)); 114 | 115 | $manual_zoom = $manual_zoom ? $this->args['map']['zoom'] : FALSE; 116 | 117 | $map = 118 | ''; 125 | 126 | return $map; 127 | } 128 | 129 | private function _create_id_string($results) 130 | { 131 | $ids = array(); 132 | 133 | foreach($results as $row) 134 | { 135 | $ids[] = $row->entry_id; 136 | } 137 | 138 | return implode('|', $ids); 139 | } 140 | 141 | private function _convert_metric($metric = 'miles') 142 | { 143 | $metrics = array( 144 | 'miles' => 1, 145 | 'feet' => 5280, 146 | 'kilometers' => 1.609344, 147 | 'meters' => 1609.344 148 | ); 149 | 150 | $return = isset($metrics[$metric]) ? $metrics[$metric] : $metrics['miles']; 151 | 152 | return isset($metrics[$metric]) ? $metrics[$metric] : $metrics['miles']; 153 | } 154 | 155 | private function _prep_fields($prep_fields) 156 | { 157 | if(is_array($prep_fields)) 158 | { 159 | foreach($prep_fields as $prep_index => $prep_value) 160 | { 161 | $where .= $prep_value .' AND '; 162 | } 163 | } 164 | 165 | $where = rtrim($where, ' AND ') . ' OR '; 166 | 167 | return $where; 168 | } 169 | 170 | private function _prep_sql_fieldname($field_array, $user_value = FALSE, $to_append = TRUE) 171 | { 172 | $return = FALSE; 173 | $string = array(); 174 | 175 | //Converts a single field to an array 176 | $field_array = is_array($field_array) ? $field_array : array($field_array => ''); 177 | 178 | //Loops through the field array 179 | foreach($field_array as $field_name => $field_value) 180 | { 181 | $value = FALSE; 182 | 183 | //Fallsback to the post variable if no value is passed 184 | $value = !empty($field_value) ? $field_value : $user_value; 185 | $value = $value ? $value : $this->EE->input->post($field_name); 186 | 187 | //Creates the SQL field name by removed the reserved terms 188 | $sql_field_name = str_replace($this->reserved_terms, '', $field_name); 189 | 190 | //Gets the field data and if the field exists, the sql statement is created 191 | $field_data = $this->EE->field_model->get_fields('', array('field_name' => $sql_field_name)); 192 | 193 | if($field_data->num_rows() > 0) 194 | { 195 | //Validates that a value is not FALSE 196 | if($value !== FALSE && !empty($value) || $to_append == FALSE) 197 | { 198 | //If to_append is TRUE, then the operator is appended 199 | if($to_append == TRUE) 200 | { 201 | //Converts a value string to a variable 202 | $values = is_array($value) ? $value : array($value); 203 | 204 | //Loops through the values array and creates the SQL conditions 205 | foreach($values as $value) 206 | { 207 | $operator = $this->_prep_value($field_name, $value); 208 | 209 | $string[] = '`field_id_'.$field_data->row('field_id').'` '.$operator; 210 | } 211 | } 212 | else 213 | { 214 | $string[] = '`field_id_'.$field_data->row('field_id').'`'; 215 | } 216 | } 217 | } 218 | } 219 | 220 | return $string; 221 | } 222 | 223 | private function _prep_value($field_name, $value) 224 | { 225 | //Preps conditional statement by testing the field_name for keywords 226 | if(strpos($field_name, '_min')) 227 | $operator = ' >= \''.$value.'\''; 228 | else if(strpos($field_name, '_max')) 229 | $operator = ' <= \''.$value.'\''; 230 | else if(strpos($field_name, '_like')) 231 | $operator = ' LIKE \'%'.$value.'%\''; 232 | else 233 | $operator = ' = \''.$value.'\' '; 234 | 235 | return $operator; 236 | } 237 | 238 | private function _get_required_field_errors($vars = FALSE) 239 | { 240 | if(!$vars) $vars = array(); 241 | 242 | $required_fields = explode('|', $this->args['plugin']['require']); 243 | 244 | $this->EE->load->library('form_validation'); 245 | $this->EE->form_validation->set_error_delimiters('', ''); 246 | 247 | foreach($required_fields as $field) 248 | { 249 | $this->EE->form_validation->set_rules($field, ucwords(str_replace(array('-', '_'), ' ', $field)), 'trim|required'); 250 | } 251 | 252 | if ($this->EE->form_validation->run() == FALSE) 253 | { 254 | $error_count = 0; 255 | 256 | foreach($required_fields as $field) 257 | { 258 | if(form_error($field)) 259 | { 260 | $vars[0]['error:'.$field] = form_error($field); 261 | $vars[0]['global_errors'][] = array( 262 | 'field_name' => $field, 263 | 'error' => form_error($field) 264 | ); 265 | 266 | $error_count++; 267 | } 268 | } 269 | 270 | $vars[0]['total_errors'] = $error_count; 271 | } 272 | else 273 | { 274 | $vars[0]['total_errors'] = 0; 275 | } 276 | 277 | return $vars; 278 | } 279 | 280 | private function _geocode_location($location) 281 | { 282 | $sensor = 'true'; 283 | $url = 'http://maps.googleapis.com/maps/api/geocode/json?&sensor=' . $sensor . 284 | '&address='.urlencode($location); 285 | $timeout = 5000; 286 | 287 | $curl_handle = curl_init(); 288 | curl_setopt($curl_handle, CURLOPT_URL, $url); 289 | curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, $timeout); 290 | curl_setopt($curl_handle, CURLOPT_TIMEOUT, $timeout); 291 | curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); 292 | 293 | $response = curl_exec($curl_handle); 294 | curl_close($curl_handle); 295 | 296 | return json_decode($response); 297 | } 298 | 299 | private function _geocode_response($response_array, $depth = 1) 300 | { 301 | $return = array(); 302 | 303 | foreach($response_array->results as $index => $response) 304 | { 305 | if($index < $depth || $depth == 0) 306 | { 307 | foreach($response->address_components as $component) 308 | { 309 | $return[$index]['geocoder:address_component'][] = array( 310 | 'long_name' => $component->long_name, 311 | 'short_name' => $component->short_name, 312 | 'types' => implode(', ', $component->types) 313 | ); 314 | } 315 | } 316 | } 317 | 318 | if(is_object($response)) 319 | { 320 | $return['geocoder:formatted_address'] = $response->formatted_address; 321 | $return['geocoder:latitude'] = $response->geometry->location->lat; 322 | $return['geocoder:longitude'] = $response->geometry->location->lng; 323 | $return['geocoder:status'] = $response_array->status; 324 | } 325 | 326 | return $return; 327 | } 328 | 329 | private function _is_checked_or_selected($post, $item) 330 | { 331 | if(is_array($post)) 332 | { 333 | foreach($post as $post_index => $post_value) 334 | { 335 | if($item == $post_value) 336 | { 337 | return TRUE; 338 | } 339 | } 340 | } 341 | else 342 | { 343 | if($item == $post) 344 | { 345 | return TRUE; 346 | } 347 | } 348 | 349 | return FALSE; 350 | } 351 | 352 | public function zoom() 353 | { 354 | $this->args = $this->_fetch_params(); 355 | 356 | $data = NULL; 357 | 358 | if($this->args['map']['zoom'] !== FALSE) 359 | { 360 | $data = 361 | ''; 364 | } 365 | 366 | return $data; 367 | } 368 | 369 | private function _init_map($plot_coords = TRUE) 370 | { 371 | $tagdata = $this->EE->TMPL->tagdata; 372 | 373 | $map = NULL; 374 | 375 | if($this->args['plugin']['style_link']) 376 | $map .= ''; 377 | 378 | $map .= ' 379 |
380 | 381 | '; 419 | 420 | return $map; 421 | } 422 | 423 | private function _plot_coords($manual_zoom = FALSE) 424 | { 425 | $coords = NULL; 426 | $manual_zoom = $manual_zoom || $this->args['map']['zoom'] !== FALSE ? TRUE : FALSE; 427 | 428 | 429 | /* Prevents the marks from being added if the hide_markers parameter is set */ 430 | if(!$this->args['plugin']['hide_markers']) 431 | { 432 | $coords = $this->_get_points_by_coordinate($manual_zoom) . 433 | 434 | $this->_get_point_by_lat_lng_field($manual_zoom) . 435 | 436 | $this->_get_points_by_address($manual_zoom) . 437 | 438 | $this->_get_point_by_address($manual_zoom); 439 | 440 | 441 | if($this->args['fields']['gmap_field']) 442 | { 443 | 444 | $coords = $this->_get_points_by_lat_lng('{'.$this->args['fields']['gmap_field'].'}', $manual_zoom, TRUE); 445 | } 446 | 447 | if($this->args['fields']['lat_lng']) 448 | { 449 | $coords = $this->_get_points_by_lat_lng($this->args['fields']['lat_lng'], $manual_zoom); 450 | } 451 | } 452 | 453 | return $coords; 454 | } 455 | 456 | private function _center_map($manual_zoom = FALSE, $latitude = FALSE, $longitude = FALSE) 457 | { 458 | $marker = NULL; 459 | 460 | if(!$this->args['plugin']['center']) 461 | { 462 | if($latitude !== FALSE && $longitude !== FALSE) 463 | $marker .= ' 464 | if(new_location) {'; 465 | 466 | if($manual_zoom || !$this->args['plugin']['extend_bounds'] || $this->EE->TMPL->fetch_param('zoom')) 467 | { 468 | $default_zoom = $manual_zoom ? $manual_zoom : 15; 469 | 470 | if($manual_zoom !== FALSE) 471 | { 472 | $marker .= ' 473 | '.$this->_set_zoom($manual_zoom).' 474 | '.$this->_set_center('new_location').' 475 | '; 476 | } 477 | } 478 | elseif($this->args['plugin']['extend_bounds']) 479 | { 480 | $marker .= ' 481 | '.$this->args['plugin']['id'].'_bounds.extend(new_location); 482 | '.$this->args['plugin']['id'].'_canvas.fitBounds('.$this->args['plugin']['id'].'_bounds); 483 | '; 484 | } 485 | 486 | if($latitude !== FALSE && $longitude !== FALSE) 487 | $marker .= ' 488 | }'; 489 | } 490 | 491 | return $marker; 492 | } 493 | 494 | 495 | private function _geocode_center_map($center, $tagdata, $manual_zoom = FALSE) 496 | { 497 | $data = NULL; 498 | $manual_zoom = $manual_zoom ? $this->args['map']['zoom'] : FALSE; 499 | 500 | /* Centers map to a set location */ 501 | if($this->args['plugin']['center']) 502 | $data = $this->_geocode($center, FALSE, $manual_zoom, $tagdata); 503 | 504 | return $data; 505 | } 506 | 507 | private function _get_points_by_coordinate($manual_zoom = FALSE) 508 | { 509 | $tagdata = $this->EE->TMPL->tagdata; 510 | $data = NULL; 511 | $manual_zoom = $manual_zoom ? $this->args['map']['zoom'] : FALSE; 512 | 513 | /* Creates a point from the latitude and longitude parameters */ 514 | if($this->EE->TMPL->fetch_param('latitude') !== FALSE && $this->EE->TMPL->fetch_param('longitude') !== FALSE) 515 | { 516 | $data .= $this->_add_marker($this->args['fields']['latitude'], $this->args['fields']['longitude'], $manual_zoom, $tagdata); 517 | } 518 | 519 | return $data; 520 | } 521 | 522 | private function _get_points_by_lat_lng($field = FALSE, $manual_zoom = FALSE, $add_channel_tag = FALSE) 523 | { 524 | $data = NULL; 525 | $manual_zoom = $manual_zoom ? $this->args['map']['zoom'] : FALSE; 526 | 527 | if($field == '{}') return $data; 528 | 529 | //Loops through all the LatLng fields for larger datasets (set by the fieldtype) 530 | if($field) 531 | { 532 | $data = $this->_add_lat_lng($field, TRUE, $manual_zoom, $this->EE->TMPL->tagdata); 533 | 534 | if($add_channel_tag) 535 | $data = $this->_create_ee_tag($data); 536 | 537 | } 538 | 539 | return $data; 540 | } 541 | 542 | private function _get_point_by_address($manual_zoom = FALSE) 543 | { 544 | $data = NULL; 545 | $manual_zoom = $manual_zoom ? $this->args['map']['zoom'] : FALSE; 546 | 547 | /* Map multiple static address points */ 548 | if($this->args['fields']['address']) 549 | { 550 | foreach($this->args['fields']['address'] as $address) 551 | $data .= $this->_geocode($address, TRUE, $this->EE->TMPL->fetch_param('zoom'), $this->EE->TMPL->tagdata); 552 | } 553 | 554 | return $data; 555 | } 556 | 557 | private function _get_point_by_lat_lng_field($manual_zoom = FALSE) 558 | { 559 | $data = NULL; 560 | $manual_zoom = $manual_zoom ? $this->args['map']['zoom'] : FALSE; 561 | 562 | /* Adds the markers from latitude and longitude fields */ 563 | if($this->args['channel']['channel'] && $this->args['fields']['latitude_field'] && $this->args['fields']['longitude_field']) 564 | { 565 | $latitude_field = '{'. $this->args['fields']['latitude_field'] .'}'; 566 | $longitude_field = '{'. $this->args['fields']['longitude_field'].'}'; 567 | 568 | if($this->args['fields']['zoom_field']) 569 | $manual_zoom = '{'.$this->args['fields']['zoom_field'].'}'; 570 | 571 | $function = $this->_add_marker($latitude_field, $longitude_field, $manual_zoom, $this->EE->TMPL->tagdata); 572 | 573 | $data .= $this->_create_ee_tag($function); 574 | } 575 | 576 | return $data; 577 | } 578 | 579 | private function _get_points_by_address($manual_zoom = FALSE) 580 | { 581 | $data = NULL; 582 | $manual_zoom = $manual_zoom ? $this->args['map']['zoom'] : FALSE; 583 | 584 | /* Adds the marks from address fields */ 585 | if($this->args['channel']['channel'] && $this->args['fields']['address_field'] || $this->args['channel']['channel'] && $this->args['fields']['city_field'] || $this->args['channel']['channel'] && $this->args['fields']['state_field'] || $this->args['channel']['channel'] && $this->args['fields']['zipcode_field'] || $this->args['channel']['channel'] && $this->args['fields']['country_field']) 586 | { 587 | if($this->args['fields']['address_field']) 588 | $fields[] = '{'.$this->args['fields']['address_field'].'}'; 589 | 590 | if($this->args['fields']['city_field']) 591 | $fields[] = '{'.$this->args['fields']['city_field'].'}'; 592 | 593 | if($this->args['fields']['state_field']) 594 | $fields[] = '{'.$this->args['fields']['state_field'].'}'; 595 | 596 | if($this->args['fields']['zipcode_field']) 597 | $fields[] = '{'.$this->args['fields']['zipcode_field'].'}'; 598 | 599 | if($this->args['fields']['country_field']) 600 | $fields[] = '{'.$this->args['fields']['country_field'].'}'; 601 | 602 | $address = trim(implode(' ', $fields)); 603 | 604 | $function = $this->_geocode($address, TRUE, $manual_zoom, $this->EE->TMPL->tagdata); 605 | $data .= $this->_create_ee_tag($function); 606 | } 607 | 608 | return $data; 609 | } 610 | 611 | 612 | private function _add_lat_lng($gmap_field, $marker = TRUE, $manual_zoom = FALSE, $tagdata = FALSE) 613 | { 614 | $marker = ' 615 | coord_string = \''.$gmap_field.'\'; 616 | coords = coord_string.split(\')(\'); 617 | 618 | if(coord_string != \'\') { 619 | 620 | for(i = 0; i < coords.length; i++) { 621 | 622 | var coord = coords[i].split(\', \'); 623 | 624 | var new_latitude = coord[0].replace(\'(\', \'\').replace(\')\', \'\'); 625 | var new_longitude = coord[1].replace(\')\', \'\').replace(\'(\', \'\'); 626 | 627 | (function () { /* Fixes a known bug with Google\'s API with displaying the InfoWindow(s) */ 628 | new_location = false; 629 | 630 | if(new_latitude != \'\' && new_longitude != \'\') { 631 | 632 | new_location = new google.maps.LatLng(new_latitude, new_longitude); 633 | 634 | var marker = new google.maps.Marker({ 635 | map: '.$this->args['plugin']['id'].'_canvas, 636 | position: new_location 637 | }); 638 | 639 | ' 640 | .$this->_add_to_dropdown($tagdata); 641 | 642 | if($icon = $this->args['plugin']['icon']) 643 | { 644 | $marker .= ' 645 | marker.setIcon("'.$icon.'"); 646 | '; 647 | } 648 | 649 | $marker .= $this->_center_map($manual_zoom); 650 | 651 | $marker .= '} 652 | '; 653 | 654 | $marker .= $this->_infowindow(); 655 | 656 | $marker .= '})(); /* End bug fix */ 657 | } 658 | } 659 | '; 660 | 661 | return $marker; 662 | } 663 | 664 | private function _geocode($address, $marker = TRUE, $manual_zoom = FALSE, $tagdata = FALSE) 665 | { 666 | $location = ' 667 | address = \''.$address.'\'; 668 | address = address.replace(/^\s\s*/, \'\').replace(/\s\s*$/, \'\'); 669 | 670 | if(address != \'\') { 671 | /* Gets a location using Google\'s Geocode */ 672 | '.$this->args['plugin']['id'].'_geocoder.geocode( 673 | { 674 | \'address\': address 675 | }, function(results, status) { 676 | if (status == google.maps.GeocoderStatus.OK) { 677 | var location = results[0].geometry.location; 678 | '; 679 | 680 | $zoom = $manual_zoom; 681 | 682 | if($this->args['fields']['zoom_field']) 683 | $zoom = '{'.$this->args['fields']['zoom_field'].'}'; 684 | elseif($this->args['map']['zoom'] && $manual_zoom) 685 | $zoom = $this->args['map']['zoom']; 686 | 687 | if($marker) 688 | { 689 | $location .= $this->_add_marker(FALSE, FALSE, $zoom, $tagdata); 690 | } 691 | else 692 | { 693 | if($manual_zoom) 694 | $location .= ' 695 | '.$this->_set_zoom($this->args['map']['zoom']); 696 | 697 | $location .= ' 698 | '.$this->_set_center('location'); 699 | } 700 | 701 | $location .= ' 702 | } else { 703 | alert("Geocode was not successful for the following reason: " + status); 704 | } 705 | } 706 | ); 707 | }'; 708 | 709 | return $location; 710 | } 711 | 712 | private function _add_marker($latitude = FALSE, $longitude = FALSE, $manual_zoom = FALSE, $tagdata) 713 | { 714 | $open_if = ''; 715 | $close_if = ''; 716 | $marker = ''; 717 | 718 | $marker .= ' 719 | (function () { /* Fixes a known bug with Google\'s API with displaying the InfoWindow(s) */ 720 | 721 | new_location = false;'; 722 | 723 | if($latitude !== FALSE && $longitude !== FALSE) 724 | $marker .= ' 725 | new_latitude = \''.$latitude.'\'; 726 | new_longitude = \''.$longitude.'\'; 727 | 728 | if(new_latitude != \'\' && new_longitude != \'\') { 729 | 730 | new_location = new google.maps.LatLng(new_latitude, new_longitude);'; 731 | else 732 | $marker .= ' 733 | new_location = location;'; 734 | 735 | $marker .= ' 736 | var marker = new google.maps.Marker({ 737 | map: '.$this->args['plugin']['id'].'_canvas, 738 | position: new_location 739 | }); 740 | 741 | ' 742 | .$this->_add_to_dropdown($tagdata); 743 | 744 | if($icon = $this->args['plugin']['icon']) 745 | { 746 | $marker .= ' 747 | marker.setIcon("'.$icon.'"); 748 | '; 749 | } 750 | 751 | if($latitude !== FALSE && $longitude !== FALSE) 752 | $marker .= ' 753 | }'; 754 | 755 | $marker .= $this->_center_map($manual_zoom, $latitude, $longitude); 756 | 757 | $marker .= $this->_infowindow(); 758 | 759 | $marker .= '})(); /* End bug fix */'; 760 | 761 | return $open_if . $marker . $close_if; 762 | } 763 | 764 | function _infowindow() 765 | { 766 | $marker = NULL; 767 | $tagdata = $this->EE->TMPL->tagdata; 768 | 769 | if($tagdata != '') 770 | { 771 | $tagdata = trim(preg_replace("/[\n\r\t]/","",str_replace('"', '\"', $this->EE->TMPL->advanced_conditionals($this->EE->TMPL->tagdata)))); 772 | 773 | $marker .= ' 774 | if(new_location) { 775 | 776 | var html = "'.$tagdata.'"; 777 | if('.$this->args['plugin']['id'].'_html['.$this->args['plugin']['id'].'_count-1] == "" || '.$this->args['plugin']['id'].'_html['.$this->args['plugin']['id'].'_count] == "{title}") 778 | '.$this->args['plugin']['id'].'_html['.$this->args['plugin']['id'].'_count-1] = html; 779 | 780 | var infowindow = new google.maps.InfoWindow({ 781 | content: html 782 | }); 783 | 784 | '.$this->args['plugin']['id'].'_windows['.$this->args['plugin']['id'].'_count-1] = infowindow;'; 785 | 786 | if($this->args['plugin']['open_windows']) 787 | $marker .= 'infowindow.open('.$this->args['plugin']['id'].'_canvas, marker);'; 788 | 789 | $marker .= ' 790 | google.maps.event.addListener(marker, \'click\', function() {'; 791 | 792 | if($this->args['plugin']['show_one_window']) 793 | $marker .= ' 794 | if('.$this->args['plugin']['id'].'_window) 795 | '.$this->args['plugin']['id'].'_window.close()'; 796 | 797 | $marker .= ' 798 | infowindow.open('.$this->args['plugin']['id'].'_canvas, marker); 799 | '.$this->args['plugin']['id'].'_window = infowindow; 800 | }); 801 | }'; 802 | } 803 | 804 | return $marker; 805 | } 806 | 807 | function _add_to_dropdown($tagdata = FALSE) 808 | { 809 | $tagdata = trim(preg_replace("/[\n\r\t]/","",str_replace('"', '\"', $this->EE->TMPL->advanced_conditionals($this->EE->TMPL->tagdata)))); 810 | 811 | if(!$tagdata || $this->args['plugin']['add_title_to_dropdown']) 812 | $script = ' 813 | '.$this->args['plugin']['id'].'_html['.$this->args['plugin']['id'].'_count] = "{title}";'; 814 | else 815 | $script = ' 816 | '.$this->args['plugin']['id'].'_html['.$this->args['plugin']['id'].'_count] = "'.$tagdata.'";'; 817 | 818 | $script .= ' 819 | '.$this->args['plugin']['id'].'_markers['.$this->args['plugin']['id'].'_count] = marker; 820 | '. $this->args['plugin']['id'].'_count++;'; 821 | 822 | return $script; 823 | } 824 | 825 | private function _set_center($center) 826 | { 827 | return $this->args['plugin']['id'].'_canvas.setCenter('.$center.')'; 828 | } 829 | 830 | private function _set_zoom($zoom) 831 | { 832 | return $this->args['plugin']['id'].'_canvas.setZoom('.$zoom.')'; 833 | } 834 | 835 | private function _gmap_options() 836 | { 837 | $newline = "\r\t\t\t"; 838 | 839 | $options = ' 840 | var '.$this->args['plugin']['id'].'_options = { 841 | center: '.$this->args['plugin']['id'].'_center, 842 | '; 843 | 844 | foreach($this->args['map'] as $option => $value) 845 | if($value) $options .= $option.': '.$value.', '.$newline; 846 | 847 | $options = rtrim($options, ', '.$newline); 848 | 849 | $options .= $newline.'}'; 850 | 851 | return $options; 852 | } 853 | 854 | private function _create_ee_tag($content) 855 | { 856 | $exp_open_tag = '{exp:channel:entries '; 857 | 858 | foreach($this->args['channel'] as $param => $value) 859 | { 860 | if($value) $exp_open_tag .= $param.'="'.$value.'" '; 861 | } 862 | 863 | $exp_open_tag .= '}'; 864 | 865 | $exp_close_tag = '{/exp:channel:entries}'; 866 | 867 | return $exp_open_tag . $content . $exp_close_tag; 868 | } 869 | 870 | private function _fetch_params($require_id = TRUE) 871 | { 872 | // Loops through the defined channels and checks for custom fields and 873 | $this->EE->load->model(array('channel_model', 'field_model')); 874 | 875 | $params = array(); 876 | 877 | /* Loops through the arguments and initializes the array */ 878 | 879 | foreach($this->args as $group => $fields) 880 | { 881 | $tmp = $fields; 882 | 883 | unset($this->args[$group]); 884 | 885 | foreach($tmp as $param) 886 | $this->args[$group][$param] = $this->EE->TMPL->fetch_param($param); 887 | } 888 | 889 | if(!$this->args['plugin']['id'] && $require_id) 890 | show_error('You must assign a unique id to every map. This id should only contain alphabetical and numerical characters with the exception of an underscore.'); 891 | 892 | /* Sets the default values */ 893 | $this->args['fields']['latitude'] = $this->args['fields']['latitude'] !== FALSE ? $this->args['fields']['latitude'] : 0; 894 | 895 | $this->args['fields']['longitude'] = $this->args['fields']['longitude'] !== FALSE ? $this->args['fields']['longitude'] : 0; 896 | 897 | $this->args['plugin']['offset'] = 1; 898 | 899 | 900 | switch($this->args['plugin']['metric']) 901 | { 902 | case 'kilometers': 903 | $this->args['plugin']['offset'] = 1.609344; 904 | break; 905 | 906 | case 'meters': 907 | $this->args['plugin']['offset'] = 1609.344; 908 | break; 909 | 910 | case 'feet': 911 | $this->args['plugin']['offset'] = 5280; 912 | break; 913 | } 914 | 915 | 916 | //$this->args['map']['zoom'] = $this->args['map']['zoom'] !== FALSE ? $this->args['map']['zoom'] : 15; 917 | 918 | if($this->args['plugin']['extend_bounds'] == "yes" || $this->args['plugin']['extend_bounds'] == "true" || !$this->args['plugin']['extend_bounds']) 919 | $this->args['plugin']['extend_bounds'] = TRUE; 920 | else 921 | $this->args['plugin']['extend_bounds'] = FALSE; 922 | 923 | 924 | if($this->args['plugin']['show_one_window'] == "yes" || $this->args['plugin']['show_one_window'] == "true") 925 | $this->args['plugin']['show_one_window'] = TRUE; 926 | else 927 | $this->args['plugin']['show_one_window'] = FALSE; 928 | 929 | 930 | if($this->args['plugin']['show_coordinate'] == "yes" || $this->args['plugin']['show_coordinate'] == "true") 931 | $this->args['plugin']['show_coordinate'] = TRUE; 932 | else 933 | $this->args['plugin']['show_coordinate'] = FALSE; 934 | 935 | if($this->args['plugin']['show_sql'] == "yes" || $this->args['plugin']['show_sql'] == "true") 936 | $this->args['plugin']['show_sql'] = TRUE; 937 | else 938 | $this->args['plugin']['show_sql'] = FALSE; 939 | 940 | 941 | if($this->args['plugin']['add_title_to_dropdown'] == "yes" || $this->args['plugin']['add_title_to_dropdown'] == "true") 942 | $this->args['plugin']['add_title_to_dropdown'] = TRUE; 943 | else 944 | $this->args['plugin']['add_title_to_dropdown'] = FALSE; 945 | 946 | 947 | /* Breaks the address' down into an array */ 948 | if($this->args['fields']['address']) 949 | $this->args['fields']['address'] = explode('|', $this->args['fields']['address']); 950 | 951 | /* Sets a default mapTypeId if one isn't set, and makes the map_type alias */ 952 | if($this->args['plugin']['map_type']) 953 | $map_type = $this->args['plugin']['map_type']; 954 | else 955 | $map_type = $this->args['map']['mapTypeId']; 956 | 957 | $map_type = !$map_type || !isset($map_type) ? 'google.maps.MapTypeId.ROADMAP' : 'google.maps.MapTypeId.'.strtoupper($map_type); 958 | 959 | $this->args['map']['mapTypeId'] = $map_type; 960 | 961 | $channel_name = explode('|', $this->args['channel']['channel']); 962 | 963 | foreach($channel_name as $name) 964 | { 965 | $channel = $this->EE->channel_model->get_channels(NULL, array('*'), array(array('channel_name' => $name)))->row(); 966 | 967 | if(isset($channel->field_group)) 968 | { 969 | $fields = $this->EE->field_model->get_fields($channel->field_group)->result(); 970 | 971 | foreach($fields as $field) 972 | { 973 | $field_name = 'search:'.$field->field_name; 974 | 975 | if($this->EE->TMPL->fetch_param($field_name)) 976 | $this->args['channel'][$field_name] = $this->EE->TMPL->fetch_param($field_name); 977 | } 978 | } 979 | } 980 | 981 | return $this->args; 982 | } 983 | 984 | function usage() 985 | { 986 | ob_start(); 987 | ?> 988 | 989 | field_name.'.settings; 2 | var location = new google.maps.LatLng(fieldOpts.latitude, fieldOpts.longitude); 3 | var gmap_geocoder = new google.maps.Geocoder(); 4 | 5 | var myOptions = { 6 | zoom: fieldOpts.zoom, 7 | center: location, 8 | mapTypeId: google.maps.MapTypeId.ROADMAP, 9 | disableDoubleClickZoom: true 10 | } 11 | 12 | var gmap_canvas = $("#gmap_canvas").get(0); 13 | var gmap_coords = $("#gmap_coords"); 14 | var gmap_button = document.getElementById("#gmap_submit"); 15 | 16 | var gmap = new google.maps.Map(gmap_canvas, myOptions); 17 | var gmap_bounds = new google.maps.LatLngBounds(); 18 | var gmap_markers = []; 19 | var gmap_marker_count = 0; 20 | 21 | function gmap_add_marker(location) { 22 | 23 | var element = gmap_marker_count; 24 | 25 | var marker = new google.maps.Marker({ 26 | map: gmap, 27 | position: location, 28 | draggable: true, 29 | raiseOnDrag: true 30 | }); 31 | 32 | 33 | gmap_bounds.extend(location); 34 | gmap_markers.push(marker); 35 | 36 | var html = "
" + location + "

" + "Remove from Map
"; 37 | 38 | var infowindow = new google.maps.InfoWindow({ 39 | content: html 40 | }); 41 | 42 | google.maps.event.addListener(marker, 'dragstart', function(event) { 43 | gmap_coords.val(gmap_coords.val().replace(String(event.latLng), '')); 44 | }); 45 | 46 | google.maps.event.addListener(marker, 'dragend', function(event) { 47 | var new_location = event.latLng; 48 | 49 | infowindow.setContent("
" + new_location + "

" + "Remove from Map
"); 50 | 51 | gmap_coords.val(new_location + gmap_coords.val()); 52 | }); 53 | 54 | google.maps.event.addListener(marker, 'click', function(event) { 55 | infowindow.open(gmap, marker); 56 | }); 57 | 58 | gmap_coords.val(location + gmap_coords.val()); 59 | 60 | gmap_marker_count++; 61 | } 62 | 63 | google.maps.event.addListener(gmap, 'dblclick', function(event) { 64 | 65 | gmap_add_marker(event.latLng); 66 | 67 | }); 68 | 69 | $(".gmap-remove").live("click", function() { 70 | 71 | var $t = $(this); 72 | var id = String($t.attr("id")); 73 | var title = $t.attr("title"); 74 | 75 | gmap_markers[id].setMap(null); 76 | 77 | gmap_coords.val(gmap_coords.val().replace(title, "")); 78 | 79 | return false; 80 | }); 81 | 82 | $("#gmap_address").keypress(function(event) { 83 | if(event.keyCode == 13) { 84 | $("#gmap_submit").click(); 85 | return false; 86 | } 87 | }); 88 | 89 | $("#gmap_submit").click(function() { 90 | (function () { /* Fixes a known bug with Google's API with displaying the InfoWindow(s) */ 91 | var address = $("#gmap_address").val(); 92 | 93 | gmap_geocoder.geocode( { 'address': address}, function(results, status) { 94 | if (status == google.maps.GeocoderStatus.OK) { 95 | 96 | var coord = results[0].geometry.location; 97 | 98 | gmap_bounds.extend(coord); 99 | gmap.fitBounds(gmap_bounds); 100 | 101 | gmap_add_marker(coord); 102 | 103 | } else { 104 | alert("Geocode was not successful for the following reason: " + status); 105 | } 106 | }); 107 | })(); 108 | }); -------------------------------------------------------------------------------- /third_party/gmap/views/field_type/settings.php: -------------------------------------------------------------------------------- 1 |

These settings only affect how the Google Map will display in the backend. These settings have no effect on how the map will be reproduced on the front-end at this time.

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 20 | 23 | 24 | 25 | 30 | 33 | 34 | 35 | 40 | 43 | 44 | 45 | 50 | 57 | 58 | 59 | 64 | 67 | 68 | 69 | 70 |
PreferenceSetting
16 | 17 | 18 |
You can set the default map center by entering a latitude & longitude.
19 |
21 | 22 |
26 | 27 | 28 |
You can set the default map center by entering a latitude & longitude.
29 |
31 | 32 |
36 | 37 | 38 |
Alternatively, enter an location (address, city, state, zip code, etc) that will be use Google's geocoder to get the coordinate to be used as the center.
39 |
41 | 42 |
46 | 47 | 48 |
Alternatively, enter an location (address, city, state, zip code, etc) that will be use Google's geocoder to get the coordinate to be used as the center.
49 |
51 | 56 |
60 | 61 | 62 |
You can limit users to a maximum number of points. If you enter zero, the user can enter an unlimited number of points on the map. (0 = Unlimited Markers)
63 |
65 | 66 |
-------------------------------------------------------------------------------- /third_party/gmap/views/map.php: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 |
7 | 8 |
9 | 10 | 11 |
12 | 13 |
14 |
click to activate map
15 |
16 | 17 |
18 |
19 | 20 |
21 | 22 | 23 | 24 |
25 | 26 | Remove All Points 27 |
--------------------------------------------------------------------------------