forked from Snck3rs/contao-leaflet-maps
Convert array syntax and other minor code style adjustments.
This commit is contained in:
@@ -48,10 +48,10 @@ class About
|
|||||||
return array_map(
|
return array_map(
|
||||||
function ($library) {
|
function ($library) {
|
||||||
$library = array_merge(
|
$library = array_merge(
|
||||||
array(
|
[
|
||||||
'homepage' => null,
|
'homepage' => null,
|
||||||
'version' => null,
|
'version' => null,
|
||||||
),
|
],
|
||||||
$library
|
$library
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -86,30 +86,30 @@ class About
|
|||||||
$lockFile = TL_ROOT . '/composer.lock';
|
$lockFile = TL_ROOT . '/composer.lock';
|
||||||
|
|
||||||
if (!file_exists($extFile) || !file_exists($lockFile)) {
|
if (!file_exists($extFile) || !file_exists($lockFile)) {
|
||||||
return array();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$extension = json_decode(file_get_contents($extFile), true);
|
$extension = json_decode(file_get_contents($extFile), true);
|
||||||
$installed = json_decode(file_get_contents($lockFile), true);
|
$installed = json_decode(file_get_contents($lockFile), true);
|
||||||
$deps = array();
|
$deps = [];
|
||||||
$version = null;
|
$version = null;
|
||||||
|
|
||||||
foreach ($installed['packages'] as $package) {
|
foreach ($installed['packages'] as $package) {
|
||||||
if ($package['name'] === 'netzmacht/contao-leaflet-maps') {
|
if ($package['name'] === 'netzmacht/contao-leaflet-maps') {
|
||||||
$version = $package['version'];
|
$version = $package['version'];
|
||||||
} elseif (isset($extension['require'][$package['name']])) {
|
} elseif (isset($extension['require'][$package['name']])) {
|
||||||
$deps[] = array(
|
$deps[] = [
|
||||||
'name' => $package['name'],
|
'name' => $package['name'],
|
||||||
'version' => $package['version'],
|
'version' => $package['version'],
|
||||||
'license' => !empty($package['license']) ? implode(', ', $package['license']) : '',
|
'license' => !empty($package['license']) ? implode(', ', $package['license']) : '',
|
||||||
'homepage' => sprintf(
|
'homepage' => sprintf(
|
||||||
'<a href="https://packagist.org/packages/%s" target="_blank">Visit packagist</a>',
|
'<a href="https://packagist.org/packages/%s" target="_blank">Visit packagist</a>',
|
||||||
$package['name']
|
$package['name']
|
||||||
)
|
),
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return array($version, $deps);
|
return [$version, $deps];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class Plugin implements BundlePluginInterface
|
|||||||
return [
|
return [
|
||||||
BundleConfig::create(NetzmachtContaoLeafletBundle::class)
|
BundleConfig::create(NetzmachtContaoLeafletBundle::class)
|
||||||
->setLoadAfter([ContaoCoreBundle::class, NetzmachtContaoToolkitBundle::class])
|
->setLoadAfter([ContaoCoreBundle::class, NetzmachtContaoToolkitBundle::class])
|
||||||
->setReplace(['leaflet'])
|
->setReplace(['leaflet']),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class NetzmachtContaoLeafletExtension extends Extension
|
|||||||
{
|
{
|
||||||
$loader = new YamlFileLoader(
|
$loader = new YamlFileLoader(
|
||||||
$container,
|
$container,
|
||||||
new FileLocator(dirname(__DIR__) .'/Resources/config')
|
new FileLocator(dirname(__DIR__) . '/Resources/config')
|
||||||
);
|
);
|
||||||
|
|
||||||
// Common config, services and listeners
|
// Common config, services and listeners
|
||||||
|
|||||||
@@ -17,42 +17,36 @@
|
|||||||
array_insert(
|
array_insert(
|
||||||
$GLOBALS['BE_MOD'],
|
$GLOBALS['BE_MOD'],
|
||||||
1,
|
1,
|
||||||
array(
|
[
|
||||||
'leaflet' => array
|
'leaflet' => [
|
||||||
(
|
'leaflet_map' => [
|
||||||
'leaflet_map' => array
|
'tables' => [
|
||||||
(
|
|
||||||
'tables' => array
|
|
||||||
(
|
|
||||||
'tl_leaflet_map',
|
'tl_leaflet_map',
|
||||||
'tl_leaflet_control',
|
'tl_leaflet_control',
|
||||||
),
|
],
|
||||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/map.png',
|
'icon' => 'bundles/netzmachtcontaoleaflet/img/map.png',
|
||||||
'stylesheet' => 'bundles/netzmachtcontaoleaflet/css/backend.css',
|
'stylesheet' => 'bundles/netzmachtcontaoleaflet/css/backend.css',
|
||||||
),
|
],
|
||||||
'leaflet_layer' => array
|
'leaflet_layer' => [
|
||||||
(
|
'tables' => [
|
||||||
'tables' => array
|
|
||||||
(
|
|
||||||
'tl_leaflet_layer',
|
'tl_leaflet_layer',
|
||||||
'tl_leaflet_marker',
|
'tl_leaflet_marker',
|
||||||
'tl_leaflet_vector',
|
'tl_leaflet_vector',
|
||||||
'tl_leaflet_icon',
|
'tl_leaflet_icon',
|
||||||
'tl_leaflet_style',
|
'tl_leaflet_style',
|
||||||
'tl_leaflet_popup',
|
'tl_leaflet_popup',
|
||||||
),
|
],
|
||||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/layers.png',
|
'icon' => 'bundles/netzmachtcontaoleaflet/img/layers.png',
|
||||||
'stylesheet' => 'bundles/netzmachtcontaoleaflet/css/backend.css',
|
'stylesheet' => 'bundles/netzmachtcontaoleaflet/css/backend.css',
|
||||||
'javascript' => 'bundles/netzmachtcontaoleaflet/js/backend.js'
|
'javascript' => 'bundles/netzmachtcontaoleaflet/js/backend.js',
|
||||||
),
|
],
|
||||||
'leaflet_about' => array
|
'leaflet_about' => [
|
||||||
(
|
|
||||||
'callback' => Netzmacht\Contao\Leaflet\Backend\About::class,
|
'callback' => Netzmacht\Contao\Leaflet\Backend\About::class,
|
||||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/about.png',
|
'icon' => 'bundles/netzmachtcontaoleaflet/img/about.png',
|
||||||
'stylesheet' => 'bundles/netzmachtcontaoleaflet/css/about.css',
|
'stylesheet' => 'bundles/netzmachtcontaoleaflet/css/about.css',
|
||||||
)
|
],
|
||||||
)
|
],
|
||||||
)
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -74,5 +68,5 @@ $GLOBALS['TL_MODELS']['tl_leaflet_vector'] = \Netzmacht\Contao\Leaflet\Model\Ve
|
|||||||
|
|
||||||
$GLOBALS['TL_HOOKS']['initializeSystem'][] = [
|
$GLOBALS['TL_HOOKS']['initializeSystem'][] = [
|
||||||
'netzmacht.contao_leaflet.listeners.register_libraries',
|
'netzmacht.contao_leaflet.listeners.register_libraries',
|
||||||
'onInitializeSystem'
|
'onInitializeSystem',
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<div class="netzmacht-leaflet-credits">
|
<div class="netzmacht-leaflet-credits">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h1 class="sub_headline"><?php echo $this->headline; ?> <small><?php echo $this->version; ?></small></h1>
|
<h1 class="sub_headline"><?php echo $this->headline; ?>
|
||||||
</div>
|
<small><?php echo $this->version; ?></small>
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="tl_box block row">
|
<div class="tl_box block row">
|
||||||
<h2>About</h2>
|
<h2>About</h2>
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<p>
|
<p>
|
||||||
@@ -11,9 +13,11 @@
|
|||||||
This extension is only exists because of great other Open Source Software which it heavenly depends on.
|
This extension is only exists because of great other Open Source Software which it heavenly depends on.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
This software ships with an visible attribution to <em>netzmacht creative</em> in the map attribution control.
|
This software ships with an visible attribution to <em>netzmacht creative</em> in the map attribution
|
||||||
|
control.
|
||||||
If you want to remove this attribution, you have to purchase a commercial license.
|
If you want to remove this attribution, you have to purchase a commercial license.
|
||||||
For more details visit the <a href="https://netzmacht.de/contao-leaflet" target="_blank">project website</a>.
|
For more details visit the <a href="https://netzmacht.de/contao-leaflet" target="_blank">project
|
||||||
|
website</a>.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
@@ -31,32 +35,37 @@
|
|||||||
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
|
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
|
||||||
<input type="hidden" name="cmd" value="_s-xclick">
|
<input type="hidden" name="cmd" value="_s-xclick">
|
||||||
<input type="hidden" name="hosted_button_id" value="YWMA95YS3FT6U">
|
<input type="hidden" name="hosted_button_id" value="YWMA95YS3FT6U">
|
||||||
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
|
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_SM.gif" border="0"
|
||||||
|
name="submit" alt="PayPal – The safer, easier way to pay online.">
|
||||||
<img alt="" border="0" src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" width="1" height="1">
|
<img alt="" border="0" src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" width="1" height="1">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tl_box">
|
<div class="tl_box">
|
||||||
<h2>Support Contao Leaflet</h2>
|
<h2>Support Contao Leaflet</h2>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<h3>Report issues</h3>
|
<h3>Report issues</h3>
|
||||||
<p>If you found a bug, got some troubles or have a feature request - feel free to open an issue.</p>
|
<p>If you found a bug, got some troubles or have a feature request - feel free to open an issue.</p>
|
||||||
<p><a href="http://github.com/netzmacht/contao-leaflet-maps/issues" class="btn" target="_blank">Issue tracker</a> </p>
|
<p><a href="http://github.com/netzmacht/contao-leaflet-maps/issues" class="btn" target="_blank">Issue
|
||||||
|
tracker</a></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<h3>Contribute</h3>
|
<h3>Contribute</h3>
|
||||||
<p>There are many ways you can con­tribute. Translations,
|
<p>There are many ways you can con­tribute. Translations,
|
||||||
docu­mentation or code contributions are welcome.
|
docu­mentation or code contributions are welcome.
|
||||||
</p>
|
</p>
|
||||||
<p><a href="https://netzmacht/contao-leaflet/contribute.html" class="btn" target="_blank">Contribute</a> </p>
|
<p><a href="https://netzmacht/contao-leaflet/contribute.html" class="btn" target="_blank">Contribute</a>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<h3>Fund a feature</h3>
|
<h3>Fund a feature</h3>
|
||||||
<p>Contao Leaflet is not feature complete. Have a look at the list of planned feature and support them.</p>
|
<p>Contao Leaflet is not feature complete. Have a look at the list of planned feature and support
|
||||||
<p><a href="https://netzmacht/contao-leaflet/planned-features.html" class="btn" target="_blank">Planned features</a> </p>
|
them.</p>
|
||||||
|
<p><a href="https://netzmacht/contao-leaflet/planned-features.html" class="btn" target="_blank">Planned
|
||||||
|
features</a></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -64,17 +73,19 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
<h3>Individual development</h3>
|
<h3>Individual development</h3>
|
||||||
<p>If you have special requirements you can hire me for an individual development.</p>
|
<p>If you have special requirements you can hire me for an individual development.</p>
|
||||||
<p><a href="https://netzmacht/contao-leaflet/contact.html" class="btn" target="_blank">Contact</a> </p>
|
<p><a href="https://netzmacht/contao-leaflet/contact.html" class="btn" target="_blank">Contact</a></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<h3>Commercial license</h3>
|
<h3>Commercial license</h3>
|
||||||
<p>If you want to remove the attribution in the attribution control, you can purchase a commercial license.</p>
|
<p>If you want to remove the attribution in the attribution control, you can purchase a commercial
|
||||||
<p><a href="https://netzmacht/contao-leaflet/commercial-license.html" class="btn" target="_blank">Purchase license</a> </p>
|
license.</p>
|
||||||
|
<p><a href="https://netzmacht/contao-leaflet/commercial-license.html" class="btn" target="_blank">Purchase
|
||||||
|
license</a></p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="tl_box">
|
<div class="tl_box">
|
||||||
<h2>Credits</h2>
|
<h2>Credits</h2>
|
||||||
<table class="tl_listing">
|
<table class="tl_listing">
|
||||||
<tr>
|
<tr>
|
||||||
@@ -84,7 +95,9 @@
|
|||||||
<th>Homepage</th>
|
<th>Homepage</th>
|
||||||
</tr>
|
</tr>
|
||||||
<?php if ($this->libraries): ?>
|
<?php if ($this->libraries): ?>
|
||||||
<tr><th colspan="4" class="subtitle">Libraries</th> </tr>
|
<tr>
|
||||||
|
<th colspan="4" class="subtitle">Libraries</th>
|
||||||
|
</tr>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php foreach ($this->libraries as $library): ?>
|
<?php foreach ($this->libraries as $library): ?>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -110,7 +123,9 @@
|
|||||||
<td><a href="http://semlabs.co.uk/" target="_blank">semlabs.co.uk</a></td>
|
<td><a href="http://semlabs.co.uk/" target="_blank">semlabs.co.uk</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php if ($this->dependencies): ?>
|
<?php if ($this->dependencies): ?>
|
||||||
<tr><th colspan="4" class="subtitle">Dependencies</th> </tr>
|
<tr>
|
||||||
|
<th colspan="4" class="subtitle">Dependencies</th>
|
||||||
|
</tr>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php foreach ($this->dependencies as $dep): ?>
|
<?php foreach ($this->dependencies as $dep): ?>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -121,5 +136,5 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -17,14 +17,14 @@
|
|||||||
placeholder: '<?php echo $GLOBALS['TL_LANG']['leaflet']['searchPosition']; ?>'
|
placeholder: '<?php echo $GLOBALS['TL_LANG']['leaflet']['searchPosition']; ?>'
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
|
|
||||||
geocoder.on('markgeocode', function(event) {
|
geocoder.on('markgeocode', function (event) {
|
||||||
var container = document.createElement('div');
|
var container = document.createElement('div');
|
||||||
var link = document.createElement('button');
|
var link = document.createElement('button');
|
||||||
var result = event.geocode;
|
var result = event.geocode;
|
||||||
|
|
||||||
link.set('style', 'margin-left: 10px;');
|
link.set('style', 'margin-left: 10px;');
|
||||||
link.appendText('<?php echo $GLOBALS['TL_LANG']['leaflet']['applyPosition']; ?>');
|
link.appendText('<?php echo $GLOBALS['TL_LANG']['leaflet']['applyPosition']; ?>');
|
||||||
link.addEvent('click', function(e) {
|
link.addEvent('click', function (e) {
|
||||||
e.stop();
|
e.stop();
|
||||||
|
|
||||||
element.set('value', result.center.lat + ',' + result.center.lng);
|
element.set('value', result.center.lat + ',' + result.center.lng);
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
map.removeLayer(this._geocodeMarker);
|
map.removeLayer(this._geocodeMarker);
|
||||||
}
|
}
|
||||||
|
|
||||||
map.fitBounds(result.bbox, { padding: [0, 70]});
|
map.fitBounds(result.bbox, {padding: [0, 70]});
|
||||||
map.panTo(result.center);
|
map.panTo(result.center);
|
||||||
|
|
||||||
this._geocodeMarker = new L.Marker(result.center, {draggable: true})
|
this._geocodeMarker = new L.Marker(result.center, {draggable: true})
|
||||||
|
|||||||
@@ -9,5 +9,5 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- indexer::continue -->
|
<!-- indexer::continue -->
|
||||||
<?php $GLOBALS['TL_BODY'][] = '<script>' . $this->javascript .'</script>'; ?>
|
<?php $GLOBALS['TL_BODY'][] = '<script>' . $this->javascript . '</script>'; ?>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<div id="<?php echo $mapId; ?>" style="<?php echo $style; ?>"></div>
|
<div id="<?php echo $mapId; ?>" style="<?php echo $style; ?>"></div>
|
||||||
<script>
|
<script>
|
||||||
L.contao.addMap('<?php echo $mapId; ?>', function() {
|
L.contao.addMap('<?php echo $mapId; ?>', function () {
|
||||||
<?php echo $javascript; ?>
|
<?php echo $javascript; ?>
|
||||||
return { map: map, layers: layers, controls: controls, icons: icons };
|
return {map: map, layers: layers, controls: controls, icons: icons};
|
||||||
}());</script>
|
}());</script>
|
||||||
|
|||||||
@@ -9,4 +9,4 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- indexer::continue -->
|
<!-- indexer::continue -->
|
||||||
<?php $GLOBALS['TL_BODY'][] = '<script>' . $this->javascript .'</script>'; ?>
|
<?php $GLOBALS['TL_BODY'][] = '<script>' . $this->javascript . '</script>'; ?>
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
padding: 15px;
|
padding: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.netzmacht-leaflet-credits a {
|
.netzmacht-leaflet-credits a {
|
||||||
color: #669A00;
|
color: #669A00;
|
||||||
}
|
}
|
||||||
@@ -17,7 +16,7 @@
|
|||||||
.netzmacht-leaflet-credits h1 {
|
.netzmacht-leaflet-credits h1 {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 1.4em;
|
font-size: 1.4em;
|
||||||
text-shadow: 0 -1px 1px rgba(0,0,0,0.35);
|
text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.35);
|
||||||
}
|
}
|
||||||
|
|
||||||
.netzmacht-leaflet-credits .row:after {
|
.netzmacht-leaflet-credits .row:after {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class ContaoAssets implements Assets
|
|||||||
private $cache = [
|
private $cache = [
|
||||||
'stylesheets' => [],
|
'stylesheets' => [],
|
||||||
'javascripts' => [],
|
'javascripts' => [],
|
||||||
'map' => []
|
'map' => [],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ class BboxFilter implements Filter
|
|||||||
*/
|
*/
|
||||||
public function getValues()
|
public function getValues()
|
||||||
{
|
{
|
||||||
return array('bounds' => $this->bounds);
|
return ['bounds' => $this->bounds];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -88,9 +88,9 @@ class DistanceFilter implements Filter
|
|||||||
*/
|
*/
|
||||||
public function getValues()
|
public function getValues()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
'radius' => $this->radius,
|
'radius' => $this->radius,
|
||||||
'center' => $this->center
|
'center' => $this->center,
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,13 +28,13 @@ class DataController
|
|||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $input = array(
|
private $input = [
|
||||||
'format' => 'geojson',
|
'format' => 'geojson',
|
||||||
'type' => 'layer',
|
'type' => 'layer',
|
||||||
'id' => null,
|
'id' => null,
|
||||||
'filter' => null,
|
'filter' => null,
|
||||||
'values' => null
|
'values' => null,
|
||||||
);
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Debug mode.
|
* Debug mode.
|
||||||
@@ -140,9 +140,9 @@ class DataController
|
|||||||
default:
|
default:
|
||||||
$error = true;
|
$error = true;
|
||||||
|
|
||||||
return array($data, $error);
|
return [$data, $error];
|
||||||
}
|
}
|
||||||
|
|
||||||
return array($data, $error);
|
return [$data, $error];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,12 +57,12 @@ class RequestUrl implements \JsonSerializable
|
|||||||
*/
|
*/
|
||||||
public static function create($dataId, $type = null, $format = null, Request $request = null)
|
public static function create($dataId, $type = null, $format = null, Request $request = null)
|
||||||
{
|
{
|
||||||
$params = array(
|
$params = [
|
||||||
'for' => $request ? $request->getMapIdentifier() : null,
|
'for' => $request ? $request->getMapIdentifier() : null,
|
||||||
'type' => $type != 'layer' ? $type : null,
|
'type' => $type != 'layer' ? $type : null,
|
||||||
'id' => $dataId,
|
'id' => $dataId,
|
||||||
'format' => $format != 'geojson' ? $format : null
|
'format' => $format != 'geojson' ? $format : null,
|
||||||
);
|
];
|
||||||
|
|
||||||
$hash = base64_encode(implode(',', $params));
|
$hash = base64_encode(implode(',', $params));
|
||||||
$query = 'leaflet=' . $hash;
|
$query = 'leaflet=' . $hash;
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ class ControlDcaListener extends AbstractListener
|
|||||||
*/
|
*/
|
||||||
public function getZoomControls()
|
public function getZoomControls()
|
||||||
{
|
{
|
||||||
$collection = ControlModel::findBy('type', 'zoom', array('order' => 'title'));
|
$collection = ControlModel::findBy('type', 'zoom', ['order' => 'title']);
|
||||||
|
|
||||||
return OptionsBuilder::fromCollection($collection, 'title')->getOptions();
|
return OptionsBuilder::fromCollection($collection, 'title')->getOptions();
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,7 @@ class ControlDcaListener extends AbstractListener
|
|||||||
'lid' => $layer['layer'],
|
'lid' => $layer['layer'],
|
||||||
'cid' => $dataContainer->id,
|
'cid' => $dataContainer->id,
|
||||||
'mode' => $layer['mode'],
|
'mode' => $layer['mode'],
|
||||||
'sorting' => $sorting
|
'sorting' => $sorting,
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->connection->insert('tl_leaflet_control_layer', $data);
|
$this->connection->insert('tl_leaflet_control_layer', $data);
|
||||||
@@ -177,10 +177,10 @@ class ControlDcaListener extends AbstractListener
|
|||||||
[
|
[
|
||||||
'tstamp' => time(),
|
'tstamp' => time(),
|
||||||
'sorting' => $sorting,
|
'sorting' => $sorting,
|
||||||
'mode' => $layer['mode']
|
'mode' => $layer['mode'],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'id' => $values[$layer['layer']]['id']
|
'id' => $values[$layer['layer']]['id'],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ class LayerDcaListener extends AbstractListener
|
|||||||
return $this->tileProviders[$dataContainer->activeRecord->tile_provider]['variants'];
|
return $this->tileProviders[$dataContainer->activeRecord->tile_provider]['variants'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return array();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -233,8 +233,8 @@ class LayerDcaListener extends AbstractListener
|
|||||||
public function getPasteButtons($dataContainer, $row, $table, $whatever, $children)
|
public function getPasteButtons($dataContainer, $row, $table, $whatever, $children)
|
||||||
{
|
{
|
||||||
$pasteAfterUrl = \Controller::addToUrl(
|
$pasteAfterUrl = \Controller::addToUrl(
|
||||||
'act='.$children['mode'].'&mode=1&pid='.$row['id']
|
'act=' . $children['mode'] . '&mode=1&pid=' . $row['id']
|
||||||
.(!is_array($children['id']) ? '&id='.$children['id'] : '')
|
. (!is_array($children['id']) ? '&id=' . $children['id'] : '')
|
||||||
. '&rt=' . RequestToken::get()
|
. '&rt=' . RequestToken::get()
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -254,7 +254,7 @@ class LayerDcaListener extends AbstractListener
|
|||||||
'act=%s&mode=2&pid=%s%s',
|
'act=%s&mode=2&pid=%s%s',
|
||||||
$children['mode'],
|
$children['mode'],
|
||||||
$row['id'],
|
$row['id'],
|
||||||
!is_array($children['id']) ? '&id='.$children['id'] : ''
|
!is_array($children['id']) ? '&id=' . $children['id'] : ''
|
||||||
) . '&rt=' . RequestToken::get()
|
) . '&rt=' . RequestToken::get()
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -365,7 +365,7 @@ class LayerDcaListener extends AbstractListener
|
|||||||
*/
|
*/
|
||||||
public function getBoundsModes($dataContainer)
|
public function getBoundsModes($dataContainer)
|
||||||
{
|
{
|
||||||
$options = array();
|
$options = [];
|
||||||
|
|
||||||
if ($dataContainer->activeRecord && !empty($this->layers[$dataContainer->activeRecord->type]['boundsMode'])) {
|
if ($dataContainer->activeRecord && !empty($this->layers[$dataContainer->activeRecord->type]['boundsMode'])) {
|
||||||
foreach ($this->layers[$dataContainer->activeRecord->type]['boundsMode'] as $mode => $enabled) {
|
foreach ($this->layers[$dataContainer->activeRecord->type]['boundsMode'] as $mode => $enabled) {
|
||||||
@@ -413,7 +413,7 @@ class LayerDcaListener extends AbstractListener
|
|||||||
*/
|
*/
|
||||||
public function getIcons()
|
public function getIcons()
|
||||||
{
|
{
|
||||||
$collection = IconModel::findAll(array('order' => 'title'));
|
$collection = IconModel::findAll(['order' => 'title']);
|
||||||
$builder = OptionsBuilder::fromCollection(
|
$builder = OptionsBuilder::fromCollection(
|
||||||
$collection,
|
$collection,
|
||||||
function ($model) {
|
function ($model) {
|
||||||
|
|||||||
@@ -100,8 +100,8 @@ class LeafletDcaListener
|
|||||||
*/
|
*/
|
||||||
public function getLayers()
|
public function getLayers()
|
||||||
{
|
{
|
||||||
$options = array();
|
$options = [];
|
||||||
$collection = LayerModel::findBy('pid', '0', array('order' => 'title'));
|
$collection = LayerModel::findBy('pid', '0', ['order' => 'title']);
|
||||||
|
|
||||||
if ($collection) {
|
if ($collection) {
|
||||||
foreach ($collection as $model) {
|
foreach ($collection as $model) {
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class MapDcaListener extends AbstractListener
|
|||||||
public function saveLayerRelations($layerId, $dataContainer)
|
public function saveLayerRelations($layerId, $dataContainer)
|
||||||
{
|
{
|
||||||
$new = array_filter(StringUtil::deserialize($layerId, true));
|
$new = array_filter(StringUtil::deserialize($layerId, true));
|
||||||
$values = array();
|
$values = [];
|
||||||
$statement = $this->connection->prepare('SELECT * FROM tl_leaflet_map_layer WHERE mid=:mid order BY sorting');
|
$statement = $this->connection->prepare('SELECT * FROM tl_leaflet_map_layer WHERE mid=:mid order BY sorting');
|
||||||
|
|
||||||
$statement->bindValue('mid', $dataContainer->id);
|
$statement->bindValue('mid', $dataContainer->id);
|
||||||
@@ -108,7 +108,7 @@ class MapDcaListener extends AbstractListener
|
|||||||
'tstamp' => time(),
|
'tstamp' => time(),
|
||||||
'lid' => $layerId,
|
'lid' => $layerId,
|
||||||
'mid' => $dataContainer->id,
|
'mid' => $dataContainer->id,
|
||||||
'sorting' => $sorting
|
'sorting' => $sorting,
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->connection->insert('tl_leaflet_map_layer', $data);
|
$this->connection->insert('tl_leaflet_map_layer', $data);
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class MarkerDcaListener
|
|||||||
*/
|
*/
|
||||||
public function getIcons()
|
public function getIcons()
|
||||||
{
|
{
|
||||||
$collection = IconModel::findAll(array('order' => 'title'));
|
$collection = IconModel::findAll(['order' => 'title']);
|
||||||
$builder = OptionsBuilder::fromCollection(
|
$builder = OptionsBuilder::fromCollection(
|
||||||
$collection,
|
$collection,
|
||||||
function ($model) {
|
function ($model) {
|
||||||
@@ -89,7 +89,7 @@ class MarkerDcaListener
|
|||||||
*/
|
*/
|
||||||
public function getPopups()
|
public function getPopups()
|
||||||
{
|
{
|
||||||
$collection = PopupModel::findAll(array('order' => 'title'));
|
$collection = PopupModel::findAll(['order' => 'title']);
|
||||||
$builder = OptionsBuilder::fromCollection($collection, 'title');
|
$builder = OptionsBuilder::fromCollection($collection, 'title');
|
||||||
|
|
||||||
return $builder->getOptions();
|
return $builder->getOptions();
|
||||||
@@ -105,11 +105,11 @@ class MarkerDcaListener
|
|||||||
*/
|
*/
|
||||||
public function saveCoordinates($value, $dataContainer)
|
public function saveCoordinates($value, $dataContainer)
|
||||||
{
|
{
|
||||||
$combined = array(
|
$combined = [
|
||||||
'latitude' => null,
|
'latitude' => null,
|
||||||
'longitude' => null,
|
'longitude' => null,
|
||||||
'altitude' => null
|
'altitude' => null,
|
||||||
);
|
];
|
||||||
|
|
||||||
$values = trimsplit(',', $value);
|
$values = trimsplit(',', $value);
|
||||||
$keys = array_keys($combined);
|
$keys = array_keys($combined);
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ class VectorDcaListener extends AbstractListener
|
|||||||
*/
|
*/
|
||||||
public function getStyles()
|
public function getStyles()
|
||||||
{
|
{
|
||||||
$collection = StyleModel::findAll(array('order' => 'title'));
|
$collection = StyleModel::findAll(['order' => 'title']);
|
||||||
|
|
||||||
return OptionsBuilder::fromCollection($collection, 'title')->getOptions();
|
return OptionsBuilder::fromCollection($collection, 'title')->getOptions();
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ class VectorDcaListener extends AbstractListener
|
|||||||
*/
|
*/
|
||||||
public function getIcons()
|
public function getIcons()
|
||||||
{
|
{
|
||||||
$collection = IconModel::findAll(array('order' => 'title'));
|
$collection = IconModel::findAll(['order' => 'title']);
|
||||||
$builder = OptionsBuilder::fromCollection(
|
$builder = OptionsBuilder::fromCollection(
|
||||||
$collection,
|
$collection,
|
||||||
function ($model) {
|
function ($model) {
|
||||||
@@ -116,7 +116,7 @@ class VectorDcaListener extends AbstractListener
|
|||||||
*/
|
*/
|
||||||
public function getPopups()
|
public function getPopups()
|
||||||
{
|
{
|
||||||
$collection = PopupModel::findAll(array('order' => 'title'));
|
$collection = PopupModel::findAll(['order' => 'title']);
|
||||||
$builder = OptionsBuilder::fromCollection($collection, 'title');
|
$builder = OptionsBuilder::fromCollection($collection, 'title');
|
||||||
|
|
||||||
return $builder->getOptions();
|
return $builder->getOptions();
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ final class GeoJsonListener
|
|||||||
public function enrichCircle(GeoJsonObject $feature, LeafletDefinition $definition)
|
public function enrichCircle(GeoJsonObject $feature, LeafletDefinition $definition)
|
||||||
{
|
{
|
||||||
if ($definition instanceof Circle && !$definition instanceof CircleMarker && $feature instanceof Feature) {
|
if ($definition instanceof Circle && !$definition instanceof CircleMarker && $feature instanceof Feature) {
|
||||||
$feature->setProperty('arguments', array($definition->getLatLng(), $definition->getRadius()));
|
$feature->setProperty('arguments', [$definition->getLatLng(), $definition->getRadius()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ final class GeoJsonListener
|
|||||||
if ($collection) {
|
if ($collection) {
|
||||||
$value = $collection->fetchEach('path');
|
$value = $collection->fetchEach('path');
|
||||||
} else {
|
} else {
|
||||||
$value = array();
|
$value = [];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -27,12 +27,12 @@ class HashSubscriber implements EventSubscriberInterface
|
|||||||
*/
|
*/
|
||||||
public static function getSubscribedEvents()
|
public static function getSubscribedEvents()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
GetHashEvent::NAME => array(
|
GetHashEvent::NAME => [
|
||||||
array('getModelHash'),
|
['getModelHash'],
|
||||||
array('getFallback', -100)
|
['getFallback', -100],
|
||||||
)
|
],
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -127,12 +127,12 @@ class LoadAssetsListener
|
|||||||
$assets = $this->libraries[$library];
|
$assets = $this->libraries[$library];
|
||||||
|
|
||||||
if (!empty($assets['css'])) {
|
if (!empty($assets['css'])) {
|
||||||
list ($source, $type) = (array)$assets['css'];
|
list ($source, $type) = (array) $assets['css'];
|
||||||
$this->assets->addStylesheet($source, $type ?: Assets::TYPE_FILE);
|
$this->assets->addStylesheet($source, $type ?: Assets::TYPE_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($assets['javascript'])) {
|
if (!empty($assets['javascript'])) {
|
||||||
list ($source, $type) = (array)$assets['javascript'];
|
list ($source, $type) = (array) $assets['javascript'];
|
||||||
$this->assets->addJavascript($source, $type ?: Assets::TYPE_FILE);
|
$this->assets->addJavascript($source, $type ?: Assets::TYPE_FILE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ class MapProvider
|
|||||||
$cacheKey,
|
$cacheKey,
|
||||||
[
|
[
|
||||||
'assets' => $this->assets->toArray(),
|
'assets' => $this->assets->toArray(),
|
||||||
'javascript' => $buffer
|
'javascript' => $buffer,
|
||||||
],
|
],
|
||||||
(int) $model->cacheLifeTime
|
(int) $model->cacheLifeTime
|
||||||
);
|
);
|
||||||
@@ -279,7 +279,7 @@ class MapProvider
|
|||||||
throw new \RuntimeException('Bad request. Could not resolve query params');
|
throw new \RuntimeException('Bad request. Could not resolve query params');
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = array_combine(array('for', 'type', 'id', 'format', 'filter', 'values'), $data);
|
$data = array_combine(['for', 'type', 'id', 'format', 'filter', 'values'], $data);
|
||||||
$data = array_filter($data);
|
$data = array_filter($data);
|
||||||
|
|
||||||
if (empty($data['for']) || $data['for'] != $identifier) {
|
if (empty($data['for']) || $data['for'] != $identifier) {
|
||||||
|
|||||||
@@ -156,9 +156,9 @@ abstract class AbstractMapper implements Mapper
|
|||||||
Request $request = null,
|
Request $request = null,
|
||||||
$elementId = null
|
$elementId = null
|
||||||
) {
|
) {
|
||||||
return array(
|
return [
|
||||||
$this->getElementId($model, $elementId)
|
$this->getElementId($model, $elementId),
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ class LayersControlMapper extends AbstractControlMapper
|
|||||||
$elementId = null
|
$elementId = null
|
||||||
) {
|
) {
|
||||||
$arguments = parent::buildConstructArguments($model, $mapper, $request, $elementId);
|
$arguments = parent::buildConstructArguments($model, $mapper, $request, $elementId);
|
||||||
$arguments[1] = array();
|
$arguments[1] = [];
|
||||||
$arguments[2] = array();
|
$arguments[2] = [];
|
||||||
|
|
||||||
/** @var ControlModel $model */
|
/** @var ControlModel $model */
|
||||||
$collection = $model->findActiveLayers();
|
$collection = $model->findActiveLayers();
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ class LoadingControlMapper extends AbstractControlMapper
|
|||||||
if ($definition instanceof LoadingControl && !$definition->isSeparate() && $model->zoomControl) {
|
if ($definition instanceof LoadingControl && !$definition->isSeparate() && $model->zoomControl) {
|
||||||
// Only assign if zoom control is activated and part of the map.
|
// Only assign if zoom control is activated and part of the map.
|
||||||
$control = ControlModel::findOneBy(
|
$control = ControlModel::findOneBy(
|
||||||
array('active=1', 'type=?', 'pid=?', 'id=?'),
|
['active=1', 'type=?', 'pid=?', 'id=?'],
|
||||||
array('zoom', $model->pid, $model->zoomControl)
|
['zoom', $model->pid, $model->zoomControl]
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($control) {
|
if ($control) {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class DefinitionMapper
|
|||||||
*
|
*
|
||||||
* @var Mapper[][]
|
* @var Mapper[][]
|
||||||
*/
|
*/
|
||||||
private $mappers = array();
|
private $mappers = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The event dispatcher.
|
* The event dispatcher.
|
||||||
@@ -48,7 +48,7 @@ class DefinitionMapper
|
|||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $mapped = array();
|
private $mapped = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct.
|
* Construct.
|
||||||
@@ -84,7 +84,7 @@ class DefinitionMapper
|
|||||||
*/
|
*/
|
||||||
public function reset()
|
public function reset()
|
||||||
{
|
{
|
||||||
$this->mapped = array();
|
$this->mapped = [];
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,9 +62,9 @@ class GroupLayerMapper extends AbstractLayerMapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
$collection = LayerModel::findBy(
|
$collection = LayerModel::findBy(
|
||||||
array('pid=?', 'active=1'),
|
['pid=?', 'active=1'],
|
||||||
array($model->id),
|
[$model->id],
|
||||||
array('order' => 'sorting')
|
['order' => 'sorting']
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($collection) {
|
if ($collection) {
|
||||||
|
|||||||
@@ -108,9 +108,9 @@ class MarkerClusterLayerMapper extends AbstractLayerMapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
$collection = LayerModel::findBy(
|
$collection = LayerModel::findBy(
|
||||||
array('pid=?', 'active=1'),
|
['pid=?', 'active=1'],
|
||||||
array($model->id),
|
[$model->id],
|
||||||
array('order' => 'sorting')
|
['order' => 'sorting']
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($collection) {
|
if ($collection) {
|
||||||
|
|||||||
@@ -71,18 +71,18 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
|||||||
$layer->setOption('boundsMode', $model->boundsMode);
|
$layer->setOption('boundsMode', $model->boundsMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return [
|
||||||
$this->getElementId($model, $elementId),
|
$this->getElementId($model, $elementId),
|
||||||
RequestUrl::create($model->id, null, null, $request),
|
RequestUrl::create($model->id, null, null, $request),
|
||||||
array(),
|
[],
|
||||||
$layer
|
$layer,
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return [
|
||||||
$this->getElementId($model, $elementId),
|
$this->getElementId($model, $elementId),
|
||||||
RequestUrl::create($model->id, null, null, $request)
|
RequestUrl::create($model->id, null, null, $request),
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::buildConstructArguments($model, $mapper, $request, $elementId);
|
return parent::buildConstructArguments($model, $mapper, $request, $elementId);
|
||||||
|
|||||||
@@ -92,10 +92,10 @@ class ProviderLayerMapper extends AbstractLayerMapper
|
|||||||
Request $request = null,
|
Request $request = null,
|
||||||
$elementId = null
|
$elementId = null
|
||||||
) {
|
) {
|
||||||
return array(
|
return [
|
||||||
$model->alias ?: ('layer_' . $model->id),
|
$model->alias ?: ('layer_' . $model->id),
|
||||||
$model->tile_provider,
|
$model->tile_provider,
|
||||||
$model->tile_provider_variant ?: null
|
$model->tile_provider_variant ?: null,
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
|||||||
$elementId = null
|
$elementId = null
|
||||||
) {
|
) {
|
||||||
if ($model->deferred) {
|
if ($model->deferred) {
|
||||||
$options = array();
|
$options = [];
|
||||||
|
|
||||||
if ($model->pointToLayer) {
|
if ($model->pointToLayer) {
|
||||||
$options['pointToLayer'] = new Expression($model->pointToLayer);
|
$options['pointToLayer'] = new Expression($model->pointToLayer);
|
||||||
@@ -79,18 +79,18 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
|||||||
$layer = new GeoJson($this->getElementId($model, $elementId));
|
$layer = new GeoJson($this->getElementId($model, $elementId));
|
||||||
$layer->setOptions($options);
|
$layer->setOptions($options);
|
||||||
|
|
||||||
return array(
|
return [
|
||||||
$this->getElementId($model, $elementId),
|
$this->getElementId($model, $elementId),
|
||||||
RequestUrl::create($model->id, null, null, $request),
|
RequestUrl::create($model->id, null, null, $request),
|
||||||
array(),
|
[],
|
||||||
$layer
|
$layer,
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return [
|
||||||
$this->getElementId($model, $elementId),
|
$this->getElementId($model, $elementId),
|
||||||
RequestUrl::create($model->id, null, null, $request)
|
RequestUrl::create($model->id, null, null, $request),
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::buildConstructArguments($model, $mapper, $request, $elementId);
|
return parent::buildConstructArguments($model, $mapper, $request, $elementId);
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ class MapMapper extends AbstractMapper
|
|||||||
->addOptions('center', 'zoom', 'zoomControl')
|
->addOptions('center', 'zoom', 'zoomControl')
|
||||||
->addOptions('dragging', 'touchZoom', 'scrollWheelZoom', 'doubleClickZoom', 'boxZoom', 'tap', 'keyboard')
|
->addOptions('dragging', 'touchZoom', 'scrollWheelZoom', 'doubleClickZoom', 'boxZoom', 'tap', 'keyboard')
|
||||||
->addOptions('trackResize', 'closeOnClick', 'bounceAtZoomLimits')
|
->addOptions('trackResize', 'closeOnClick', 'bounceAtZoomLimits')
|
||||||
->addConditionalOptions('adjustZoomExtra', array('minZoom', 'maxZoom', 'zoomSnap', 'zoomDelta'))
|
->addConditionalOptions('adjustZoomExtra', ['minZoom', 'maxZoom', 'zoomSnap', 'zoomDelta'])
|
||||||
->addConditionalOptions('keyboard', array('keyboardPanOffset', 'keyboardZoomOffset'));
|
->addConditionalOptions('keyboard', ['keyboardPanOffset', 'keyboardZoomOffset']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,10 +82,10 @@ class MapMapper extends AbstractMapper
|
|||||||
Request $request = null,
|
Request $request = null,
|
||||||
$elementId = null
|
$elementId = null
|
||||||
) {
|
) {
|
||||||
return array(
|
return [
|
||||||
$this->getElementId($model, $elementId),
|
$this->getElementId($model, $elementId),
|
||||||
$this->getElementId($model, $elementId)
|
$this->getElementId($model, $elementId),
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -121,7 +121,7 @@ class MapMapper extends AbstractMapper
|
|||||||
*/
|
*/
|
||||||
private function buildControls(Map $map, MapModel $model, DefinitionMapper $mapper, Request $request = null)
|
private function buildControls(Map $map, MapModel $model, DefinitionMapper $mapper, Request $request = null)
|
||||||
{
|
{
|
||||||
$collection = ControlModel::findActiveBy('pid', $model->id, array('order' => 'sorting'));
|
$collection = ControlModel::findActiveBy('pid', $model->id, ['order' => 'sorting']);
|
||||||
|
|
||||||
if (!$collection) {
|
if (!$collection) {
|
||||||
return;
|
return;
|
||||||
@@ -207,13 +207,13 @@ class MapMapper extends AbstractMapper
|
|||||||
private function buildLocate(Map $map, MapModel $model)
|
private function buildLocate(Map $map, MapModel $model)
|
||||||
{
|
{
|
||||||
if ($model->locate) {
|
if ($model->locate) {
|
||||||
$options = array();
|
$options = [];
|
||||||
|
|
||||||
$mapping = array(
|
$mapping = [
|
||||||
'setView' => 'locateSetView',
|
'setView' => 'locateSetView',
|
||||||
'watch' => 'locateWatch',
|
'watch' => 'locateWatch',
|
||||||
'enableHighAccuracy' => 'enableHighAccuracy',
|
'enableHighAccuracy' => 'enableHighAccuracy',
|
||||||
);
|
];
|
||||||
|
|
||||||
foreach ($mapping as $option => $property) {
|
foreach ($mapping as $option => $property) {
|
||||||
if ($model->$property) {
|
if ($model->$property) {
|
||||||
@@ -221,11 +221,11 @@ class MapMapper extends AbstractMapper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$mapping = array(
|
$mapping = [
|
||||||
'maxZoom' => 'locateMaxZoom',
|
'maxZoom' => 'locateMaxZoom',
|
||||||
'timeout' => 'locateTimeout',
|
'timeout' => 'locateTimeout',
|
||||||
'maximumAge' => 'locateMaximumAge',
|
'maximumAge' => 'locateMaximumAge',
|
||||||
);
|
];
|
||||||
|
|
||||||
foreach ($mapping as $option => $property) {
|
foreach ($mapping as $option => $property) {
|
||||||
if ($model->$property) {
|
if ($model->$property) {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
|
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
|
||||||
* @filesource
|
* @filesource
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper;
|
namespace Netzmacht\Contao\Leaflet\Mapper;
|
||||||
|
|
||||||
use Contao\Model;
|
use Contao\Model;
|
||||||
@@ -30,14 +31,14 @@ class OptionsBuilder
|
|||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $options = array();
|
private $options = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Conditional option mapping.
|
* Conditional option mapping.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $conditional = array();
|
private $conditional = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a option mapping.
|
* Add a option mapping.
|
||||||
@@ -253,7 +254,7 @@ class OptionsBuilder
|
|||||||
*/
|
*/
|
||||||
private static function getDefaultOption($option, $definition)
|
private static function getDefaultOption($option, $definition)
|
||||||
{
|
{
|
||||||
$keys = array('has', 'is', 'get');
|
$keys = ['has', 'is', 'get'];
|
||||||
$suffix = ucfirst($option);
|
$suffix = ucfirst($option);
|
||||||
|
|
||||||
foreach ($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class FixedStyleMapper extends AbstractStyleMapper
|
|||||||
->addConditionalOption('lineCap')
|
->addConditionalOption('lineCap')
|
||||||
->addConditionalOption('lineJoin')
|
->addConditionalOption('lineJoin')
|
||||||
->addConditionalOption('dashArray')
|
->addConditionalOption('dashArray')
|
||||||
->addConditionalOptions('fill', array('fillColor', 'fillOpacity'))
|
->addConditionalOptions('fill', ['fillColor', 'fillOpacity'])
|
||||||
->addOption('fill');
|
->addOption('fill');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,14 +95,14 @@ class ImageIconMapper extends AbstractIconMapper
|
|||||||
$definition->setIconUrl($file->path);
|
$definition->setIconUrl($file->path);
|
||||||
|
|
||||||
$file = new \File($file->path);
|
$file = new \File($file->path);
|
||||||
$definition->setIconSize(array($file->width, $file->height));
|
$definition->setIconSize([$file->width, $file->height]);
|
||||||
|
|
||||||
if (!$model->iconAnchor) {
|
if (!$model->iconAnchor) {
|
||||||
$definition->setIconAnchor(array($file->width / 2, $file->height));
|
$definition->setIconAnchor([($file->width / 2), $file->height]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$model->popupAnchor) {
|
if (!$model->popupAnchor) {
|
||||||
$definition->setPopupAnchor(array(0, 8 - $file->height));
|
$definition->setPopupAnchor([0, (8 - $file->height)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -137,10 +137,10 @@ class ImageIconMapper extends AbstractIconMapper
|
|||||||
$definition->setShadowUrl($file->path);
|
$definition->setShadowUrl($file->path);
|
||||||
|
|
||||||
$file = new \File($file->path);
|
$file = new \File($file->path);
|
||||||
$definition->setShadowSize(array($file->width, $file->height));
|
$definition->setShadowSize([$file->width, $file->height]);
|
||||||
|
|
||||||
if (!$model->shadowAnchor) {
|
if (!$model->shadowAnchor) {
|
||||||
$definition->setShadowAnchor(array($file->width / 2, $file->height));
|
$definition->setShadowAnchor([($file->width / 2), $file->height]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ class MarkerMapper extends AbstractMapper
|
|||||||
$elementId = null
|
$elementId = null
|
||||||
) {
|
) {
|
||||||
$arguments = parent::buildConstructArguments($model, $mapper, $request, $elementId);
|
$arguments = parent::buildConstructArguments($model, $mapper, $request, $elementId);
|
||||||
$arguments[] = array($model->latitude, $model->longitude, $model->altitude ?: null) ?: null;
|
$arguments[] = [$model->latitude, $model->longitude, $model->altitude ?: null] ?: null;
|
||||||
|
|
||||||
return $arguments;
|
return $arguments;
|
||||||
}
|
}
|
||||||
@@ -124,9 +124,9 @@ class MarkerMapper extends AbstractMapper
|
|||||||
|
|
||||||
if ($model->customIcon) {
|
if ($model->customIcon) {
|
||||||
$iconModel = IconModel::findBy(
|
$iconModel = IconModel::findBy(
|
||||||
array('id=?', 'active=1'),
|
['id=?', 'active=1'],
|
||||||
array($model->icon),
|
[$model->icon],
|
||||||
array('return' => 'Model')
|
['return' => 'Model']
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($iconModel) {
|
if ($iconModel) {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ abstract class AbstractActiveModel extends \Model
|
|||||||
*
|
*
|
||||||
* @return \Model|null
|
* @return \Model|null
|
||||||
*/
|
*/
|
||||||
public static function findActiveByPK($modelId, $options = array())
|
public static function findActiveByPK($modelId, $options = [])
|
||||||
{
|
{
|
||||||
return static::findOneBy('active=1 AND id', $modelId, $options);
|
return static::findOneBy('active=1 AND id', $modelId, $options);
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ abstract class AbstractActiveModel extends \Model
|
|||||||
*
|
*
|
||||||
* @return Collection|null
|
* @return Collection|null
|
||||||
*/
|
*/
|
||||||
public static function findActiveBy($column, $value, $options = array())
|
public static function findActiveBy($column, $value, $options = [])
|
||||||
{
|
{
|
||||||
if (is_array($column)) {
|
if (is_array($column)) {
|
||||||
$column[] = 'active=1';
|
$column[] = 'active=1';
|
||||||
@@ -61,7 +61,7 @@ abstract class AbstractActiveModel extends \Model
|
|||||||
*
|
*
|
||||||
* @return Collection|null
|
* @return Collection|null
|
||||||
*/
|
*/
|
||||||
public static function findActives($options = array())
|
public static function findActives($options = [])
|
||||||
{
|
{
|
||||||
return static::findBy('active', '1', $options);
|
return static::findBy('active', '1', $options);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,18 +42,18 @@ class LayerModel extends AbstractActiveModel
|
|||||||
*
|
*
|
||||||
* @return Collection|null
|
* @return Collection|null
|
||||||
*/
|
*/
|
||||||
public static function findMultipleByTypes(array $types, $options = array())
|
public static function findMultipleByTypes(array $types, $options = [])
|
||||||
{
|
{
|
||||||
if (empty($types)) {
|
if (empty($types)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$options['column'] = array(
|
$options['column'] = [
|
||||||
sprintf(
|
sprintf(
|
||||||
'type IN (%s)',
|
'type IN (%s)',
|
||||||
substr(str_repeat('?,', count($types)), 0, -1)
|
substr(str_repeat('?,', count($types)), 0, -1)
|
||||||
)
|
),
|
||||||
);
|
];
|
||||||
|
|
||||||
$options['value'] = $types;
|
$options['value'] = $types;
|
||||||
$options['return'] = 'Collection';
|
$options['return'] = 'Collection';
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class MarkerModel extends AbstractActiveModel
|
|||||||
public static function findByFilter($pid, Filter $filter = null)
|
public static function findByFilter($pid, Filter $filter = null)
|
||||||
{
|
{
|
||||||
if (!$filter) {
|
if (!$filter) {
|
||||||
return static::findActiveBy('pid', $pid, array('order' => 'sorting'));
|
return static::findActiveBy('pid', $pid, ['order' => 'sorting']);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($filter->getName()) {
|
switch ($filter->getName()) {
|
||||||
@@ -63,23 +63,23 @@ class MarkerModel extends AbstractActiveModel
|
|||||||
*/
|
*/
|
||||||
public static function findByBBoxFilter($pid, BboxFilter $filter)
|
public static function findByBBoxFilter($pid, BboxFilter $filter)
|
||||||
{
|
{
|
||||||
$columns = array(
|
$columns = [
|
||||||
'active=1',
|
'active=1',
|
||||||
'pid=?',
|
'pid=?',
|
||||||
'latitude > ? AND latitude < ?',
|
'latitude > ? AND latitude < ?',
|
||||||
'longitude > ? AND longitude < ?'
|
'longitude > ? AND longitude < ?',
|
||||||
);
|
];
|
||||||
|
|
||||||
/** @var LatLngBounds $bounds */
|
/** @var LatLngBounds $bounds */
|
||||||
$bounds = $filter->getValues()['bounds'];
|
$bounds = $filter->getValues()['bounds'];
|
||||||
$values = array(
|
$values = [
|
||||||
$pid,
|
$pid,
|
||||||
$bounds->getSouthWest()->getLatitude(),
|
$bounds->getSouthWest()->getLatitude(),
|
||||||
$bounds->getNorthEast()->getLatitude(),
|
$bounds->getNorthEast()->getLatitude(),
|
||||||
$bounds->getSouthWest()->getLongitude(),
|
$bounds->getSouthWest()->getLongitude(),
|
||||||
$bounds->getNorthEast()->getLongitude()
|
$bounds->getNorthEast()->getLongitude(),
|
||||||
);
|
];
|
||||||
|
|
||||||
return static::findBy($columns, $values, array('order' => 'sorting'));
|
return static::findBy($columns, $values, ['order' => 'sorting']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user