Files
contao-leaflet-maps/src/Netzmacht/Contao/Leaflet/Model/ControlModel.php

44 lines
1.2 KiB
PHP
Raw Normal View History

2015-01-05 12:25:46 +01:00
<?php
/**
* @package dev
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2015 netzmacht creative David Molineus
* @license LGPL 3.0
* @filesource
*
*/
namespace Netzmacht\Contao\Leaflet\Model;
2015-01-09 15:24:34 +01:00
class ControlModel extends AbstractActiveModel
2015-01-05 12:25:46 +01:00
{
protected static $strTable = 'tl_leaflet_control';
2015-01-09 22:33:57 +01:00
/**
* @return \Model\Collection
*/
public function findLayers()
{
$query = 'SELECT l.*, c.mode as controlMode FROM tl_leaflet_layer l LEFT JOIN tl_leaflet_control_layer c ON l.id = c.lid WHERE c.cid=?';
$result = \Database::getInstance()
->prepare($query)
->execute($this->id);
return \Model\Collection::createFromDbResult($result, 'tl_leaflet_layer');
}
2015-01-09 23:48:25 +01:00
/**
* @return \Model\Collection
*/
public function findActiveLayers()
{
$query = 'SELECT l.*, c.mode as controlMode FROM tl_leaflet_layer l LEFT JOIN tl_leaflet_control_layer c ON l.id = c.lid WHERE c.cid=? AND l.active=1';
$result = \Database::getInstance()
->prepare($query)
->execute($this->id);
return \Model\Collection::createFromDbResult($result, 'tl_leaflet_layer');
}
2015-01-05 12:25:46 +01:00
}