Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- MAPA -->
- <div id="vmapa" class="row evnts-grid mapa-evnts">
- <div class="large-12 columns mevnts">
- {if $arr_evento.id_evento neq 275}
- <h3 style="margin-top:5px !important;">{"TXT18"|gettext}</h3>
- {/if}
- {if $arr_evento.id_evento eq 85}
- <h4>Fortaleza - Localização Hotel Oficial</h4>
- {elseif $arr_evento.id_evento eq 160}
- <h4 class="gui">Distância dos hotéis parceiros ao centro</h4>
- {else}
- <h4 class="gui">{"TXT19"|gettext}</h4>
- {/if}
- <div id="evnts-mapa" style="margin:0px;margin-bottom:10px !important;padding:0px;width:100%;"></div>
- <iframe id="fr_mapa" style="margin:0px;margin-bottom:10px !important;padding:0px;width:100%; display:none;" height="465" frameborder="0" style="border:0" src="">
- </iframe>
- </div>
- </div>
- <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true&key=AIzaSyDr-E_62Ag83JG8OxMsE0RlC2bjJf3lF2w"></script>
- <script>
- var map;
- var directionsDisplay;
- var directionsService;
- var stepDisplay;
- var markerArray = [];
- // Hoteis
- var hoteis = jQuery.parseJSON('{$hoteis_JSON}');
- // Evento
- var evento = jQuery.parseJSON('{$evento_JSON}');
- {literal}
- function initialize() {
- // Instantiate a directions service.
- directionsService = new google.maps.DirectionsService();
- // Centralizar no evento
- var evento_latLng = new google.maps.LatLng(evento.lat, evento.lng);
- var zoom_mapa = parseInt(evento.zoom);
- var centro = evento_latLng;
- if(evento.id_evento == '51'){
- centro = new google.maps.LatLng(-23.538604, -46.652085);
- }
- // Create a map and center it.
- var mapOptions = {
- draggable: false,
- scrollwheel: false,
- zoom: zoom_mapa,
- center: centro
- }
- map = new google.maps.Map(document.getElementById('evnts-mapa'), mapOptions);
- map.setOptions({draggable: true});
- marker = new google.maps.Marker({
- position: evento_latLng,
- map: map,
- animation: google.maps.Animation.DROP
- });
- /**GUI HERE TO ADD THE MARKERS*/
- {/literal}
- {if $arr_evento.id_evento eq 537}
- {literal}
- var iconBase = 'https://hoteis.evnts.com.br/img/campusMarkers/';
- var icons = [];
- var campus = new google.maps.Marker({
- // position: {lat:-23.5709911 lng: -46.6520746},
- position: new google.maps.LatLng(-23.57110596,-46.64997101),
- map: map,
- title: 'Campus São Paulo',
- icon: {
- url:iconBase+'campus.png',
- scaledSize: new google.maps.Size(22, 26), // scaled size
- origin: new google.maps.Point(0,0), // origin
- anchor: new google.maps.Point(11,13) // anchor
- }
- });
- icons.push(campus);
- var subway = new google.maps.Marker({
- // position: {lat:-23.5684707 lng: -46.6482102},
- position: new google.maps.LatLng(-23.5684707,-46.6482102),
- map: map,
- title: 'Subway',
- icon: {
- url:iconBase+'subway.png',
- scaledSize: new google.maps.Size(22, 26), // scaled size
- origin: new google.maps.Point(0,0), // origin
- anchor: new google.maps.Point(11,13) // anchor
- }
- });
- icons.push(subway);
- var mall = new google.maps.Marker({
- // position: {lat:-23.5635221 lng: -46.6527251},
- position: new google.maps.LatLng(-23.5635221,-46.6527251),
- map: map,
- title: 'Mall Cidade São Paulo',
- icon: {
- url:iconBase+'mall.png',
- scaledSize: new google.maps.Size(22, 26), // scaled size
- origin: new google.maps.Point(0,0), // origin
- anchor: new google.maps.Point(11,13) // anchor
- }
- });
- icons.push(mall);
- var mall2 = new google.maps.Marker({
- // position: {lat:-23.5656667 lng: -46.650694},
- position: new google.maps.LatLng(-23.5656667,-46.650694),
- map: map,
- title: 'Top Center Mall',
- icon: {
- url:iconBase+'mall.png',
- scaledSize: new google.maps.Size(22, 26), // scaled size
- origin: new google.maps.Point(0,0), // origin
- anchor: new google.maps.Point(11,13) // anchor
- }
- });
- icons.push(mall2);
- var drugstore = new google.maps.Marker({
- // position: {lat:-23.5673281 lng: -46.6486361},
- position: new google.maps.LatLng(-23.5673281,-46.6486361),
- map: map,
- title: 'Drugstore',
- icon: {
- url:iconBase+'drugstore.png',
- scaledSize: new google.maps.Size(22, 26), // scaled size
- origin: new google.maps.Point(0,0), // origin
- anchor: new google.maps.Point(11,13) // anchor
- }
- });
- icons.push(drugstore);
- var drugstore2 = new google.maps.Marker({
- // position: {lat:-23.570592 lng: -46.643539},
- position: new google.maps.LatLng(-23.570592,-46.643539),
- map: map,
- title: 'Drugstore',
- icon: {
- url:iconBase+'drugstore.png',
- scaledSize: new google.maps.Size(22, 26), // scaled size
- origin: new google.maps.Point(0,0), // origin
- anchor: new google.maps.Point(11,13) // anchor
- }
- });
- icons.push(drugstore2);
- var hospital = new google.maps.Marker({
- // position: {lat:-23.5697277 lng: -46.6455781},
- position: new google.maps.LatLng(-23.5697277,-46.6455781),
- map: map,
- title: 'Santa Catarina Hospital',
- icon: {
- url:iconBase+'hospital.png',
- scaledSize: new google.maps.Size(22, 26), // scaled size
- origin: new google.maps.Point(0,0), // origin
- anchor: new google.maps.Point(11,13) // anchor
- }
- });
- icons.push(hospital);
- var coffee = new google.maps.Marker({
- // position: {lat:-23.571728 lng: -46.648583},
- position: new google.maps.LatLng(-23.571728,-46.648583),
- map: map,
- title: 'Bakery Gemel',
- icon: {
- url:iconBase+'coffee.png',
- scaledSize: new google.maps.Size(22, 26), // scaled size
- origin: new google.maps.Point(0,0), // origin
- anchor: new google.maps.Point(11,13) // anchor
- }
- });
- icons.push(coffee);
- var mall3 = new google.maps.Marker({
- // position: {lat:-23.5704557 lng: -46.6437266},
- position: new google.maps.LatLng(-23.5704557,-46.6437266),
- map: map,
- title: 'Mall Patio Paulista',
- icon: {
- url:iconBase+'mall.png',
- scaledSize: new google.maps.Size(22, 26), // scaled size
- origin: new google.maps.Point(0,0), // origin
- anchor: new google.maps.Point(11,13) // anchor
- }
- });
- icons.push(mall3);
- var exchance = new google.maps.Marker({
- // position: {lat:-23.5654432 lng: -46.6504513},
- position: new google.maps.LatLng(-23.5654432,-46.6504513),
- map: map,
- title: 'Daycoval Currency Exchange Store',
- icon: {
- url:iconBase+'exchance.png',
- scaledSize: new google.maps.Size(22, 26), // scaled size
- origin: new google.maps.Point(0,0), // origin
- anchor: new google.maps.Point(11,13) // anchor
- }
- });
- icons.push(exchance);
- var market = new google.maps.Marker({
- // position: {lat:-23.5741994 lng: -46.6457188},
- position: new google.maps.LatLng(-23.5741994,-46.6457188),
- map: map,
- title: 'Supermarket Pão de Açucar',
- icon: {
- url:iconBase+'market.png',
- scaledSize: new google.maps.Size(22, 26), // scaled size
- origin: new google.maps.Point(0,0), // origin
- anchor: new google.maps.Point(11,13) // anchor
- }
- });
- icons.push(market);
- var coffee2 = new google.maps.Marker({
- // position: {lat:-23.5683171 lng: -46.6488625},
- position: new google.maps.LatLng(-23.5683171,-46.6488625),
- map: map,
- title: 'Starbucks',
- icon: {
- url:iconBase+'coffee.png',
- scaledSize: new google.maps.Size(22, 26), // scaled size
- origin: new google.maps.Point(0,0), // origin
- anchor: new google.maps.Point(11,13) // anchor
- }
- });
- icons.push(coffee2);
- var nail = new google.maps.Marker({
- // position: {lat:-23.570631 lng: -46.649702},
- // position: new google.maps.LatLng(-23.570631,-46.649702),
- position: new google.maps.LatLng(-23.570688,-46.649961),
- map: map,
- title: 'Nail Polish Patou',
- icon: {
- url:iconBase+'nail.png',
- scaledSize: new google.maps.Size(22, 26), // scaled size
- origin: new google.maps.Point(0,0), // origin
- anchor: new google.maps.Point(11,13) // anchor
- }
- });
- icons.push(nail);
- var hair = new google.maps.Marker({
- // position: {lat:-23.5723189 lng: -46.6477327},
- position: new google.maps.LatLng(-23.5723189,-46.6477327),
- map: map,
- title: 'Matik Hair & Make Up',
- icon: {
- url:iconBase+'hair.png',
- scaledSize: new google.maps.Size(22, 26), // scaled size
- origin: new google.maps.Point(0,0), // origin
- anchor: new google.maps.Point(11,13) // anchor
- }
- });
- icons.push(hair);
- var fruit = new google.maps.Marker({
- // position: {lat:-23.5695983 lng: -46.6494171},
- position: new google.maps.LatLng(-23.5695983,-46.6494171),
- map: map,
- title: 'Grocery Store - Hortifruti',
- icon: {
- url:iconBase+'fruit.png',
- scaledSize: new google.maps.Size(22, 26), // scaled size
- origin: new google.maps.Point(0,0), // origin
- anchor: new google.maps.Point(11,13) // anchor
- }
- });
- icons.push(fruit);
- icons.forEach(function(icon, index){
- console.log(icon.title)
- google.maps.event.addListener(icon , 'click', function(){
- var infowindow = new google.maps.InfoWindow({
- content:icon.title,
- position: icon.position,
- });
- infowindow.open(map);
- });
- });
- {/literal}
- {/if}
- {literal}
- /**GUI LEAVING HE MARKERS*/
- // Cores dos dots
- var cor_dot = 'https://maps.google.com/mapfiles/ms/icons/green-dot.png';
- var infowindow = new google.maps.InfoWindow();
- // Loop through our array of markers & place each one on the map
- for( i = 0; i < hoteis.length; i++ ) {
- var position = new google.maps.LatLng(hoteis[i].lat, hoteis[i].lng);
- // Verificar se é Hostel ou Hotel
- if(hoteis[i].tipo_acomodacao == '2'){
- cor_dot = 'https://maps.google.com/mapfiles/ms/icons/blue-dot.png';
- }
- else
- {
- cor_dot = 'https://maps.google.com/mapfiles/ms/icons/green-dot.png';
- }
- marker = new google.maps.Marker({
- position: position,
- icon: cor_dot,
- map: map
- });
- google.maps.event.addListener(marker, 'click', (function(marker, i) {
- return function() {
- infowindow.setContent(hoteis[i].titulo);
- infowindow.open(map, marker);
- }
- })(marker, i));
- }
- }
- google.maps.event.addDomListener(window, 'load', initialize);
- $(document).ready(function(){
- $( ".evtmapa" ).bind( "click", function() {
- var top = $("#vmapa").offset().top - 120;
- window.scrollTo(0, top);
- var destino = encodeURI(evento.local) + "," + encodeURI(evento.endereco);
- var origem = "";
- //Tratando problemas no maps
- if($(this).data("hotel") == "Pousada e Hostel São Paulo #1" || $(this).data("hotel") == "Acantonamento - Serra Clube Tiradentes" || $(this).data("hotel") == "Transamérica Executive The Advance" || $(this).data("hotel") == "Mercure São Paulo Nações Unidas" || $(this).data("hotel") == "Hotel Presidente" ){
- origem = encodeURI($(this).data("endereco"));
- }
- else
- {
- origem = encodeURI($(this).data("hotel")) + "," + encodeURI($(this).data("endereco"));
- }
- console.log("Destino:" + destino);
- console.log("Origem:" + origem);
- var src = "https://www.google.com/maps/embed/v1/directions?key=AIzaSyC5uCZUP9ZmpSevPak20B3erWUMNFdZt9M";
- {/literal}
- var src = "https://www.google.com/maps/embed/v1/directions?key=AIzaSyC5uCZUP9ZmpSevPak20B3erWUMNFdZt9M";
- src += "&origin=" + origem;
- {if $arr_evento.id_evento eq 111}
- src += "&destination={$arr_evento.lat},{$arr_evento.lng}";
- console.log('aioooooooooo silver');
- {else}
- src += "&destination=" + destino;
- {/if}
- {literal}
- src += "&avoid=tolls|highways";
- console.log("URL Criada:" + src);
- $('#fr_mapa')[0].src = src;
- $("#evnts-mapa")[0].style.display = "none";
- $('#fr_mapa')[0].style.display = "block";
- if (window.top != window.self){
- // Altera o tamanho de acordo com a listagem;
- window.parent.postMessage("mover:300px", "*");
- }
- return false;
- });
- });//ready
- $( "#vmapa" ).mouseleave(function() {
- if($('#fr_mapa').is(':visible')){
- setTimeout(function () {
- $("#evnts-mapa")[0].style.display = "block";
- $('#fr_mapa')[0].style.display = "none";
- }, 1000);
- }
- });
- </script>
- {/literal}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement