function tripal_contact_admin_validate

2.x tripal_contact.admin.inc tripal_contact_admin_validate($form, &$form_state)
3.x tripal_contact.admin.inc tripal_contact_admin_validate($form, &$form_state)
1.x tripal_contact.admin.inc tripal_contact_admin_validate($form, &$form_state)

Related topics

File

tripal_contact/includes/tripal_contact.admin.inc, line 109

Code

function tripal_contact_admin_validate($form, &$form_state) {
  global $user; // we need access to the user info
  $job_args = array();

  // -------------------------------------
  // Submit the Reindex Job if selected
  if ($form_state['values']['op'] == t('Reindex Features')) {
    $contacts = $form_state['values']['re-maps'];
    foreach ($contacts as $contact_id) {
      if ($contact_id and preg_match("/^\d+$/i", $contact_id)) {
        // get the map info
        $sql = "SELECT * FROM {contact} WHERE contact_id = %d";
        $contact = db_fetch_object(chado_query($sql, $contact_id));
        $job_args[0] = $contact_id;
        tripal_add_job("Reindex features for map: $contact->name", 'tripal_contact', 
        'tripal_contact_reindex_features', $job_args, $user->uid);
      }
    }
  }

  // -------------------------------------
  // Submit the Cleanup Job if selected
  if ($form_state['values']['op'] == t('Clean up orphaned maps')) {
    tripal_add_job('Cleanup orphaned maps', 'tripal_contact', 
    'tripal_contact_cleanup', $job_args, $user->uid);
  }
}