tripal_ws.admin.inc 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * Provide form to store information of other Tripal sites
  4. *
  5. * @param unknown $form
  6. * @param unknown $form_state
  7. */
  8. function tripal_ws_tripal_sites_form($form, &$form_state) {
  9. $form = array();
  10. $values = key_exists('values', $form_state) ? $form_state['values'] : NULL;
  11. $tripal_site = $values ? $values['tripal_site'] : 0;
  12. $sites = array('Select a Tripal site', 'Add a Tripal site');
  13. $form['tripal_site'] = array(
  14. '#type' => 'select',
  15. '#description' => 'Make change to an existing Tripal site',
  16. '#options' => $sites,
  17. '#default_value' => $tripal_site,
  18. '#ajax' => array(
  19. 'callback' => "tripal_ws_tripal_sites_form_ajax_callback",
  20. 'wrapper' => "tripal-ws-tripal_sites-form",
  21. 'effect' => 'fade',
  22. 'method' => 'replace'
  23. ),
  24. );
  25. // Add/Edit a new tripal site
  26. if ($tripal_site != 0) {
  27. $form['tripal_site_info']['name'] = array(
  28. '#title' => t('Name of Site'),
  29. '#type' => 'textfield'
  30. );
  31. $form['tripal_site_info']['url'] = array(
  32. '#title' => t('URL'),
  33. '#type' => 'textfield'
  34. );
  35. $form['tripal_site_info']['description'] = array(
  36. '#title' => t('Description'),
  37. '#type' => 'textfield'
  38. );
  39. $form['submit_button'] = array(
  40. '#type' => 'submit',
  41. '#value' => t('Save'),
  42. '#name' => 'save'
  43. );
  44. }
  45. $form['#prefix'] = '<div id="tripal-ws-tripal_sites-form">';
  46. $form['#suffix'] = '</div>';
  47. return $form;
  48. }
  49. /**
  50. *
  51. */
  52. function tripal_ws_tripal_sites_form_ajax_callback($form, $form_state) {
  53. return $form;
  54. }