db.views.inc 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <?php
  2. /**
  3. * Purpose: this function returns the 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: db
  8. * @code
  9. * create table db (
  10. * db_id serial not null,
  11. * primary key (db_id),
  12. * name varchar(255) not null,
  13. * description varchar(255) null,
  14. * urlprefix varchar(255) null,
  15. * url varchar(255) null,
  16. * constraint db_c1 unique (name)
  17. * );
  18. * @endcode
  19. *
  20. * @ingroup tripal_db_views
  21. */
  22. function retrieve_db_views_data() {
  23. // Basic table definition
  24. $data['db']['table'] = array(
  25. 'field' => 'db_id',
  26. 'group' => 'Chado Database',
  27. 'title' => 'Chado Database',
  28. 'help' => 'Database Records existing in the Chado Database',
  29. 'database' => 'chado'
  30. );
  31. // Define relationships between this table and others
  32. $data['db']['table']['join'] = array(
  33. 'dbxref' => array(
  34. 'left_field' => 'db_id',
  35. 'field' => 'db_id',
  36. ),
  37. 'stock' => array(
  38. 'left_table' => 'dbxref',
  39. 'left_field' => 'db_id',
  40. 'field' => 'db_id',
  41. ),
  42. 'cvterm' => array(
  43. 'left_table' => 'dbxref',
  44. 'left_field' => 'db_id',
  45. 'field' => 'db_id',
  46. ),
  47. 'feature' => array(
  48. 'left_table' => 'dbxref',
  49. 'left_field' => 'db_id',
  50. 'field' => 'db_id',
  51. ),
  52. );
  53. // Table Field Definitions----------------------
  54. // Field: db_id (primary key)
  55. $data['db']['db_id'] = array(
  56. 'title' => t('Database ID'),
  57. 'help' => t('The primary key of the Database.'),
  58. 'field' => array(
  59. 'handler' => 'views_handler_field_numeric',
  60. 'click sortable' => TRUE,
  61. ),
  62. 'filter' => array(
  63. 'handler' => 'views_handler_filter_numeric',
  64. ),
  65. 'sort' => array(
  66. 'handler' => 'views_handler_sort',
  67. ),
  68. );
  69. // Field: name (varchar 255)
  70. $data['db']['name'] = array(
  71. 'title' => 'Name',
  72. 'field' => array(
  73. 'handler' => 'views_handler_field',
  74. 'click sortable' => TRUE,
  75. ),
  76. 'sort' => array(
  77. 'handler' => 'views_handler_sort',
  78. ),
  79. 'filter' => array(
  80. 'handler' => 'views_handler_filter_chado_select_string',
  81. ),
  82. 'argument' => array(
  83. 'handler' => 'views_handler_argument_string',
  84. ),
  85. );
  86. // Field: description (varchar 255)
  87. $data['db']['description'] = array(
  88. 'title' => 'Description',
  89. 'field' => array(
  90. 'handler' => 'views_handler_field',
  91. 'click sortable' => TRUE,
  92. ),
  93. 'sort' => array(
  94. 'handler' => 'views_handler_sort',
  95. ),
  96. 'filter' => array(
  97. 'handler' => 'views_handler_filter_string',
  98. ),
  99. 'argument' => array(
  100. 'handler' => 'views_handler_argument_string',
  101. ),
  102. );
  103. // Field: urlprefix (varchar 255)
  104. $data['db']['urlprefix'] = array(
  105. 'title' => 'URL Prefix',
  106. 'help' => 'The url that when concatenated with the accession of a record in this db produces the url to the record in this database.',
  107. 'field' => array(
  108. 'handler' => 'views_handler_field',
  109. 'click sortable' => TRUE,
  110. ),
  111. 'sort' => array(
  112. 'handler' => 'views_handler_sort',
  113. ),
  114. 'filter' => array(
  115. 'handler' => 'views_handler_filter_string',
  116. ),
  117. 'argument' => array(
  118. 'handler' => 'views_handler_argument_string',
  119. ),
  120. );
  121. // Field: url (varchar 255)
  122. $data['db']['url'] = array(
  123. 'title' => 'URL',
  124. 'help' => 'The url to the main page of the database',
  125. 'field' => array(
  126. 'handler' => 'views_handler_field',
  127. 'click sortable' => TRUE,
  128. ),
  129. 'sort' => array(
  130. 'handler' => 'views_handler_sort',
  131. ),
  132. 'filter' => array(
  133. 'handler' => 'views_handler_filter_string',
  134. ),
  135. 'argument' => array(
  136. 'handler' => 'views_handler_argument_string',
  137. ),
  138. );
  139. return $data;
  140. }