Ongoing development.

This commit is contained in:
David Molineus
2014-12-29 12:17:40 +01:00
parent d289b67196
commit 633be6a2bc
32 changed files with 2057 additions and 23 deletions

View File

@@ -0,0 +1,62 @@
<?php
/**
* @package dev
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014 netzmacht creative David Molineus
* @license LGPL 3.0
* @filesource
*
*/
namespace Netzmacht\Contao\Leaflet;
/**
* @property int leaflet_map
*/
class LeafletMapElement extends \ContentElement
{
/**
* Template name.
*
* @var string
*/
protected $strTemplate = 'ce_leaflet_map';
/**
* @var MapService
*/
private $mapService;
/**
* Construct.
*
* @param \ContentModel $objElement Content element model.
* @param string $strColumn Layout column.
*/
public function __construct($objElement, $strColumn = 'main')
{
parent::__construct($objElement, $strColumn);
$this->mapService = $GLOBALS['container']['leaflet.map.service'];
}
/**
* Compile the content element.
*
* @return void
*
* @throws \Exception
*/
protected function compile()
{
try {
$mapId = 'map_' . ($this->cssID[0] ?: $this->id);
$this->Template->mapId = $mapId;
$this->Template->map = $this->mapService->getJavascript($this->leaflet_map, $mapId);
} catch(\Exception $e) {
throw $e;
}
}
}