You are here

function gmap_location_update_5080 in GMap Module 6.2

Same name and namespace in other branches
  1. 5 gmap_location.install \gmap_location_update_5080()
  2. 6 gmap_location.install \gmap_location_update_5080()
  3. 7.2 gmap_location.install \gmap_location_update_5080()
  4. 7 gmap_location.install \gmap_location_update_5080()

File

./gmap_location.install, line 42
gmap_location install routines.

Code

function gmap_location_update_5080() {

  // Convert role markers to single variable.
  $result = db_query("SELECT name FROM {variable} WHERE name LIKE 'gmap_role_map_marker_%%'");
  $markers = array();
  while ($row = db_fetch_object($result)) {
    $num = (int) substr($row->name, 21);
    $markers[$num] = variable_get($row->name, 'drupal');
    variable_del($row->name);
  }
  variable_set('gmap_role_markers', $markers);

  // It's pointless to have a default when the roles will take effect in all cases.
  variable_del('gmap_user_map_marker');

  // Convert node type markers to single variable.
  $result = db_query("SELECT name FROM {variable} WHERE name LIKE 'gmap_node_marker_%%'");
  $markers = array();
  while ($row = db_fetch_object($result)) {
    $type = substr($row->name, 17);
    $markers[$type] = variable_get($row->name, 'drupal');
    variable_del($row->name);
  }
  variable_set('gmap_node_markers', $markers);

  // User location setting functionality is moving to location.module.

  //variable_del('gmap_user');

  //variable_del('gmap_user_profile_category');

  // gmap_user_map is a single variable now.
  $temp = array(
    'macro' => variable_get('gmap_user_map', '[gmap |id=usermap|center=40,0|zoom=3|width=100%|height=400px]'),
    'header' => variable_get('gmap_user_map_header', 'This map illustrates the extent of users of this website. Each marker indicates a user that has entered their locations.'),
    'footer' => '',
  );
  variable_set('gmap_user_map', $temp);
  variable_del('gmap_user_map_header');

  // gmap_node_map is a single variable now.
  $temp = array(
    'macro' => variable_get('gmap_node_map', '[gmap |id=nodemap|center=40,0|zoom=3|width=100%|height=400px]'),
    'header' => variable_get('gmap_node_map_header', 'This map illustrates the locations of the nodes on this website. Each marker indicates a node associated with a specific location.'),
    'footer' => '',
  );
  variable_set('gmap_node_map', $temp);
  variable_del('gmap_node_map_header');
  return array();
}