You are here

function theme_getdirections_show_locations_via in Get Directions 7.3

Same name and namespace in other branches
  1. 6.2 getdirections.theme.inc \theme_getdirections_show_locations_via()
  2. 6 getdirections.theme.inc \theme_getdirections_show_locations_via()
  3. 7.2 getdirections.module \theme_getdirections_show_locations_via()

Theme to use for when both locations are supplied with waypoints.

1 theme call to theme_getdirections_show_locations_via()
getdirections_locations_via in ./getdirections.module
Function to setup the map

File

./getdirections.module, line 3258
Fetches google map directions.

Code

function theme_getdirections_show_locations_via($variables) {
  $width = $variables['width'];
  $height = $variables['height'];
  $locs = $variables['locs'];
  $mapid = $variables['mapid'];
  $output = "";
  foreach ($locs as $key => $loc) {
    if ($key == 0) {
      $label = t('From');
    }
    elseif ($key == count($locs) - 1) {
      $label = t('To');
    }
    else {
      $label = t('Via');
    }
    $output .= "<div class='getdirections_display'><label>" . $label . ":</label> " . $loc . "</div>";
  }
  $getdirections_misc = getdirections_misc_defaults();
  if ($getdirections_misc['show_distance']) {
    $output .= '<div id="getdirections_show_distance_' . $mapid . '"></div>';
  }
  if ($getdirections_misc['show_duration']) {
    $output .= '<div id="getdirections_show_duration_' . $mapid . '"></div>';
  }
  $header = array();
  $rows[] = array(
    array(
      'data' => '<div id="getdirections_map_canvas_' . $mapid . '" style="width: ' . $width . '; height: ' . $height . '" ></div>',
      'valign' => 'top',
      'align' => 'center',
      'class' => array(
        'getdirections-map',
      ),
    ),
    array(
      'data' => '<div id="getdirections_directions_' . $mapid . '"></div>',
      'valign' => 'top',
      'align' => 'left',
      'class' => array(
        'getdirections-list',
      ),
    ),
  );
  $output .= '<div class="getdirections">' . theme('table', array(
    'header' => $header,
    'rows' => $rows,
  )) . '</div>';
  return $output;
}