| 1 |
<?php |
<?php |
| 2 |
// $Id: gmap_plugin_style_gmap.inc,v 1.8 2009/03/11 17:39:20 bdragon Exp $ |
// $Id: gmap_plugin_style_gmap.inc,v 1.9 2009/04/03 15:34:50 bdragon Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 37 |
} |
} |
| 38 |
|
|
| 39 |
function query() { |
function query() { |
| 40 |
|
parent::query(); |
| 41 |
|
|
| 42 |
if ($this->options['datasource'] == 'location') { |
if ($this->options['datasource'] == 'location') { |
| 43 |
$table = $this->view->query->ensure_table('location'); |
$table = $this->view->query->ensure_table('location'); |
| 44 |
$this->view->query->add_field($table, 'latitude', 'gmap_lat'); |
$this->view->query->add_field($table, 'latitude', 'gmap_lat'); |
| 54 |
else if ($this->options['markers'] == 'userrole') { |
else if ($this->options['markers'] == 'userrole') { |
| 55 |
$this->view->query->add_field('users_roles', 'rid', 'gmap_role_marker'); |
$this->view->query->add_field('users_roles', 'rid', 'gmap_role_marker'); |
| 56 |
} |
} |
| 57 |
|
|
| 58 |
|
if (isset($this->row_plugin)) { |
| 59 |
|
$this->row_plugin->query(); |
| 60 |
|
} |
| 61 |
} |
} |
| 62 |
|
|
| 63 |
|
/** |
| 64 |
|
* Render the display in this style. |
| 65 |
|
*/ |
| 66 |
function render() { |
function render() { |
| 67 |
|
|
| 68 |
if (isset($this->view->live_preview) && $this->view->live_preview) { |
if (isset($this->view->live_preview) && $this->view->live_preview) { |
| 69 |
return t('GMap views are not compatible with live preview.'); |
return t('GMap views are not compatible with live preview.'); |
| 70 |
} |
} |
| 107 |
foreach ($sets as $title => $records) { |
foreach ($sets as $title => $records) { |
| 108 |
$markers = array(); |
$markers = array(); |
| 109 |
$offsets = array(); |
$offsets = array(); |
| 110 |
foreach ($records as $label => $row) { |
foreach ($records as $row_index => $row) { |
| 111 |
|
$this->view->row_index = $row_index; |
| 112 |
$lat = (float)$row->{$lat_field}; |
$lat = (float)$row->{$lat_field}; |
| 113 |
$lon = (float)$row->{$lon_field}; |
$lon = (float)$row->{$lon_field}; |
| 114 |
if (!empty($lat) && !empty($lon)) { |
if (!empty($lat) && !empty($lon)) { |
| 154 |
$output .= theme($this->theme_functions(), $this->view, $this->options, $map, $title); |
$output .= theme($this->theme_functions(), $this->view, $this->options, $map, $title); |
| 155 |
} |
} |
| 156 |
} |
} |
| 157 |
|
unset($this->view->row_index); |
| 158 |
return $output; |
return $output; |
| 159 |
} |
} |
| 160 |
|
|