function tripal_ws_tripal_sites_form

3.x tripal_ws.admin.inc tripal_ws_tripal_sites_form($form, &$form_state)

Provide form to store information of other Tripal sites

_state

Parameters

unknown $form:

1 string reference to 'tripal_ws_tripal_sites_form'
tripal_ws_menu in tripal_ws/tripal_ws.module
Implements hook_menu(). Defines all menu items needed by Tripal Core

File

tripal_ws/includes/tripal_ws.admin.inc, line 8

Code

function tripal_ws_tripal_sites_form($form, &$form_state) {

  $form = array();
  $values = key_exists('values', $form_state) ? $form_state['values'] : NULL;
  $tripal_site = $values ? $values['tripal_site'] : 0;

  $results =
    db_select('tripal_sites', 'ts')
    ->fields('ts')
    ->execute();
  $headers = array('Name', 'URL', 'Version', 'Description', 'Action');
  $rows = array();
  while ($site = $results->fetchObject()) {
    $rows[] = array(
      $site->name,
      $site->url,
      $site->version,
      $site->description,
      array(
        'data' => l('Edit', '/admin/tripal/storage/ws/tripal_sites/edit/' . $site->id) . ' | ' .
          l('Remove', '/admin/tripal/storage/ws/tripal_sites/remove/' . $site->id),
        'nowrap' => TRUE,
      ),
    );
  }
  if (count($rows) == 0) {
    $rows[] = array('No configured Tripal site.', array('colspan' => 5));
  }

  $table = array(
    'header' => $headers,
    'rows' => $rows,
    'attributes' => array(),
    'sticky' => FALSE,
    'caption' => '',
    'colgroups' => array(),
    'empty' => '',
  );
  $output = theme_table($table);

  $form['instructions'] = array(
    '#type' => 'item',
    '#markup' => t('The following is a list of remote Tripal sites with which
        this site can communicate. You may add and remove site as needed.')
  );
  $form['table'] = array(
    '#markup' => $output
  );

  return $form;
}