forked from Snck3rs/contao-leaflet-maps
Add vector style management.
This commit is contained in:
45
src/Netzmacht/Contao/Leaflet/Model/ActiveTrait.php
Normal file
45
src/Netzmacht/Contao/Leaflet/Model/ActiveTrait.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?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;
|
||||
|
||||
|
||||
trait ActiveTrait
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @param int $modelId
|
||||
* @param array $options
|
||||
*
|
||||
* @return \Model|null
|
||||
*/
|
||||
public static function findActiveByPK($modelId, $options = array())
|
||||
{
|
||||
return static::findOneBy('active=1 AND id', $modelId, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param int $modelId
|
||||
* @param array $options
|
||||
*
|
||||
* @return \Model|null
|
||||
*/
|
||||
public static function findActiveByPid($modelId, $options = array())
|
||||
{
|
||||
return static::findBy('active=1 AND pid', $modelId, $options);
|
||||
}
|
||||
|
||||
public static function findActivated($options = array())
|
||||
{
|
||||
return static::findBy('active', '1', $options);
|
||||
}
|
||||
}
|
||||
@@ -23,5 +23,7 @@ namespace Netzmacht\Contao\Leaflet\Model;
|
||||
*/
|
||||
class IconModel extends \Model
|
||||
{
|
||||
use ActiveTrait;
|
||||
|
||||
protected static $strTable = 'tl_leaflet_icon';
|
||||
}
|
||||
|
||||
20
src/Netzmacht/Contao/Leaflet/Model/StyleModel.php
Normal file
20
src/Netzmacht/Contao/Leaflet/Model/StyleModel.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?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;
|
||||
|
||||
|
||||
class StyleModel extends \Model
|
||||
{
|
||||
use ActiveTrait;
|
||||
|
||||
protected static $strTable = 'tl_leaflet_style';
|
||||
}
|
||||
Reference in New Issue
Block a user