You are here

function getlocations_fields_getmap in Get Locations 7

Same name and namespace in other branches
  1. 7.2 modules/getlocations_fields/getlocations_fields.module \getlocations_fields_getmap()

input map

Parameters

$settings: The map settings

$active: Determine wether this is from the edit form or just a demo on the settings

1 call to getlocations_fields_getmap()
theme_getlocations_fields_field_widget_form in modules/getlocations_fields/getlocations_fields.module
The input form

File

modules/getlocations_fields/getlocations_fields.module, line 1712
getlocations_fields.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function getlocations_fields_getmap($settings, $active) {
  $getlocations_defaults = getlocations_defaults();

  // we do not want these on an input map
  $getlocations_defaults['trafficinfo'] = 0;
  $getlocations_defaults['bicycleinfo'] = 0;
  $getlocations_defaults['transitinfo'] = 0;
  $getlocations_defaults['markeraction'] = 0;
  $getlocations_defaults['markeraction_click_zoom'] = -1;
  $getlocations_defaults['markeraction_click_center'] = 0;
  $getlocations_defaults['sv_show'] = 0;
  $getlocations_defaults['show_maplinks'] = 0;
  $getlocations_defaults['minzoom_map'] = -1;
  $getlocations_defaults['maxzoom_map'] = -1;
  $getlocations_defaults['fullscreen'] = 0;
  $getlocations_defaults['polygons_enable'] = 0;
  $getlocations_defaults['rectangles_enable'] = 0;
  $getlocations_defaults['circles_enable'] = 0;
  $getlocations_defaults['polylines_enable'] = 0;
  $getlocations_defaults['show_bubble_on_one_marker'] = 0;
  $getlocations_defaults['search_places'] = 0;
  if ($active) {
    $getlocations_defaults['places'] = 1;
  }
  $getlocations_defaults['latlong'] = $settings['latlong'];
  if (module_exists('smart_ip') && $settings['use_smart_ip_latlon']) {
    $lla = getlocations_fields_smart_ip_get();
    if ($lla && is_array($lla)) {
      if ($latlon = getlocations_latlon_check($lla['latitude'] . ',' . $lla['longitude'])) {
        $getlocations_defaults['latlong'] = $latlon;
      }
    }
  }
  $getlocations_defaults['zoom'] = $settings['zoom'];
  $getlocations_defaults['controltype'] = $settings['controltype'];
  $getlocations_defaults['zoomcontrolposition'] = $settings['zoomcontrolposition'];
  $getlocations_defaults['pancontrol'] = $settings['pancontrol'];
  $getlocations_defaults['pancontrolposition'] = $settings['pancontrolposition'];
  $getlocations_defaults['mtc'] = $settings['mtc'];
  $getlocations_defaults['maptype'] = $settings['maptype'];
  $getlocations_defaults['mapcontrolposition'] = $settings['mapcontrolposition'];
  $getlocations_defaults['baselayers'] = $settings['baselayers'];
  $getlocations_defaults['scale'] = $settings['scale'];
  $getlocations_defaults['scalecontrolposition'] = $settings['scalecontrolposition'];
  $getlocations_defaults['overview'] = $settings['overview'];
  $getlocations_defaults['overview_opened'] = $settings['overview_opened'];
  $getlocations_defaults['scrollwheel'] = $settings['scrollwheel'];
  $getlocations_defaults['draggable'] = $settings['draggable'];
  $getlocations_defaults['input_map_marker'] = $settings['input_map_marker'];
  $getlocations_defaults['use_address'] = $settings['use_address'];
  $getlocations_defaults['map_backgroundcolor'] = $settings['map_backgroundcolor'];
  $getlocations_defaults['input_map_show'] = $settings['input_map_show'];

  #$getlocations_defaults['use_jsapi']       = $settings['use_geolocation_button'];
  $getlocations_defaults['geocoder_enable'] = $settings['geocoder_enable'];
  $mapid = getlocations_setup_map($getlocations_defaults);
  drupal_add_css(GETLOCATIONS_FIELDS_PATH . '/getlocations_fields.css');
  $aggr = getlocations_aggr_get() ? TRUE : FALSE;
  $getlocations_fields_paths = getlocations_fields_paths_get();
  $js_opts = array();
  $js_opts['weight'] = $getlocations_defaults['getlocations_js_weight'] + 30;
  $js_opts['type'] = 'file';
  $js_opts['preprocess'] = $aggr;
  $latlons = array();
  if ($active) {
    drupal_add_js($getlocations_fields_paths['getlocations_fields_path'], $js_opts);
    $settings['nodezoom'] = $getlocations_defaults['nodezoom'];
    getlocations_fields_js_settings_do($settings, $mapid);
  }
  else {

    // demo mode
    drupal_add_js($getlocations_fields_paths['getlocations_fields_preview_path'], $js_opts);
    $getlocations_defaults['nodezoom'] = $getlocations_defaults['zoom'];
  }
  $minmaxes = '';
  getlocations_js_settings_do($getlocations_defaults, $latlons, $minmaxes, $mapid, $active);
  $map = theme('getlocations_show', array(
    'width' => $settings['mapwidth'],
    'height' => $settings['mapheight'],
    'defaults' => $getlocations_defaults,
    'mapid' => $mapid,
    'latlons' => $latlons,
    'minmaxes' => $minmaxes,
    'type' => '',
    'node' => '',
  ));
  return array(
    $map,
    $mapid,
  );
}