You are here

function getlocations_js_settings_do in Get Locations 6

Same name and namespace in other branches
  1. 6.2 getlocations.module \getlocations_js_settings_do()
  2. 7.2 getlocations.module \getlocations_js_settings_do()
  3. 7 getlocations.module \getlocations_js_settings_do()
2 calls to getlocations_js_settings_do()
getlocations_setlocations in ./getlocations.module
Set up javascript settings and map
template_preprocess_getlocations_view_map in ./getlocations.views.inc
Preprocess function for theme_getlocations_view_map().

File

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

Code

function getlocations_js_settings_do($defaults, $latlons, $minmaxes, $mapid) {
  global $language;
  $lla = explode(',', $defaults['latlong']);
  $settings = array(
    $mapid => array(
      'lat' => $lla[0],
      'lng' => $lla[1],
      'mylocale' => $language->language,
      'zoom' => $defaults['zoom'],
      'maptype' => $defaults['maptype'],
      'controltype' => $defaults['controltype'],
      'mtc' => $defaults['mtc'],
      'baselayers' => $defaults['baselayers'],
      'scale' => $defaults['behavior']['scale'],
      'overview' => $defaults['behavior']['overview'],
      'overview_opened' => $defaults['behavior']['overview_opened'],
      'scrollwheel' => $defaults['behavior']['scrollwheel'],
      'trafficinfo' => $defaults['trafficinfo'],
      'trafficinfo_state' => $defaults['trafficinfo_state'],
      'bicycleinfo' => $defaults['bicycleinfo'],
      'bicycleinfo_state' => $defaults['bicycleinfo_state'],
      'transitinfo' => $defaults['transitinfo'],
      'transitinfo_state' => $defaults['transitinfo_state'],
      'streetview_show' => $defaults['streetview_show'],
      'pancontrol' => $defaults['pancontrol'],
      'panoramio_use' => $defaults['panoramio_use'],
      'panoramio_show' => $defaults['panoramio_show'],
      'panoramio_state' => $defaults['panoramio_state'],
      'poi_show' => $defaults['poi_show'],
      'transit_show' => $defaults['transit_show'],
      'map_marker' => $defaults['node_map_marker'],
      'markeraction' => $defaults['markeraction'],
      'markeractiontype' => $defaults['markeractiontype'],
      'minzoom' => $defaults['minzoom'],
      'maxzoom' => $defaults['maxzoom'],
      'nodezoom' => $defaults['nodezoom'],
      'markermanagertype' => $defaults['markermanagertype'],
      'usemarkermanager' => $defaults['usemarkermanager'],
      'useclustermanager' => $defaults['useclustermanager'],
      'markerclusterer_style' => $defaults['markerclusterer_style'],
      'markerclusterer_zoom' => $defaults['markerclusterer_zoom'],
      'markerclusterer_size' => $defaults['markerclusterer_size'],
      'markerclusterer_minsize' => $defaults['markerclusterer_minsize'],
      'pansetting' => $defaults['pansetting'],
      'draggable' => $defaults['draggable'],
      'styles' => $defaults['styles'],
      'datanum' => count($latlons),
      'latlons' => $latlons,
      'minmaxes' => empty($minmaxes) ? '' : implode(',', $minmaxes),
      'custom_content_enable' => $defaults['custom_content_enable'],
      'weather_use' => $defaults['weather_use'],
      'map_backgroundcolor' => $defaults['map_backgroundcolor'],
    ),
  );
  if ($defaults['weather_use']) {
    $settings[$mapid]['weather_show'] = $defaults['weather_show'];
    $settings[$mapid]['weather_state'] = $defaults['weather_state'];
    $settings[$mapid]['weather_temp'] = $defaults['weather_temp'];
    $settings[$mapid]['weather_speed'] = $defaults['weather_speed'];
    $settings[$mapid]['weather_label'] = $defaults['weather_label'];
    $settings[$mapid]['weather_cloud'] = $defaults['weather_cloud'];
    $settings[$mapid]['weather_cloud_state'] = $defaults['weather_cloud_state'];
    $settings[$mapid]['weather_clickable'] = $defaults['weather_clickable'];
    $settings[$mapid]['weather_info'] = $defaults['weather_info'];
  }
  drupal_add_js(array(
    'getlocations' => $settings,
  ), 'setting');
  if ($defaults['markermanagertype'] == 2) {
    if (file_exists(GETLOCATIONS_PATH . '/getlocations.markercluster_override.inc')) {
      module_load_include('inc', 'getlocations', 'getlocations.markercluster_override');
    }
    else {
      module_load_include('inc', 'getlocations', 'getlocations.markercluster');
    }
    $markerclusterer_styles = getlocations_get_markerclusterer_styles();
    drupal_add_js(array(
      'getlocations_markerclusterer' => $markerclusterer_styles,
    ), 'setting');
  }
}