db.views.inc 3.7 KB

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