2014-12-29 16:22:16 +01:00
|
|
|
<?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\Model;
|
|
|
|
|
|
2015-01-12 19:03:29 +01:00
|
|
|
use Model\Collection;
|
2014-12-29 16:22:16 +01:00
|
|
|
|
2015-01-12 19:03:29 +01:00
|
|
|
/**
|
|
|
|
|
* Class LayerModel for the tl_leaflet_layer table.
|
|
|
|
|
*
|
2015-01-18 23:20:21 +01:00
|
|
|
* @property mixed|null id
|
|
|
|
|
* @property mixed|null alias
|
2015-01-19 14:46:44 +01:00
|
|
|
* @property mixed|null pointToLayer
|
|
|
|
|
* @property mixed|null onEachFeature
|
2015-01-27 12:36:52 +01:00
|
|
|
* @property mixed|null boundsMode
|
2015-01-18 23:20:21 +01:00
|
|
|
*
|
2015-01-12 19:03:29 +01:00
|
|
|
* @package Netzmacht\Contao\Leaflet\Model
|
|
|
|
|
*/
|
2015-01-09 15:24:34 +01:00
|
|
|
class LayerModel extends AbstractActiveModel
|
2014-12-29 16:22:16 +01:00
|
|
|
{
|
2015-01-12 19:03:29 +01:00
|
|
|
/**
|
|
|
|
|
* Model table.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
2014-12-29 16:22:16 +01:00
|
|
|
protected static $strTable = 'tl_leaflet_layer';
|
|
|
|
|
|
2015-01-12 19:03:29 +01:00
|
|
|
/**
|
|
|
|
|
* Find multiple layers by given type.
|
|
|
|
|
*
|
|
|
|
|
* @param array $types List of layer types.
|
|
|
|
|
* @param array $options Query options.
|
|
|
|
|
*
|
|
|
|
|
* @return Collection|null
|
|
|
|
|
*/
|
2015-01-06 14:55:53 +01:00
|
|
|
public static function findMultipleByTypes(array $types, $options = array())
|
|
|
|
|
{
|
|
|
|
|
if (empty($types)) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$options['column'] = array(
|
|
|
|
|
sprintf(
|
|
|
|
|
'type IN (%s)',
|
|
|
|
|
substr(str_repeat('?,', count($types)), 0, -1)
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
|
2015-01-12 19:03:29 +01:00
|
|
|
$options['value'] = $types;
|
|
|
|
|
$options['return'] = 'Collection';
|
2015-01-06 14:55:53 +01:00
|
|
|
|
|
|
|
|
return static::find($options);
|
|
|
|
|
}
|
2014-12-29 16:22:16 +01:00
|
|
|
}
|