* [[Gmap? &lat=`-12.043333` &lng=`-77.028333`]] * * OR * * [[Gmap? &lat=`-12.043333` &lng=`-77.028333` &height=`400` &width=`800`]] * * @var array $scriptProperties * * @name Gmap * @url http://craftsmancoding.com/ * @author Everett Griffiths <*****@*****.**> * @package gmarker */ require_once MODX_CORE_PATH . 'components/gmarker/model/gmarker/Gmarker.class.php'; $cache_opts = array(xPDO::OPT_CACHE_KEY => 'gmarker'); $Gmarker = new Gmarker(); $modx->lexicon->load('gmarker:default'); // Read inputs // First some controlling props $refresh = (int) $modx->getOption('refresh', $scriptProperties, 0); $secure = (int) $modx->getOption('secure', $scriptProperties, $modx->getOption('gmarker.secure')); $headTpl = $modx->getOption('headTpl', $scriptProperties, 'gmapshead'); $outTpl = $modx->getOption('outTpl', $scriptProperties, 'g_out'); // Props that influence the address fingerprint and the Lat/Lng cache $props = array(); $props['address'] = $modx->getOption('address', $scriptProperties, $modx->getOption('gmarker.formatting_string')); $props['latlng'] = $modx->getOption('latlng', $scriptProperties, ''); $props['bounds'] = $modx->getOption('bounds', $scriptProperties, $modx->getOption('gmarker.bounds')); $props['components'] = $modx->getOption('components', $scriptProperties, $modx->getOption('gmarker.components')); $props['region'] = $modx->getOption('region', $scriptProperties, $modx->getOption('gmarker.region')); $props['language'] = $modx->getOption('language', $scriptProperties, $modx->getOption('gmarker.language'));
* * Place the snippet call where you want your map to appear. * * [[!Gmarker]] * * [[Gmarker? &width=`260` &height=`206` &class=`my_class` &latlng=`40.3810679,-78.0758859` &parents=`7` &zoom=`8` &tvName=`category` &tvValue=`[[*id]]`]] * * @var array $scriptProperties * * @name Gmarker * @url http://craftsmancoding.com/ * @author Everett Griffiths <*****@*****.**> * @package garmker */ require_once MODX_CORE_PATH . 'components/gmarker/model/gmarker/Gmarker.class.php'; $Gmarker = new Gmarker(); $modx->lexicon->load('gmarker:default'); //------------------------------------------------------------------------------ //! Read inputs //------------------------------------------------------------------------------ // Basic controls (only some...) $secure = (int) $modx->getOption('secure', $scriptProperties, $modx->getOption('gmarker.secure')); $headTpl = $modx->getOption('headTpl', $scriptProperties, 'gmarkershead'); $markerTpl = $modx->getOption('markerTpl', $scriptProperties, 'gmarker'); $resultTpl = $modx->getOption('resultTpl', $scriptProperties, 'gresult'); $checkboxTpl = $modx->getOption('resultTpl', $scriptProperties, 'gcheckbox'); $outTpl = $modx->getOption('outTpl', $scriptProperties, 'g_out'); $showResults = $modx->getOption('showResults', $scriptProperties, 0); $info = (int) $modx->getOption('info', $scriptProperties, 1); $infoTpl = $modx->getOption('infoTpl', $scriptProperties, 'ginfo'); $tvPrefix = $modx->getOption('tvPrefix', $scriptProperties, '');
* [[!FormIt? &hooks=`Glocation` ... ]] * <!-- other form fields here... --> * <input type="text" name="address" /> * <input type="text" name="city" /> * <input type="text" name="state" /> * <!-- the rest of the form... --> * * @var array $scriptProperties * * @name Glocation * @url http://craftsmancoding.com/ * @author Everett Griffiths <*****@*****.**> * @package gmarker */ require_once MODX_CORE_PATH . 'components/gmarker/model/gmarker/Gmarker.class.php'; $Gmarker = new Gmarker(); $modx->lexicon->load('gmarker:default'); $goog = array(); //------------------------------------------------------------------------------ //! Hook Mode //------------------------------------------------------------------------------ if (is_object($hook)) { $modx->log(xPDO::LOG_LEVEL_DEBUG, '[Glocation] being used as a hook.'); $props = $hook->getValues(); $uniqid = uniqid(); $chunk = $modx->newObject('modChunk', array('name' => "{geocoding_tmp}-{$uniqid}")); $chunk->setCacheable(false); $tpl = $modx->getOption('gmarker.formatting_string'); $secure = $modx->getOption('gmarker.secure'); $lat_tv = $hook->getValue('gmarker.lat_tv') ? $hook->getValue('gmarker.lat_tv') : $modx->getOption('gmarker.lat_tv'); $lng_tv = $hook->getValue('gmarker.lng_tv') ? $hook->getValue('gmarker.lng_tv') : $modx->getOption('gmarker.lng_tv');
* It takes location information on the page (e.g. address, city, state, zip TVs), and * passes them to the Google Geocoding API in order to retrieve latitude/longitude info * about that address, which it then stores inside the page in pre-defined TVs. * See the System Settings for ways to control the behavior of the plugin. * * LICENSE: * See the core/components/gmarker/docs/license.txt for full licensing info. * * * @name Geocoding * @url http://craftsmancoding.com/ * @author Everett Griffiths <*****@*****.**> * @package marker */ require_once MODX_CORE_PATH . 'components/gmarker/model/gmarker/Gmarker.class.php'; $Gmarker = new Gmarker(); $modx->lexicon->load('gmarker:default'); $cache_opts = array(xPDO::OPT_CACHE_KEY => 'gmarker'); // Check the event $events = array('OnDocFormSave'); if (!in_array($modx->event->name, $events)) { $modx->log(xPDO::LOG_LEVEL_ERROR, "[Geocoding Plugin] attached to wrong event!"); } $secure = (int) $modx->getOption('gmarker.secure'); $templates = $modx->getOption('gmarker.templates'); if (empty($templates)) { return; } $templates = explode(',', $templates); // We are only concerned with pages that use one of the special templates if (!in_array($resource->template, $templates)) {