/** * Generate module */ protected function compile() { // get map data $objMap = $this->Database->prepare("SELECT * FROM tl_dlh_googlemaps WHERE id=?")->limit(1)->execute($this->dlh_googlemap); $map = $objMap->fetchAssoc(); // get elements data $objElements = $this->Database->prepare("SELECT * FROM tl_dlh_googlemaps_elements WHERE (pid=? and published=?) ORDER BY sorting")->execute($map['id'], true); $map['elements'] = $objElements->fetchAllAssoc(); $map['sensor'] = $map['sensor'] ? 'true' : 'false'; $map['language'] = $GLOBALS['TL_LANGUAGE']; $this->Template->map = dlh_googlemaps::render_dlh_googlemap($this->Environment->base, $map, $this->dlh_googlemap_size, $this->dlh_googlemap_zoom); $this->Template->labels = $GLOBALS['TL_LANG']['dlh_googlemaps']['labels']; $GLOBALS['TL_JAVASCRIPT'][] = 'http://maps.google.com/maps/api/js?language=' . $map['language'] . '&sensor=' . $map['sensor']; }
/** * Parse the template * @return string */ protected function compile() { // get map data $objMap = $this->Database->prepare("SELECT * FROM tl_dlh_googlemaps WHERE id=?")->limit(1)->execute($this->dlh_googlemap); $map = $objMap->fetchAssoc(); // get elements data $objElements = $this->Database->prepare("SELECT * FROM tl_dlh_googlemaps_elements WHERE (pid=? and published=?) ORDER BY sorting")->execute($map['id'], true); $map['elements'] = $objElements->fetchAllAssoc(); $map['sensor'] = $map['sensor'] ? 'true' : 'false'; $map['language'] = $GLOBALS['TL_LANGUAGE']; if ($this->dlh_googlemap_static) { $this->Template = new FrontendTemplate('ce_dlh_googlemaps_static'); if ($this->dlh_googlemap_url) { $this->Template->link = '<a href="' . $this->dlh_googlemap_url . '"' . ($this->rel ? ' rel="' . $this->rel . '"' : '') . ' title="' . addslashes($this->linkTitle) . '"' . ($this->target ? ' onclick="window.open(this.href); return false;"' : '') . '>'; } } else { $GLOBALS['TL_JAVASCRIPT'][] = 'http://maps.google.com/maps/api/js?language=' . $map['language'] . '&sensor=' . $map['sensor']; } $this->Template->map = dlh_googlemaps::render_dlh_googlemap($this->Environment->base, $map, $this->dlh_googlemap_size, $this->dlh_googlemap_zoom); $this->Template->labels = $GLOBALS['TL_LANG']['dlh_googlemaps']['labels']; }