cv.views.inc 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * Prupose: this function returns a portion of the data array
  4. * which describes the cv table, it's fields and any joins between it and other tables
  5. * @see tripal_cv_views_data() --in tripal_cv.views.inc
  6. *
  7. * TABLE: cv
  8. * @code
  9. * create table cv (
  10. * cv_id serial not null,
  11. * primary key (cv_id),
  12. * name varchar(255) not null,
  13. * definition text,
  14. * constraint cv_c1 unique (name)
  15. * );
  16. * @endcode
  17. */
  18. function retrieve_cv_views_data() {
  19. $data = array();
  20. // Basic table definition
  21. $data['cv']['table'] = array(
  22. 'field' => 'cv_id',
  23. 'title' => 'Chado CV (Controlled Vocabulary)',
  24. 'group' => 'Chado CV',
  25. 'help' => 'Controlled vocabularies existing in the Chado Database',
  26. 'database' => 'chado'
  27. );
  28. // Define relationships between this table and others
  29. $data['cv']['table']['join'] = array(
  30. 'cvterm' => array(
  31. 'left_field' => 'cv_id',
  32. 'field' => 'cv_id',
  33. ),
  34. );
  35. // Table Field Definitions----------------------
  36. // Field: cv_id (primary key)
  37. // mentioned as index above but not displayable in a view
  38. //Field: name (varchar -255)
  39. $data['cv']['name'] = array(
  40. 'title' => 'Vocabulary Name',
  41. 'field' => array(
  42. 'handler' => 'views_handler_field',
  43. 'click sortable' => TRUE,
  44. ),
  45. 'sort' => array(
  46. 'handler' => 'views_handler_sort',
  47. ),
  48. 'filter' => array(
  49. 'handler' => 'views_handler_filter_string',
  50. ),
  51. 'argument' => array(
  52. 'handler' => 'views_handler_argument_string',
  53. ),
  54. );
  55. //Field: definition (text)
  56. $data['cv']['definition'] = array(
  57. 'title' => 'Vocabulary Definition',
  58. 'field' => array(
  59. 'handler' => 'views_handler_field',
  60. 'click sortable' => TRUE,
  61. ),
  62. 'sort' => array(
  63. 'handler' => 'views_handler_sort',
  64. ),
  65. 'filter' => array(
  66. 'handler' => 'views_handler_filter_string',
  67. ),
  68. 'argument' => array(
  69. 'handler' => 'views_handler_argument_string',
  70. ),
  71. );
  72. return $data;
  73. }