db.views.inc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. );
  36. // Table Field Definitions----------------------
  37. // Field: db_id (primary key)
  38. $data['db']['db_id'] = array(
  39. 'title' => t('Database ID'),
  40. 'help' => t('The primary key of the Database.'),
  41. 'field' => array(
  42. 'handler' => 'views_handler_field_numeric',
  43. 'click sortable' => TRUE,
  44. ),
  45. 'filter' => array(
  46. 'handler' => 'views_handler_filter_numeric',
  47. ),
  48. 'sort' => array(
  49. 'handler' => 'views_handler_sort',
  50. ),
  51. );
  52. // Field: name (varchar 255)
  53. $data['db']['name'] = array(
  54. 'title' => 'Name',
  55. 'field' => array(
  56. 'handler' => 'views_handler_field',
  57. 'click sortable' => TRUE,
  58. ),
  59. 'sort' => array(
  60. 'handler' => 'views_handler_sort',
  61. ),
  62. 'filter' => array(
  63. 'handler' => 'views_handler_filter_string',
  64. ),
  65. 'argument' => array(
  66. 'handler' => 'views_handler_argument_string',
  67. ),
  68. );
  69. // Field: description (varchar 255)
  70. $data['db']['description'] = array(
  71. 'title' => 'Description',
  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_string',
  81. ),
  82. 'argument' => array(
  83. 'handler' => 'views_handler_argument_string',
  84. ),
  85. );
  86. // Field: urlprefix (varchar 255)
  87. $data['db']['urlprefix'] = array(
  88. 'title' => 'URL Prefix',
  89. 'help' => 'The url that when concatenated with the accession of a record in this db produces the url to the record in this database.',
  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: url (varchar 255)
  105. $data['db']['url'] = array(
  106. 'title' => 'URL',
  107. 'help' => 'The url to the main page of the 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. return $data;
  123. }