templates/front/theme1/bloc/map-contact.html.twig line 1

Open in your IDE?
  1. {% set parametre = ParametreSite() %}
    {% if param_contact.typeMap != 0 %}
        {% if param_contact and param_contact.actifMap == 1 %}
    
            {% if param_contact.typeMap == 1 and param_contact.iframeMap != "" %}
                {# <iframe class="iframe-map" src="{{param_contact.iframeMap}}" width="100%" height="450" style="border:0;" allowfullscreen loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe> #}
    
                <div class="googlemaps_embed" width="100%" height="450" id="{{param_contact.iframeMap}}"></div>
    
            {% elseif (param_contact.typeMap == 2) %}
    
                <section id="map" style="width: 100%; height: 400px;"></section>
                <script src="{{asset('templates/front/theme1/assets/js/jquery-3.6.0.min.js')}}" ></script>
                <script type="text/javascript">
                $(function(){
                    var map = L.map('map',{scrollWheelZoom:false}).setView([{{param_contact.latitude}}, {{param_contact.longitude}}], {{param_contact.zoomMap}});
                    L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}).addTo(map);
                                                
                    {% if contacts %}
                        {% for contact in contacts %}
                            var MarkerAdresse = L.marker([{{contact.latitude}}, {{contact.longitude}}], {draggable:false}).addTo(map).bindPopup("<b>{{contact.nomcontact}}</b><br />{{contact.adresse}} <br /> {{contact.codepostal}} {{contact.ville}} {{contact.pays}}").openPopup();
                        {% endfor %}
                    {% endif %}        
    
                });
            
                </script>
    
                <Link rel="stylesheet" type="text/css" href="{{asset('templates/front/theme1/assets/plugins/leaflet/leaflet.css')}}" />
                <script src="{{asset('templates/front/theme1/assets/plugins/leaflet/leaflet.js')}}"></script>
    
            {% elseif (param_contact.typeMap == 3 and param_contact.imageMap != "") %}
                <img class="image-map-contact lazyload" data-srcset="{{asset(param_contact.imageMap)}}" src="{{asset(param_contact.imageMap)}}" alt="Map" />
    
            {% elseif (param_contact.typeMap == 4) %}    
                <section id="map" style="width: 100%; height: 400px;"></section>
                <script src="https://maps.googleapis.com/maps/api/js?key={{parametre.clemap}}"></script>
                
                <script>
                    
                    var map = new google.maps.Map(document.getElementById('map'), {
                    zoom: {{param_contact.zoomMap}},
                    center: new google.maps.LatLng({{param_contact.latitude}}, {{param_contact.longitude}}),
                    mapTypeId: google.maps.MapTypeId.ROADMAP
                    });
    
                    var infowindow = new google.maps.InfoWindow();
                    var marker, i;
    
                    {% for contact in contacts %}
                    marker = new google.maps.Marker({
                        position: new google.maps.LatLng({{contact.latitude}}, {{contact.longitude}}),
                        map: map
                    });
    
                    google.maps.event.addListener(marker, 'click', (function(marker, i) {
                        return function() {
                        infowindow.setContent("<b>{{contact.nomcontact}}</b><br />{{contact.adresse}} <br /> {{contact.codepostal}} {{contact.ville}} {{contact.pays}}");
                        infowindow.open(map, marker);
                        }
                    })(marker, i));
                    
                    {% endfor %}
                    
                    </script>
    
                {# <script type="text/javascript">
                        
                        tarteaucitron.services.googlemapsA = {
                        "key": "googlemapsA",
                        "type": "api",
                        "name": "Google Maps",
                        "uri": "http://www.google.com/ads/preferences/",
                        "needConsent": true,
                        "cookies": [],
                        "js": function () {
                            "use strict";
                            var mapOptions,
                                map,
                                uniqIds = [],
                                i;
                        tarteaucitron.addScript('//maps.googleapis.com/maps/api/js?key=&callback=startthis');
                        window.startthis = function () {
                            var locations = [
                            {% for contact in contacts %}
                                ['<b>{{contact.nomcontact}}</b><br />{{contact.adresse}} <br /> {{contact.codepostal}} {{contact.ville}} {{contact.pays}}', {{contact.latitude}},  {{contact.longitude}}],  
                            {% endfor %}
                            ];
                                        
                            var map = new google.maps.Map(document.getElementById('map'), {
                                zoom: <?php echo $zoom_map;?>,
                                center: new google.maps.LatLng({{param_contact.latitude}}, {{param_contact.longitude}}),
                                mapTypeId: google.maps.MapTypeId.ROADMAP
                            });
                        
                            var infowindow = new google.maps.InfoWindow();
                        
                            var marker, i;
                        
                            for (i = 0; i < locations.length; i++) {  
                                marker = new google.maps.Marker({
                                position: new google.maps.LatLng(locations[i][1], locations[i][2]),
                                map: map
                                });
                        
                                google.maps.event.addListener(marker, 'click', (function(marker, i) {
                                return function() {
                                    infowindow.setContent(locations[i][0]);
                                    infowindow.open(map, marker);
                                }
                                })(marker, i));
                            }
                                                    
                        };
                },
                    "fallback": function () {
                        "use strict";
                        var id = 'googlemapsA';
                        tarteaucitron.fallback(['googlemaps-canvasA'], tarteaucitron.engage(id));
                    } 
                    
                };
                </script>  #}
    
                {# <script>tarteaucitron.user.mapscallback =  "startthis" ;tarteaucitron.user.googlemapsLibraries = "LIBRARIES";</script> #}
            {% endif %}
    
        {% endif %}
    {% endif %}