db.views.inc 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. // mentioned as index above but not displayable in a view
  39. // Field: name (varchar 255)
  40. $data['db']['name'] = array(
  41. 'title' => 'Name',
  42. 'field' => array(
  43. 'handler' => 'views_handler_field',
  44. 'click sortable' => TRUE,
  45. ),
  46. 'sort' => array(
  47. 'handler' => 'views_handler_sort',
  48. ),
  49. 'filter' => array(
  50. 'handler' => 'views_handler_filter_string',
  51. ),
  52. 'argument' => array(
  53. 'handler' => 'views_handler_argument_string',
  54. ),
  55. );
  56. // Field: description (varchar 255)
  57. $data['db']['description'] = array(
  58. 'title' => 'Description',
  59. 'field' => array(
  60. 'handler' => 'views_handler_field',
  61. 'click sortable' => TRUE,
  62. ),
  63. 'sort' => array(
  64. 'handler' => 'views_handler_sort',
  65. ),
  66. 'filter' => array(
  67. 'handler' => 'views_handler_filter_string',
  68. ),
  69. 'argument' => array(
  70. 'handler' => 'views_handler_argument_string',
  71. ),
  72. );
  73. // Field: urlprefix (varchar 255)
  74. $data['db']['urlprefix'] = array(
  75. 'title' => 'URL Prefix',
  76. 'help' => 'The url that when concatenated with the accession of a record in this db produces the url to the record in this database.',
  77. 'field' => array(
  78. 'handler' => 'views_handler_field',
  79. 'click sortable' => TRUE,
  80. ),
  81. 'sort' => array(
  82. 'handler' => 'views_handler_sort',
  83. ),
  84. 'filter' => array(
  85. 'handler' => 'views_handler_filter_string',
  86. ),
  87. 'argument' => array(
  88. 'handler' => 'views_handler_argument_string',
  89. ),
  90. );
  91. // Field: url (varchar 255)
  92. $data['db']['url'] = array(
  93. 'title' => 'URL',
  94. 'help' => 'The url to the main page of the database',
  95. 'field' => array(
  96. 'handler' => 'views_handler_field',
  97. 'click sortable' => TRUE,
  98. ),
  99. 'sort' => array(
  100. 'handler' => 'views_handler_sort',
  101. ),
  102. 'filter' => array(
  103. 'handler' => 'views_handler_filter_string',
  104. ),
  105. 'argument' => array(
  106. 'handler' => 'views_handler_argument_string',
  107. ),
  108. );
  109. return $data;
  110. }