Array dpm vistas Google mapas V3
Vista en tpl Ejemplo Google maps v3
<?php
/**
* @file
* Default simple view template to display a list of rows.
*
* - $title : The title of this group of rows. May be empty.
* - $options['type'] will either be ul or ol.
* @ingroup views_templates
*/
dpm($view, 'view');
?>
<?php print $wrapper_prefix; ?>
<?php if (!empty($title)) : ?>
<h3><?php print $title; ?></h3>
<?php endif; ?>
<?php print $list_type_prefix; ?>
<?php foreach ($rows as $id => $row): ?>
<li class="<?php print $classes_array[$id]; ?>">
<?php print $row; ?>
<?php
$nid = $view->result[$id]->nid;
$province_name = ''; $name = ''; $direccion = '';
if (isset($view->result[$id]->_field_data['nid']['entity']->field_adres['und'])) {
$province_name = $view->result[$id]->_field_data['nid']['entity']->field_adres['und'][0]['province_name'];
$name = $view->result[$id]->_field_data['nid']['entity']->field_adres['und'][0]['name'];
}
?>
<?php
$doc=new DOMDocument();
$ciudad = '';
$full_direccion = "$direccion, $name, $province_name, Peru";
$xml="http://maps.googleapis.com/maps/api/geocode/xml?address=".$full_direccion."&sensor=true";
//echo $xml;
$doc->load($xml);
$persona=$doc->getElementsByTagName("result");
foreach ($persona as $p)
{
$latitud=$p->getElementsByTagName("lat");
$latitud=$latitud->item(0)->nodeValue;
$longitud=$p->getElementsByTagName("lng");
$longitud=$longitud->item(0)->nodeValue;
//echo "latitud=".$latitud." - longitud=".$longitud."<br>";
}
?>
<script type="text/javascript">
function initialize() {
var myLatlng = new google.maps.LatLng(<?php echo $latitud;?>, <?php echo $longitud;?>);
var mapOptions = {
zoom: 15,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById('<?php print "map_".$nid; ?>'), mapOptions);
var contentString = '<div id="content">'+
'<div id="siteNotice">'+
'</div>'+
'<h3 id="firstHeading" class="firstHeading">titulo</h3>'+
'<div id="bodyContent">'+
'<p>Hola Soy JC y tu quien sos?</p>'+
'</div>'+
'</div>';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Uluru (Ayers Rock)'
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<div class="map" id='<?php print "map_".$nid; ?>'></div>
</li>
<?php endforeach; ?>
<?php print $list_type_suffix; ?>
<?php print $wrapper_suffix; ?>
------------------..............------------------
