| 1 |
<?php // $Id: geo_data.admin.inc,v 1.3 2008/08/28 09:37:04 vauxia Exp $ |
<?php // $Id: geo_data.admin.inc,v 1.4 2008/09/25 21:51:33 vauxia Exp $ |
| 2 |
|
|
| 3 |
/** |
/** |
| 4 |
* Put together a form of all the spatial columns. |
* Put together a form of all the spatial columns. |
| 17 |
'#title' => t('Table Label'), |
'#title' => t('Table Label'), |
| 18 |
'#default_value' => '', // TODO set as table label from link table |
'#default_value' => '', // TODO set as table label from link table |
| 19 |
); |
); |
|
|
|
|
/* |
|
|
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']; |
|
|
} |
|
| 20 |
} |
} |
|
*/ |
|
| 21 |
|
|
| 22 |
$form['#attributes']['enctype'] = 'multipart/form-data'; |
$form['#attributes']['enctype'] = 'multipart/form-data'; |
| 23 |
$form['import'] = array( |
$form['import'] = array( |
| 60 |
$srid = $form_state['values']['import']['srid']; |
$srid = $form_state['values']['import']['srid']; |
| 61 |
geo_shp2sql($file, $table_name, $create, $srid); |
geo_shp2sql($file, $table_name, $create, $srid); |
| 62 |
} |
} |
|
/* |
|
|
$views_fields = _views_get_fields(); |
|
|
|
|
|
foreach ($values['tables'] as $table => $fields) { |
|
|
foreach ($fields as $col => $data) { |
|
|
if ($link_field = $views_fields[$data['view_field']]) { |
|
|
// get the "column" we will join on and the table where that column exists. |
|
|
$link_column = substr($data['view_field'], strpos($data['view_field'], '.') + 1); |
|
|
$link_table = $link_field['table']; |
|
|
$additional_columns = array(); |
|
|
// now we iterate through this table again, to find all the "exposed" fields |
|
|
foreach ($fields as $ecol => $edata) { |
|
|
if ($edata['exposed']) { |
|
|
$additional_columns[$ecol] = array( |
|
|
'label' => $edata['desc'], |
|
|
'type' => $edata['type_hidden'], |
|
|
); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
*/ |
|
| 63 |
} |
} |
| 64 |
|
|
| 65 |
function theme_geo_data_admin_tables($form) { |
function theme_geo_data_admin_tables($form) { |
| 89 |
|
|
| 90 |
return $output; |
return $output; |
| 91 |
} |
} |
|
|
|
|
/* |
|
|
function geo_data_theme($existing, $type, $theme, $path) { |
|
|
return array( |
|
|
'geo_data_admin_tables' => array( |
|
|
'arguments' => array('form' => array()), |
|
|
), |
|
|
); |
|
|
} |
|
|
*/ |
|