You are here

function getdirections_direction_box in Get Directions 6.2

Same name and namespace in other branches
  1. 7.3 getdirections.module \getdirections_direction_box()
  2. 7.2 getdirections.module \getdirections_direction_box()
1 string reference to 'getdirections_direction_box'
getdirections_menu in ./getdirections.module
Implementation of hook_menu().

File

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

Code

function getdirections_direction_box() {
  $a1 = FALSE;
  $a2 = FALSE;
  $a3 = FALSE;
  $a4 = FALSE;
  if (arg(1)) {
    $a1 = arg(1);
  }
  if (arg(2)) {
    $a2 = arg(2);
  }
  if (arg(3)) {
    $a3 = arg(3);
  }
  if (arg(4)) {
    $a4 = arg(4);
  }
  if ($a1 == 'location' && ($a2 == 'from' || $a2 == 'to') && is_numeric($a3)) {
    $content = getdirections_setlocation($a2, $a3);
  }
  elseif ($a1 == 'locations' && is_numeric($a2) && is_numeric($a3)) {
    $content = getdirections_setlocations($a2, $a3);
  }
  elseif ($a1 == 'locations_via' && $a2) {
    $content = getdirections_setlocations_via($a2);
  }
  elseif ($a1 == 'locations_user_via' && $a2) {
    $content = getdirections_user_setlocations_via($a2);
  }
  elseif ($a1 == 'location_user' && ($a2 == 'from' || $a2 == 'to') && is_numeric($a3)) {
    $content = getdirections_user_setlocation($a2, $a3);
  }
  elseif ($a1 == 'locations_users' && is_numeric($a2) && is_numeric($a3)) {
    $content = getdirections_user_setlocations($a2, $a3);
  }
  elseif ($a1 == 'location_n2u' && is_numeric($a2) && is_numeric($a3)) {
    $content = getdirections_n2u_setlocation($a2, $a3);
  }
  elseif ($a1 == 'location_u2n' && is_numeric($a2) && is_numeric($a3)) {
    $content = getdirections_u2n_setlocation($a2, $a3);
  }
  elseif ($a1 == 'latlon' && ($a2 == 'from' || $a2 == 'to')) {
    $content = getdirections_latlon($a2, $a3, $a4);
  }
  elseif ($a1 == 'location_id' && ($a2 == 'from' || $a2 == 'to')) {
    $content = getdirections_setlocation_id($a2, $a3);
  }
  else {
    $content = getdirections_direction();
  }
  $output = theme('getdirections_box', $content);
  print $output;
  exit;
}