tripal_views_setup.admin.inc 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. function tripal_views_setup_admin(){
  3. // $add_url = url('admin/tripal/tripal_views_setup/new');
  4. // $output = "<div id='add-new-search'><a href=\"$add_url\">Add New Search</a><div>";
  5. // $output .= drupal_get_form('tripal_views_setup_admin_form');
  6. //
  7. //
  8. return $rows;
  9. }
  10. function tripal_views_setup_admin_form(){
  11. $query_resulst = db_query('SELECT * FROM public.tripal_views_setup;');
  12. $form = array();
  13. $int_i = 0;
  14. $records = array();
  15. while($record = db_fetch_object($query_resulst)){
  16. dpm($record, 'record' . (string)$int_i);
  17. $item_name = 'tripal_views_setup_config_query_record_' . (string)$int_i;
  18. $form[$item_name] = array(
  19. '#type' => 'checkbox',
  20. '#title' => t($record->name),
  21. '#description' => t('Search of mview ' . $record->mview_id . ' and ' . $record->base_table_name),
  22. '#required' => TRUE,
  23. );
  24. $int_i++;
  25. }
  26. dpm($form, 'admin_form');
  27. return $form;
  28. //return system_settings_form($form);
  29. }
  30. function tripal_views_setup_new_search_form(){
  31. $form = array();
  32. $form['tripal_views_setup_config_mview'] = array(
  33. '#type' => 'textfield',
  34. '#title' => t('Materialized View'),
  35. '#description' => t('Select which materialized view needs to be used for this search'),
  36. '#required' => TRUE,
  37. );
  38. /*
  39. $form['tripal_views_setup_config_mview'] = array(
  40. '#type' => 'select',
  41. '#title' => t('Materialized View'),
  42. '#options' => tripal_views_setup_mview_list(),
  43. '#description' => t('Select which materialized view needs to be used for this search'),
  44. '#required' => TRUE,
  45. );
  46. $form['tripal_views_setup_config_btable'] = array(
  47. '#type' => 'select',
  48. '#title' => t('Chado base table'),
  49. '#options' => tripal_views_setup_btable_list(),
  50. '#description' => t('Select which chado table needs to be used for this earch'),
  51. '#required' => TRUE,
  52. );
  53. dpm($form, 'tripal_views_setup_admin form');
  54. */
  55. return $form;
  56. }
  57. function tripal_views_setup_mview_list(){
  58. //must return an array of strings ie:
  59. $options = array(
  60. 'dummyoption' => t('dummyoptiontext'),
  61. );
  62. return $options;
  63. }
  64. function tripal_views_setup_btable_list(){
  65. //must return an array of strings ie:
  66. $options = array(
  67. 'dummyoption2' => t('dummyoptiontext2'),
  68. );
  69. return $options;
  70. }