function tripal_custom_tables_form_submit
2.x tripal_core.custom_tables.inc | tripal_custom_tables_form_submit($form, &$form_state) |
3.x tripal_chado.custom_tables.inc | tripal_custom_tables_form_submit($form, &$form_state) |
1.x custom_tables.inc | tripal_custom_tables_form_submit($form, &$form_state) |
Submit the Create/Edit Custom table form Implements hook_form_submit().
Related topics
File
- tripal_core/
includes/ tripal_core.custom_tables.inc, line 348 - Contains functions for creating, editing and deleting custom tables on the Tripal website.
Code
function tripal_custom_tables_form_submit($form, &$form_state) {
$ret = array();
$action = $form_state['values']['action'];
$table_id = $form_state['values']['table_id'];
$schema = $form_state['values']['schema'];
$force_drop = $form_state['values']['force_drop'];
$skip_creation = 1;
if ($force_drop) {
$skip_creation = 0;
}
// convert the schema into a PHP array
$schema_arr = array();
eval("\$schema_arr = $schema;");
if (strcmp($action, 'Edit') == 0) {
chado_edit_custom_table($table_id, $schema_arr['table'], $schema_arr, $skip_creation);
}
elseif (strcmp($action, 'Add') == 0) {
chado_create_custom_table($schema_arr['table'], $schema_arr, $skip_creation);
}
else {
drupal_set_message(t("No action performed."));
}
drupal_goto("admin/tripal/schema/custom_tables");
}