cv.views.inc 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. * @ingroup tripal_cv_views
  19. */
  20. function retrieve_cv_views_data() {
  21. $data = array();
  22. // Basic table definition
  23. $data['cv']['table'] = array(
  24. 'field' => 'cv_id',
  25. 'title' => 'Chado CV (Controlled Vocabulary)',
  26. 'group' => 'Chado CV',
  27. 'help' => 'Controlled vocabularies existing in the Chado Database',
  28. 'database' => 'chado'
  29. );
  30. // Define relationships between this table and others
  31. $data['cv']['table']['join'] = array(
  32. 'cvterm' => array(
  33. 'left_field' => 'cv_id',
  34. 'field' => 'cv_id',
  35. ),
  36. );
  37. // Table Field Definitions----------------------
  38. // Field: cv_id (primary key)
  39. $data['cv']['cv_id'] = array(
  40. 'title' => t('CV ID'),
  41. 'help' => t('The primary key of the controlled vocabulary.'),
  42. 'field' => array(
  43. 'handler' => 'views_handler_field_numeric',
  44. 'click sortable' => TRUE,
  45. ),
  46. 'filter' => array(
  47. 'handler' => 'views_handler_filter_numeric',
  48. ),
  49. 'sort' => array(
  50. 'handler' => 'views_handler_sort',
  51. ),
  52. );
  53. //Field: name (varchar -255)
  54. $data['cv']['name'] = array(
  55. 'title' => 'Vocabulary Name',
  56. 'field' => array(
  57. 'handler' => 'views_handler_field',
  58. 'click sortable' => TRUE,
  59. ),
  60. 'sort' => array(
  61. 'handler' => 'views_handler_sort',
  62. ),
  63. 'filter' => array(
  64. 'handler' => 'views_handler_filter_chado_select_string',
  65. ),
  66. 'argument' => array(
  67. 'handler' => 'views_handler_argument_string',
  68. ),
  69. );
  70. //Field: definition (text)
  71. $data['cv']['definition'] = array(
  72. 'title' => 'Vocabulary Definition',
  73. 'field' => array(
  74. 'handler' => 'views_handler_field',
  75. 'click sortable' => TRUE,
  76. ),
  77. 'filter' => array(
  78. 'handler' => 'views_handler_filter_string',
  79. ),
  80. 'argument' => array(
  81. 'handler' => 'views_handler_argument_string',
  82. ),
  83. );
  84. return $data;
  85. }