cv.views.inc 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. $data['cv']['cv_id'] = array(
  38. 'title' => t('CV ID'),
  39. 'help' => t('The primary key of the controlled vocabulary.'),
  40. 'field' => array(
  41. 'handler' => 'views_handler_field_numeric',
  42. 'click sortable' => TRUE,
  43. ),
  44. 'filter' => array(
  45. 'handler' => 'views_handler_filter_numeric',
  46. ),
  47. 'sort' => array(
  48. 'handler' => 'views_handler_sort',
  49. ),
  50. );
  51. //Field: name (varchar -255)
  52. $data['cv']['name'] = array(
  53. 'title' => 'Vocabulary Name',
  54. 'field' => array(
  55. 'handler' => 'views_handler_field',
  56. 'click sortable' => TRUE,
  57. ),
  58. 'sort' => array(
  59. 'handler' => 'views_handler_sort',
  60. ),
  61. 'filter' => array(
  62. 'handler' => 'views_handler_filter_string',
  63. ),
  64. 'argument' => array(
  65. 'handler' => 'views_handler_argument_string',
  66. ),
  67. );
  68. //Field: definition (text)
  69. $data['cv']['definition'] = array(
  70. 'title' => 'Vocabulary Definition',
  71. 'field' => array(
  72. 'handler' => 'views_handler_field',
  73. 'click sortable' => TRUE,
  74. ),
  75. 'filter' => array(
  76. 'handler' => 'views_handler_filter_string',
  77. ),
  78. 'argument' => array(
  79. 'handler' => 'views_handler_argument_string',
  80. ),
  81. );
  82. return $data;
  83. }