forked from Snck3rs/contao-leaflet-maps
Fix code style.
This commit is contained in:
@@ -11,26 +11,42 @@
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Dca;
|
||||
|
||||
|
||||
use Netzmacht\Contao\DevTools\Dca\Options\OptionsBuilder;
|
||||
use Netzmacht\Contao\DevTools\ServiceContainerTrait;
|
||||
use Netzmacht\Contao\Leaflet\Model\ControlModel;
|
||||
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
||||
|
||||
/**
|
||||
* Class Control is the helper for the tl_leaflet_control dca.
|
||||
*
|
||||
* @package Netzmacht\Contao\Leaflet\Dca
|
||||
*/
|
||||
class Control
|
||||
{
|
||||
use ServiceContainerTrait;
|
||||
|
||||
/**
|
||||
* The database connection.
|
||||
*
|
||||
* @var \Database
|
||||
*/
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->database = static::getService('database.connection');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a row.
|
||||
*
|
||||
* @param array $row The data row.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function generateRow($row)
|
||||
{
|
||||
return sprintf(
|
||||
@@ -40,6 +56,11 @@ class Control
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get layers for the layers control.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getLayers()
|
||||
{
|
||||
$options = array();
|
||||
@@ -54,6 +75,11 @@ class Control
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the zoom controls for the reference value of the loading control.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getZoomControls()
|
||||
{
|
||||
$collection = ControlModel::findBy('type', 'zoom', array('order' => 'title'));
|
||||
@@ -61,6 +87,16 @@ class Control
|
||||
return OptionsBuilder::fromCollection($collection, 'id', 'title')->getOptions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load layer relations.
|
||||
*
|
||||
* @param mixed $value The actual value.
|
||||
* @param \DataContainer $dataContainer The data container driver.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function loadLayerRelations($value, $dataContainer)
|
||||
{
|
||||
$result = $this->database
|
||||
@@ -70,6 +106,14 @@ class Control
|
||||
return $result->fetchAllAssoc();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save layer relations.
|
||||
*
|
||||
* @param $layers $layers The layer id values.
|
||||
* @param \DataContainer $dataContainer The dataContainer driver.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function saveLayerRelations($layers, $dataContainer)
|
||||
{
|
||||
$new = deserialize($layers, true);
|
||||
|
||||
Reference in New Issue
Block a user