You are here

function route_planner_map_display in Route Planner 6

Same name and namespace in other branches
  1. 7 route_planner.module \route_planner_map_display()

Show a Google Map with a POI or a route.

Return value

HTML output for the map.

1 call to route_planner_map_display()
route_planner_block in ./route_planner.module
Implementation of hook_block().

File

./route_planner.module, line 131
The Route Planner module create blocks to show a route from any address to a fixed point.

Code

function route_planner_map_display() {

  // Add google maps api.
  drupal_set_html_head('<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>');

  // Add some custom javascript to display the map.
  drupal_add_js(drupal_get_path('module', 'route_planner') . '/route_planner.js');
  $address = variable_get('route_planner_address', 'Hamburg, Germany');

  // Set variables from Route Planner settings page.
  drupal_add_js(array(
    'routePlanner' => array(
      'zoomlevel' => intval(variable_get('route_planner_map_zoom', 10)),
      'end' => $address,
    ),
  ), 'setting');

  // Output the map.
  $output = '<div id="map_canvas" style="height:' . check_plain(variable_get('route_planner_map_height', '300px')) . '; width:' . check_plain(variable_get('route_planner_map_width', '100%')) . ';"></div>';
  return $output;
}