function tripal_cv_cvterm_add_form

2.x tripal_cv.cvterm_form.inc tripal_cv_cvterm_add_form($form, &$form_state)
3.x tripal_chado.cv.inc tripal_cv_cvterm_add_form($form, &$form_state)

Form for adding cvterms

Related topics

1 string reference to 'tripal_cv_cvterm_add_form'
tripal_cv_menu in tripal_cv/tripal_cv.module
Implements hook_menu(). Registers all menu items associated with this module

File

tripal_cv/includes/tripal_cv.cvterm_form.inc, line 131
Provides a form for creating & editing chado controlled vocabularies

Code

function tripal_cv_cvterm_add_form($form, &$form_state) {
  $cv_id = 0;
  if (array_key_exists('values', $form_state)) {
    $cv_id = $form_state['values']['cv_id'];
  }
  elseif (isset($form_state['build_info']['args'][0])) {
    $cv_id = $form_state['build_info']['args'][0];
  }

  // get a list of CVs
  $cvs = array();
  $sql = "SELECT * FROM {cv} WHERE NOT name = 'tripal' ORDER BY name ";
  $results = chado_query($sql);
  $cvs[] = 'Select a vocabulary';
  foreach ($results as $cv) {
    $cvs[$cv->cv_id] = $cv->name;
  }
  $form['cv_id'] = array(
    '#title' => t('Controlled Vocabulary (Ontology) Name'),
    '#type' => 'select',
    '#options' => $cvs,
    '#required' => TRUE,
    '#default_value' => $cv_id,
  );
  tripal_cv_add_cvterm_form_fields($form, $form_state);

  $form['add'] = array(
    '#type' => 'submit',
    '#value' => t('Add Term'),
  );

  return $form;
}