tripal_views_search.module 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. function tripal_views_search_menu(){
  3. $items = array();
  4. $items['admin/settings/tripal_views_search'] = array(
  5. 'title' => t('Tripal Views Search settings'),
  6. 'description' => t('Tripal Views Search settings page, allows you to select which materialized views and chado tables to use for searches.'),
  7. 'page callback' => 'drupal_get_form',
  8. 'page arguments' => array('tripal_views_search_admin'),
  9. 'access arguments' => array('access administration pages'),
  10. 'type' => MENU_NORMAL_ITEM,
  11. );
  12. return $items;
  13. }
  14. function tripal_views_search_admin(){
  15. $form = array();
  16. $form['tripal_views_search_config_mview'] = array(
  17. '#type' => 'select',
  18. '#title' => t('Materialized View'),
  19. '#options' => tripal_views_search_mview_list(),
  20. '#description' => t('Select which materialized view needs to be used for this search'),
  21. '#required' => TRUE,
  22. );
  23. $form['tripal_views_search_config_btable'] = array(
  24. '#type' => 'select',
  25. '#title' => t('Chado base table'),
  26. '#options' => tripal_views_search_btable_list(),
  27. '#description' => t('Select which chado table needs to be used for this earch'),
  28. '#required' => TRUE,
  29. );
  30. return system_settings_form($form);
  31. }
  32. /* this needs to go into the function tripal_views_search_block()
  33. $limitnum = variable_get("onthisdate_maxdisp", 3);
  34. $query = "SELECT nid, title, created FROM " .
  35. "{node} WHERE created >= %d " .
  36. "AND created <= %d";
  37. $query_result = db_query_range($query, $start_time, $end_time, 0, $limitnum);
  38. */
  39. //TODO: validation for the admin pages
  40. function tripal_views_search_mview_list(){
  41. //must return an array of strings ie:
  42. $options = array(
  43. 'dummyoption' => t('dummyoptiontext'),
  44. );
  45. return $options;
  46. }
  47. function tripal_views_search_btable_list(){
  48. //must return an array of strings ie:
  49. $options = array(
  50. 'dummyoption2' => t('dummyoptiontext2'),
  51. );
  52. return $options;
  53. }