geo/modules/geo_data/geo_data.admin.inc, line 5
- Versions
- 6
geo_data_admin()
Put together a form of all the spatial columns.
Code
<?php
function geo_data_admin() {
$form = array('#theme' => 'geo_data_admin_tables');
// Get a list of all geometry-enabled tables, excluding field tables.
$tables = geo('tables', '/^content_field/');
foreach ($tables as $table => $column) {
$form['tables'][$table] = array( '#tree' => 1 );
$form['tables'][$table]['table_label'] = array(
'#type' => 'textfield',
'#title' => t('Table Label'),
'#default_value' => '', // TODO set as table label from link table
);
/*
foreach (geo('table_desc', $table) as $col => $desc) {
$form['tables'][$table][$col] = array(
//'view_field' => array('#type' => 'select', '#options' => $views_field_options),
'exposed' => array( '#type' => 'checkbox', '#default_value' => isset($fields[$table][$col]) ),
'name' => array( '#type' => 'markup', '#value' => $desc['name'] ),
'type' => array( '#type' => 'markup', '#value' => $desc['type'] ),
'type_hidden' => array( '#type' => 'value', '#value' => $desc['type']),
'desc' => array( '#type' => 'textfield', '#default_value' => $fields[$table][$col]['title'], '#size' => 30 ),
);
}
*/
}
/*
if (module_exists('views')) {
$known_fields = geo_data_fields();
views_load_cache(); // get access to some useful views_cache.inc functions
$views_fields = _views_get_fields();
// construct an #options array out of the field names:
$views_field_options['NONE'] = t('No link');
foreach ($views_fields as $id => $field) {
if ($field['notafield']) { continue; } // skip things we can't really link to in the db.
$views_field_options[$id] = $field['name'];
}
}
*/
$form['#attributes']['enctype'] = 'multipart/form-data';
$form['import'] = array(
'#type' => 'fieldset',
'#title' => t('Import shape data'),
'#tree' => TRUE,
'#description' => t('You can import geospatial data from any source, and its data will be available to your Drupal site.'),
);
$form['import']['file'] = array(
'#type' => 'file',
'#title' => t('Shape file'),
);
$form['import']['table_name'] = array(
'#type' => 'textfield',
'#title' => t('Table name'),
'#description' => t('You can import geospatial data from any source, and its data will be available to your Drupal site.'),
);
$form['import']['srid'] = array(
'#type' => 'textfield',
'#title' => t('SRID'),
'#default_value' => GEO_SRID_DEFAULT,
);
$form['import']['create'] = array(
'#type' => 'checkbox',
'#title' => t('Create a new table.'),
'#default_value' => 1,
'#description' => t('You can import geospatial data from any source, and its data will be available to your Drupal site.'),
);
$form['submit'] = array('#type' => 'submit', '#value' => t('Save values'));
return $form;
}
?> 