* @copyright 2015 netzmacht creative David Molineus * @license LGPL 3.0 * @filesource * */ namespace Netzmacht\Contao\Leaflet\Dca; use Netzmacht\Contao\DevTools\Dca\Options\OptionsBuilder; use Netzmacht\Contao\Leaflet\Model\ControlModel; use Netzmacht\Contao\Leaflet\Model\LayerModel; class Control { public function generateRow($row) { return sprintf( '%s [%s]', $row['title'], $row['type'] ); } public function getLayers() { $options = array(); $collection = LayerModel::findBy('pid', '0', array('order' => 'title')); if ($collection) { foreach ($collection as $model) { $options[$model->id] = $model->title; } } return $options; } public function getZoomControls() { $collection = ControlModel::findBy('type', 'zoom', array('order' => 'title')); return OptionsBuilder::fromCollection($collection, 'id', 'title')->getOptions(); } }