db.views.inc 3.7 KB

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