tripal_views_search.module 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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' => 'textfield',
  18. '#title' => t('Materialized View'),
  19. '#default_value' => variable_get('tripal_views_search_config_mview', 'amview'),
  20. '#size' => 2,
  21. '#maxlength' => 2,
  22. '#description' => t('Select which materialized view needs to be used for this search'),
  23. '#required' => TRUE,
  24. );
  25. $form['tripal_views_search_config_btable'] = array(
  26. '#type' => 'textfield',
  27. '#title' => t('Chado base table'),
  28. '#default_value' => variable_get('tripal_views_search_config_btable', 'achadotable'),
  29. '#size' => 2,
  30. '#maxlength' => 2,
  31. '#description' => t('Select which chado table needs to be used for this earch'),
  32. '#required' => TRUE,
  33. );
  34. return system_settings_form($form);
  35. }
  36. /* this needs to go into the function tripal_views_search_block()
  37. $limitnum = variable_get("onthisdate_maxdisp", 3);
  38. $query = "SELECT nid, title, created FROM " .
  39. "{node} WHERE created >= %d " .
  40. "AND created <= %d";
  41. $query_result = db_query_range($query, $start_time, $end_time, 0, $limitnum);
  42. */