You are here

function theme_getlocations_show in Get Locations 6

Same name and namespace in other branches
  1. 6.2 getlocations.theme.inc \theme_getlocations_show()
  2. 7.2 getlocations.module \theme_getlocations_show()
  3. 7 getlocations.module \theme_getlocations_show()

All the map displays pass through here.

2 theme calls to theme_getlocations_show()
getlocations_setlocations in ./getlocations.module
Set up javascript settings and map
template_preprocess_getlocations_view_map in ./getlocations.views.inc
Preprocess function for theme_getlocations_view_map().

File

./getlocations.theme.inc, line 44
getlocations module theming functions. using version 3 googlemaps API

Code

function theme_getlocations_show($width, $height, $defaults, $mapid, $type = '', $node = '') {
  $output = '';

  // return link
  if ($type == 'node' && $defaults['returnlink_page_enable']) {
    if (is_object($node)) {
      $linktext = $defaults['returnlink_page_link'];
      if (preg_match("/%t/", $linktext)) {
        $linktext = preg_replace("/%t/", $node->title, $linktext);
      }
      $l = l($linktext, 'node/' . $node->nid);
      $output .= '<div class="getlocations_returnlink">' . $l . '</div>';
    }
  }
  elseif ($type == 'user' && $defaults['returnlink_user_enable']) {
    if (is_object($node)) {
      $linktext = $defaults['returnlink_user_link'];
      if (preg_match("/%n/", $linktext)) {
        $linktext = preg_replace("/%n/", $node->name, $linktext);
      }
      $l = l($linktext, 'user/' . $node->uid);
      $output .= '<div class="getlocations_returnlink">' . $l . '</div>';
    }
  }

  // do map
  $output .= '<div class="getlocations_map_canvas" id="getlocations_map_canvas_' . $mapid . '" style="width: ' . $width . '; height: ' . $height . '" ></div>';

  // buttons
  $buttons = array();
  if ($defaults['trafficinfo']) {
    $buttons[] = '<input type="submit" value="' . t('Toggle traffic info') . '" title="' . t('Limited Availability') . '" id="getlocations_toggleTraffic_' . $mapid . '" class="form-submit" />';
  }
  if ($defaults['bicycleinfo']) {
    $buttons[] = '<input type="submit" value="' . t('Toggle bicycle info') . '" title="' . t('Limited Availability') . '" id="getlocations_toggleBicycle_' . $mapid . '" class="form-submit" />';
  }
  if ($defaults['transitinfo']) {
    $buttons[] = '<input type="submit" value="' . t('Toggle transit info') . '" title="' . t('Limited Availability') . '" id="getlocations_toggleTransit_' . $mapid . '" class="form-submit" />';
  }
  if ($defaults['panoramio_use'] && $defaults['panoramio_show']) {
    $buttons[] = '<input type="submit" value="' . t('Toggle panoramio') . '" id="getlocations_togglePanoramio_' . $mapid . '" class="form-submit" />';
  }
  if ($defaults['weather_use'] && $defaults['weather_show']) {
    $buttons[] = '<input type="submit" value="' . t('Toggle weather') . '" id="getlocations_toggleWeather_' . $mapid . '" class="form-submit" />';
    if ($defaults['weather_cloud']) {
      $buttons[] = '<input type="submit" value="' . t('Toggle clouds') . '" id="getlocations_toggleCloud_' . $mapid . '" class="form-submit" />';
    }
  }
  if (count($buttons)) {
    $output .= '<div class="getlocations_map_buttons" class="container-inline">';
    $output .= implode('&nbsp;', $buttons);
    $output .= '</div>';
  }
  return $output;
}