tripal_views_setup.admin.inc 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. $form['featured'] = array(
  27. '#type' => 'checkboxes',
  28. '#options' => $options,
  29. '#default_value' => $status,
  30. );
  31. dpm($form, 'admin_form');
  32. return $form;
  33. //return system_settings_form($form);
  34. }
  35. function tripal_views_setup_new_search_form(){
  36. $form = array();
  37. $form['tripal_views_setup_config_mview'] = array(
  38. '#type' => 'textfield',
  39. '#title' => t('Materialized View'),
  40. '#description' => t('Select which materialized view needs to be used for this search'),
  41. '#required' => TRUE,
  42. );
  43. /*
  44. $form['tripal_views_setup_config_mview'] = array(
  45. '#type' => 'select',
  46. '#title' => t('Materialized View'),
  47. '#options' => tripal_views_setup_mview_list(),
  48. '#description' => t('Select which materialized view needs to be used for this search'),
  49. '#required' => TRUE,
  50. );
  51. $form['tripal_views_setup_config_btable'] = array(
  52. '#type' => 'select',
  53. '#title' => t('Chado base table'),
  54. '#options' => tripal_views_setup_btable_list(),
  55. '#description' => t('Select which chado table needs to be used for this earch'),
  56. '#required' => TRUE,
  57. );
  58. dpm($form, 'tripal_views_setup_admin form');
  59. */
  60. return $form;
  61. }
  62. function tripal_views_setup_mview_list(){
  63. //must return an array of strings ie:
  64. $options = array(
  65. 'dummyoption' => t('dummyoptiontext'),
  66. );
  67. return $options;
  68. }
  69. function tripal_views_setup_btable_list(){
  70. //must return an array of strings ie:
  71. $options = array(
  72. 'dummyoption2' => t('dummyoptiontext2'),
  73. );
  74. return $options;
  75. }