You are here

function getlocations_lids in Get Locations 6

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

Menu callback

Parameters

string $lidlist: A comma-delimited list of location ids

Return value

Returns a map of locations.

1 call to getlocations_lids()
getlocations_box in ./getlocations.module
1 string reference to 'getlocations_lids'
getlocations_menu in ./getlocations.module
Implementation of hook_menu().

File

./getlocations.module, line 441
Displays locations on a map. for Drupal 6 using version 3 googlemaps API

Code

function getlocations_lids($lidlist) {
  $lidarr = explode(',', $lidlist);
  $locations = array();
  $latlons = array();
  $minmaxes = array(
    'minlat' => 0,
    'minlon' => 0,
    'maxlat' => 0,
    'maxlon' => 0,
  );
  $marker = '';
  $ct = 0;
  foreach ($lidarr as $lid) {
    $locations[] = getlocations_load_location($lid);
  }
  if (count($locations)) {

    // we should loop over them and dump bummers with no lat/lon
    foreach ($locations as $key => $location) {
      if (getlocations_latlon_check($location['latitude'] . ',' . $location['longitude'])) {
        $minmaxes = getlocations_do_minmaxes($ct, $location, $minmaxes);
        $location['key'] = '';
        $ct++;
        $name = htmlspecialchars_decode(strip_tags($location['name']), ENT_QUOTES);
        $latlons[] = array(
          $location['latitude'],
          $location['longitude'],
          $location['lid'],
          $name,
          $location['marker'],
          $location['key'],
        );
      }
    }
  }
  if ($ct < 2) {
    unset($minmaxes);
    $minmaxes = '';
  }
  return getlocations_setlocations($latlons, $minmaxes, 'lids');
}