tripal_views_search.admin.inc 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. function tripal_views_search_admin(){
  3. $form = array();
  4. $form['tripal_views_search_config_mview'] = array(
  5. '#type' => 'select',
  6. '#title' => t('Materialized View'),
  7. '#options' => tripal_views_search_mview_list(),
  8. '#description' => t('Select which materialized view needs to be used for this search'),
  9. '#required' => TRUE,
  10. );
  11. $form['tripal_views_search_config_btable'] = array(
  12. '#type' => 'select',
  13. '#title' => t('Chado base table'),
  14. '#options' => tripal_views_search_btable_list(),
  15. '#description' => t('Select which chado table needs to be used for this earch'),
  16. '#required' => TRUE,
  17. );
  18. return system_settings_form($form);
  19. }
  20. /* this needs to go into the function tripal_views_search_block()
  21. $limitnum = variable_get("onthisdate_maxdisp", 3);
  22. $query = "SELECT nid, title, created FROM " .
  23. "{node} WHERE created >= %d " .
  24. "AND created <= %d";
  25. $query_result = db_query_range($query, $start_time, $end_time, 0, $limitnum);
  26. */
  27. //TODO: validation for the admin pages
  28. function tripal_views_search_mview_list(){
  29. //must return an array of strings ie:
  30. $options = array(
  31. 'dummyoption' => t('dummyoptiontext'),
  32. );
  33. return $options;
  34. }
  35. function tripal_views_search_btable_list(){
  36. //must return an array of strings ie:
  37. $options = array(
  38. 'dummyoption2' => t('dummyoptiontext2'),
  39. );
  40. return $options;
  41. }
  42. /**
  43. *
  44. * Use this hook for the admin form page,
  45. * once changes are saved, use this to update
  46. * the tripal_views_search related tables.
  47. *
  48. * @param array $form
  49. * @param array $form_state
  50. * @param int $form_id
  51. */
  52. function tripal_views_search_form_alter(&$form, &$form_state, $form_id){
  53. if(strstr('tripal-views-search-admin', $form['#id'] != FALSE)){
  54. $form['#submit']['tripal_views_search_admin_submit'] = array();
  55. }
  56. }
  57. /**
  58. *
  59. * the actual submit callback function
  60. * @param int $form_id
  61. * @param array $form_values
  62. */
  63. function tripal_views_search_admin_submit($form_id, &$form_values){
  64. //populate db tables based on settings
  65. }