1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{% set idmap = id|default('mapid') %}
<script type="text/javascript">
$(function () {
$('[data-toggle="tooltip"]').tooltip()
if ($('#{{idmap}}').length) {
var mymap = L.map('{{idmap}}').setView({{KOH_MAP_CENTER}}, {{KOH_MAP_ZOOM}});
L.tileLayer('https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', {maxZoom: 18, attribution: '© Openstreetmap France | © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}).addTo(mymap);
{# AJOUTER LES MARQUEURS SUR LA CARTE #}
{% set prestataires = getAllPrestataires() %}
{% set count = 1 %}
{% for presta in prestataires %}
{% if presta.geolocs|length > 0 %}
{% for geolocp in presta.geolocs %}
{% if geolocp.enabled and geolocp.geoloc.lat != null and geolocp.geoloc.lon != null %}
{% if presta.rubriques|length > 0 and presta.rubriques.first.media is not null %}
var icon = L.icon({
iconSize: [50, 50],
iconAnchor: [50,25],
className: 'kohino-map-icon',
iconUrl : '{% path presta.rubriques.first.media, "preview" %}'
});
var marker_{{count}} = L.marker([{{geolocp.geoloc.lat}}, {{geolocp.geoloc.lon}}], {icon: icon}).addTo(mymap);
{% else %}
var marker_{{count}} = L.marker([{{geolocp.geoloc.lat}}, {{geolocp.geoloc.lon}}]).addTo(mymap);
{% endif %}
marker_{{count}}.bindPopup("{% spaceless %}{% if presta.media != null %}{% set media %}{% thumbnail presta.media, 'small' %}{% endset %} {{ media|raw|replace({'"' : "'"})|raw }}<br/><br/>{% endif %}
<a target='_blank' href='{{ path('show_prestataire', {'slug': presta.slug}) }}'>
<strong style='font-size:16px;'>{{presta.__toString()}}</strong>
</a>
<br/>
{% if presta.horaires is not null %}
<p>{{presta.horaires}}</p>
{% endif %}
{% for rubrique in presta.rubriques %}
<a class='maprubrique' href='{{ path('show_rubrique', {'slug': rubrique.slug}) }}'>{{rubrique.name|replace({"\n": '<br/>'})}}</a>{% if not loop.last %} - {% endif %}
{% endfor %}
{% endspaceless %}");
{% set count = count+1 %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
}
})
</script>