You are here

function gmap_location_admin_settings in GMap Module 7.2

Same name and namespace in other branches
  1. 5 gmap_location.module \gmap_location_admin_settings()
  2. 6.2 gmap_location.module \gmap_location_admin_settings()
  3. 6 gmap_location.module \gmap_location_admin_settings()
  4. 7 gmap_location.module \gmap_location_admin_settings()

Admin Settings Page.

1 string reference to 'gmap_location_admin_settings'
gmap_location_menu in ./gmap_location.module
Implements hook_menu().

File

./gmap_location.module, line 450
GMap Location module is a module to add some gmap funcationality based on location.modules information.

Code

function gmap_location_admin_settings() {
  $form['user'] = array(
    '#type' => 'fieldset',
    '#title' => t('User settings'),
  );

  // gmap_user_map defaults.
  $temp = variable_get('gmap_user_map', _gmap_location_user_map_defaults());
  $form['user']['gmap_user_map'] = array(
    '#type' => 'fieldset',
    '#title' => t('User Map (<em>map/user</em>)'),
    '#tree' => TRUE,
  );
  $form['user']['gmap_user_map']['macro'] = array(
    '#type' => 'textfield',
    '#title' => t('Macro'),
    '#default_value' => $temp['macro'],
    '#size' => 50,
    '#maxlength' => 500,
    '#description' => t('The GMap macro used when the user information is displayed. See the !macros_link.', array(
      '!macros_link' => l('documentation on GMap macros', 'http://drupal.org/documentation/modules/gmap/macros', array(
        'attributes' => array(
          'target' => '_blank',
        ),
      )),
    )),
  );
  $form['user']['gmap_user_map']['header'] = array(
    '#type' => 'textarea',
    '#title' => t('Page header'),
    '#description' => t('Text at the top of the user map.', array(
      '@url' => url('map/user'),
    )),
    '#default_value' => $temp['header'],
    '#cols' => 50,
    '#rows' => 6,
  );
  $form['user']['gmap_user_map']['footer'] = array(
    '#type' => 'textarea',
    '#title' => t('Page footer'),
    '#description' => t('Text at the bottom of the user map.'),
    '#default_value' => $temp['footer'],
    '#cols' => 50,
    '#rows' => 6,
  );
  $form['user']['gmap_user_map']['markermode'] = array(
    '#type' => 'radios',
    '#title' => t('Marker action'),
    '#description' => t('Perform this action when a marker is clicked.'),
    '#options' => array(
      t('Do nothing'),
      t('Open info window'),
      t('Open link'),
    ),
    '#default_value' => $temp['markermode'],
  );

  // Option to use a different marker for each role.
  $form['user']['gmap_role_markers'] = array(
    '#type' => 'fieldset',
    '#title' => t('Markers per role'),
    '#description' => t('Choose a marker to represent each user role on the user map. If a user belongs to multiple roles, the marker for the highest Role ID will be used.'),
    '#tree' => TRUE,
  );

  // Retrieve and sort list of roles, sans anonymous user.
  $roles = user_roles(TRUE);

  // asort($roles);
  $defaults = variable_get('gmap_role_markers', array());

  // Create a selection box per role.
  foreach ($roles as $rid => $role) {
    $form['user']['gmap_role_markers'][$rid] = array(
      '#type' => 'gmap_markerchooser',
      '#title' => t('%role (Role ID: %rid)', array(
        '%role' => $role,
        '%rid' => $rid,
      )),
      '#default_value' => isset($defaults[$rid]) ? $defaults[$rid] : 'drupal',
    );
  }
  $form['node'] = array(
    '#type' => 'fieldset',
    '#title' => t('Node settings'),
  );

  // gmap_node_map defaults.
  $temp = variable_get('gmap_node_map', _gmap_location_node_map_defaults());
  $form['node']['gmap_node_map'] = array(
    '#type' => 'fieldset',
    '#title' => t('Node Map (<em>map/node</em>)'),
    '#tree' => TRUE,
  );
  $form['node']['gmap_node_map']['macro'] = array(
    '#type' => 'textfield',
    '#title' => t('Macro'),
    '#default_value' => $temp['macro'],
    '#size' => 50,
    '#maxlength' => 500,
    '#description' => t('The GMap macro used when the node information is displayed. See the !macros_link.', array(
      '!macros_link' => l('documentation on GMap macros', 'http://drupal.org/documentation/modules/gmap/macros', array(
        'attributes' => array(
          'target' => '_blank',
        ),
      )),
    )),
  );
  $form['node']['gmap_node_map']['header'] = array(
    '#type' => 'textarea',
    '#title' => t('Page header'),
    '#description' => t('Text at the top of the node map.'),
    '#default_value' => $temp['header'],
    '#cols' => 50,
    '#rows' => 6,
  );
  $form['node']['gmap_node_map']['footer'] = array(
    '#type' => 'textarea',
    '#title' => t('Page footer'),
    '#description' => t('Text at the bottom of the node map.'),
    '#default_value' => $temp['footer'],
    '#cols' => 50,
    '#rows' => 6,
  );
  $form['node']['gmap_node_map']['markermode'] = array(
    '#type' => 'radios',
    '#title' => t('Marker action'),
    '#description' => t('Perform this action when a marker is clicked.'),
    '#options' => array(
      t('Do nothing'),
      t('Open info window'),
      t('Open link'),
    ),
    '#default_value' => $temp['markermode'],
  );

  // Option to use a different marker for each content type.
  $form['node']['gmap_node_markers'] = array(
    '#type' => 'fieldset',
    '#title' => t('Markers per content type'),
    '#description' => t('Choose a marker to represent each type of content on the node map.'),
    '#tree' => TRUE,
  );
  $ntypes = node_type_get_types();
  $defaults = variable_get('gmap_node_markers', array());
  foreach ($ntypes as $key => $value) {
    $form['node']['gmap_node_markers'][$key] = array(
      '#type' => 'gmap_markerchooser',
      '#title' => t('Marker for %type', array(
        '%type' => gmap_location_t("nodetype:type:{$key}:name", $value->name),
      )),
      '#default_value' => isset($defaults[$key]) ? $defaults[$key] : 'drupal',
    );
    $settings = variable_get("location_settings_node_{$key}", FALSE);
    if (!(isset($settings['multiple']['max']) && $settings['multiple']['max'] || variable_get("location_maxnum_{$key}", 0))) {
      $form['node']['gmap_node_markers'][$key]['#description'] = t('This content type is not currently Location enabled.');
    }
  }
  return system_settings_form($form);
}