You are here

function getlocations_tools_export_form in Get Locations 7

Same name and namespace in other branches
  1. 7.2 modules/getlocations_tools/getlocations_tools.module \getlocations_tools_export_form()
1 string reference to 'getlocations_tools_export_form'
getlocations_tools_menu in modules/getlocations_tools/getlocations_tools.module
Implements hook_menu().

File

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

Code

function getlocations_tools_export_form($form, &$form_state) {
  global $base_url;
  $export_select = variable_get('getlocations_tools_export_select', 0);
  variable_del('getlocations_tools_export_select');
  $form = array();
  $opts = getlocations_tools_get_options();
  if (count($opts) > 1) {
    $form['getlocations_tools_export_select'] = getlocations_element_dd(t('Configuration settings'), $export_select, $opts, t('Which configuration settings to export.'));
    $form['getlocations_tools_export_submit'] = array(
      '#type' => 'submit',
      '#value' => t('Select'),
    );
    $output = FALSE;
    $addon = $base_url . "\n" . '// ' . t('Date') . ': ' . date('Y-m-d H:i:s T') . "\n";
    if ($export_select == 1) {
      $output = '// getlocations.module configuration on ' . $addon;
      $output .= '$getlocations_defaults = ';
      $defaults = getlocations_defaults();
      $output .= var_export($defaults, TRUE) . ';' . "\n";
      $output .= '$getlocations_paths = ';
      $paths = getlocations_paths_get();
      $output .= var_export($paths, TRUE) . ';' . "\n";
      $output .= '$getlocations_node_marker = ';
      $node_marker = variable_get('getlocations_node_marker', array(
        'enable' => 0,
      ));
      $output .= var_export($node_marker, TRUE) . ';' . "\n";
      if (module_exists('taxonomy')) {
        $output .= '$getlocations_vocabulary_marker = ';
        $vocabulary_marker = variable_get('getlocations_vocabulary_marker', array(
          'enable' => 0,
        ));
        $output .= var_export($vocabulary_marker, TRUE) . ';' . "\n";
        $output .= '$getlocations_term_marker = ';
        $term_marker = variable_get('getlocations_term_marker', array(
          'enable' => 0,
          'vids' => 0,
          'max_depth' => '',
        ));
        $output .= var_export($term_marker, TRUE) . ';' . "\n";
      }
      if (module_exists('colorbox')) {
        $output .= '$getlocations_colorbox = ';
        $colorbox = getlocations_colorbox_settings();
        $output .= var_export($colorbox, TRUE) . ';' . "\n";
      }
      $output .= '$getlocations_ua = ';
      $ua = getlocations_ua_get();
      $output .= var_export($ua, TRUE) . ';' . "\n";
      $output .= '$getlocations_aggr = ';
      $aggr = getlocations_aggr_get();
      $output .= var_export($aggr, TRUE) . ';' . "\n";
      $output .= '$getlocations_flush = ';
      $flush = variable_get('getlocations_flush', 1);
      $output .= var_export($flush, TRUE) . ';' . "\n";
      $output .= '$getlocations_api3_key = ';
      $key = variable_get('getlocations_api3_key', '');
      $output .= var_export($key, TRUE) . ';' . "\n";
      $title = t('Getlocations configuration settings');
    }
    elseif ($export_select == 2) {
      $output = '// getlocations_fields.module configuration on ' . $addon;
      $output .= '$getlocations_fields_defaults = ';
      $defaults = getlocations_fields_defaults();
      $output .= var_export($defaults, TRUE) . ';' . "\n";
      $output .= '$getlocations_fields_paths = ';
      $paths = getlocations_fields_paths_get();
      $output .= var_export($paths, TRUE) . ';' . "\n";
      $title = t('Getlocations Fields configuration settings');
    }
    elseif ($export_select == 3) {
      $output = '// getlocations_search.module configuration on ' . $addon;
      $output .= '$getlocations_search_defaults = ';
      $defaults = getlocations_search_defaults();
      $output .= var_export($defaults, TRUE) . ';' . "\n";
      $output .= '$getlocations_search_paths = ';
      $paths = getlocations_search_paths_get();
      $output .= var_export($paths, TRUE) . ';' . "\n";
      $title = t('Getlocations Search configuration settings');
    }
    elseif ($export_select == 4) {
      $output = '// getlocations_leaflet.module configuration on ' . $addon;
      $output .= '$getlocations_leaflet_defaults = ';
      $defaults = getlocations_leaflet_defaults();
      $output .= var_export($defaults, TRUE) . ';' . "\n";
      $output .= '$getlocations_leaflet_paths = ';
      $paths = getlocations_leaflet_paths_get();
      $output .= var_export($paths, TRUE) . ';' . "\n";
      $output .= '$getlocations_leaflet_plugins = ';
      $plugins = getlocations_leaflet_plugins();
      $output .= var_export($plugins, TRUE) . ';' . "\n";
      $output .= '$getlocations_leaflet_cloudmade = ';
      $cloudmade = variable_get('getlocations_leaflet_cloudmade', array(
        'cloudmade_key' => '',
        'cloudmade_maps' => array(),
      ));
      $output .= var_export($cloudmade, TRUE) . ';' . "\n";
      $title = t('Getlocations Leaflet configuration settings');
    }
    if ($output) {
      $form['getlocations_tools_export_output'] = array(
        '#type' => 'textarea',
        '#title' => $title,
        '#default_value' => $output,
        '#rows' => 15,
      );
    }
    return $form;
  }
}