Newer
Older
'#required' => FALSE,
'#attributes' => array('onchange' => 'set_gmap_alignment(this.value);')
);
$form['macroform']['clicktype'] = array(
'#type' => 'select',
'#id' => 'gmap-clicktype',
'#title' => t('What happens when you click on the map'),
'#options' => drupal_map_assoc(array('Points', 'Line1', 'Line2', 'Line3')),
'#required' => FALSE,
'#default_value' => 'Points',
// '#attributes' => array('onchange' => 'docontrol(this.value);')
);
$form['macroform']['zoom'] = array(
'#type' => 'select',
'#id' => 'gmap-zoom',
'#title' => t('The current magnification of the map'),
'#default_value' => GMAP_ZOOM,
'#options' => drupal_map_assoc(range(0, 17)),
'#attributes' => array('onchange' => 'setgmapZoom(this.value);'),
);
$form['macroform']['textarea'] = array(
'#type' => 'textarea',
'#id' => 'gmap-macrotext',
'#title' => t('Macro text'),
);
return drupal_get_form('macroform', $form);
}
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
/**
* Implementation of hook_views_style_plugins()
*/
function gmap_views_style_plugins() {
return array(
'gmap' => array(
'name' => t('Gmap View'),
'theme' => 'views_view_gmap',
'needs_fields' => true,
'validate' => 'views_ui_plugin_validate_list',
)
);
}
/**
* Display the nodes of a view in a Google Map
*/
function theme_views_view_gmap($view, $nodes) {
$fields = _views_get_fields();
foreach ($nodes as $node) {
$node_data = node_load(array("nid"=>$node->nid));
$location = $node_data->location;
$newmarker['label'] = '';
foreach ($view->field as $field) {
$newmarker['label'] .= "<p>" . views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node) . "</p>";
}
$newmarker['point']= $location['lat'] . ',' . $location['lon'];
$newmarker['markername']='drupal_view';
$thismap['markers'][]= $newmarker;
}
$output .= gmap_draw_map($thismap);
return $output;
}