You are here

function getlocations_markerinfo in Get Locations 7

Same name and namespace in other branches
  1. 7.2 getlocations.module \getlocations_markerinfo()

Ajax callback provides data for marker colorbox

See also

template_preprocess_getlocations_marker_box()

getlocations_marker_box.tpl.php

1 string reference to 'getlocations_markerinfo'
getlocations_menu in ./getlocations.module
Implements hook_menu().

File

./getlocations.module, line 2055
getlocations.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function getlocations_markerinfo() {
  $linktype = $_GET['lt'];
  $cat = $_GET['cat'];
  $content = "";
  $icons = getlocations_get_icondata();
  $data = array();
  $files = array();
  $machine_names = array();
  $display_names = array();
  $positions = array();
  $iconct = 0;
  foreach (array_keys($icons) as $path) {
    if (preg_match("~^/.*/\$~", $path)) {
      continue;
    }
    $files = $icons[$path]['f'];
    $machine_names = $icons[$path]['i'][0][0][0];
    $display_names = $icons[$path]['i'][0][0][1];
    $positions = $icons[$path]['i'][0][0][2];
    $newpositions = array();
    foreach ($positions as $pos) {
      if (isset($pos[0])) {
        $newpositions[] = $pos[0];
      }
    }
    $adj = 0;
    foreach ($newpositions as $pos) {

      // no shadow
      if ($pos < 1) {
        $adj = 1;
      }

      // skip this
      if ($files[$pos] == 'shadow.png') {
        continue;
      }
      $data[$iconct]['path'] = $path . $files[$pos];
      $data[$iconct]['machine_name'] = $machine_names[$pos + $adj];
      $data[$iconct]['display_name'] = $display_names[$pos + $adj];
      $iconct++;
    }
  }
  $content['data'] = $data;
  $content['linktype'] = $linktype;
  $content['cat'] = $cat;
  $output = theme('getlocations_marker_box', array(
    'content' => $content,
  ));
  print $output;
  exit;
}