function tripal_stock_sync_form_submit

1.x tripal_stock.sync_stocks.inc tripal_stock_sync_form_submit($form, &$form_state)

File

tripal_stock/includes/tripal_stock.sync_stocks.inc, line 96
@todo Add file header description

Code

function tripal_stock_sync_form_submit($form, &$form_state) {

  global $user;

  $organism_id = $form_state['values']['organism_id'];
  $stock_types = $form_state['values']['stock_types'];

  $job_args = array(0, $organism_id, $stock_types);

  if ($organism_id) {
    $organism = tripal_core_chado_select('organism', array('genus', 'species'), array('organism_id' => $organism_id));
    $title = "Sync stocks for " . $organism[0]->genus . " " . $organism[0]->species;
  }
  else {
    $title = 'Sync stocks';
  }

  variable_set('chado_sync_stock_types', $stock_types);

  tripal_add_job($title, 'tripal_stock', 'tripal_stock_sync_stocks', $job_args, $user->uid);
}