You are here

function getdirections_get_lid_title in Get Directions 7.3

Same name and namespace in other branches
  1. 6.2 getdirections.module \getdirections_get_lid_title()
  2. 7.2 getdirections.module \getdirections_get_lid_title()

Function to get the location name if available

Parameters

int $lid:

Return value

Returns name.

1 call to getdirections_get_lid_title()
getdirections_direction_other in ./getdirections.module
Function to setup the map and form

File

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

Code

function getdirections_get_lid_title($lid) {
  if ($lid) {
    $query = FALSE;
    if (module_exists('getlocations_fields')) {
      $query = db_select('getlocations_fields', 'i')
        ->fields('i', array(
        'name',
      ))
        ->condition('i.glid', $lid);
    }
    elseif (module_exists('location')) {
      $query = db_select('location', 'i')
        ->fields('i', array(
        'name',
      ))
        ->condition('i.lid', $lid);
    }
    if ($query) {
      $row = $query
        ->execute()
        ->fetchAssoc();
      return isset($row['name']) && $row['name'] ? $row['name'] : FALSE;
    }
  }
  return FALSE;
}