nd_geolocation.views.inc 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <?php
  2. /**
  3. * @file
  4. * This file defines the data array for a given chado table. This array
  5. * is merged into a larger array containing definitions of all tables associated
  6. * with this module in:
  7. * @see tripal_natural_diversity.views.inc --in tripal_natural_diversity_views_data()
  8. *
  9. * Documentation on views integration can be found at
  10. * http://views2.logrus.com/doc/html/index.html.
  11. */
  12. /*************************************************************************
  13. * Purpose: this function returns the portion of the data array
  14. * which describes the nd_geolocation table, it's fields and any joins between it and other tables
  15. * @see tripal_natural_diversity_views_data() --in tripal_natural_diversity.views.inc
  16. *
  17. * Table: nd_geolocation
  18. * @code
  19. * nd_geolocation-Copy/Paste Table SQL code here-nd_geolocation
  20. * @endcode
  21. */
  22. function retrieve_nd_geolocation_views_data() {
  23. global $db_url;
  24. $data = array();
  25. // if the chado database is not local to the drupal database
  26. // then we need to set the database name. This should always
  27. // be 'chado'.
  28. if(is_array($db_url) and array_key_exists('chado',$db_url)){
  29. $database = 'chado';
  30. }
  31. //Basic table definition-----------------------------------
  32. $data['nd_geolocation']['table']['group'] = t('Chado ND geolocation');
  33. $data['nd_geolocation']['table']['base'] = array(
  34. 'field' => 'nd_geolocation_id',
  35. 'title' => t('Chado Natural Diversity Geolocation'),
  36. 'help' => t('A listing of locations where Natural Diversity Experiments can be performed.'),
  37. );
  38. if($database){
  39. $data['nd_geolocation']['table']['database'] = $database;
  40. }
  41. //Relationship Definitions---------------------------------
  42. //Join: nd_geolocation => nd_experiment
  43. $data['nd_geolocation']['table']['join']['nd_experiment'] = array(
  44. 'left_field' => 'nd_geolocation_id',
  45. 'field' => 'nd_geolocation_id',
  46. );
  47. //Table Field Definitions----------------------------------
  48. //Field: nd_geolocation_id (primary key)
  49. $data['nd_geolocation']['nd_geolocation_id'] = array(
  50. 'title' => t('ND Geolocation Primary Key'),
  51. 'help' => t('A unique index for every nd_geolocation.'),
  52. 'field' => array(
  53. 'handler' => 'views_handler_field_numeric',
  54. 'click sortable' => TRUE,
  55. ),
  56. 'sort' => array(
  57. 'handler' => 'views_handler_sort',
  58. ),
  59. 'filter' => array(
  60. 'handler' => 'views_handler_filter_numeric',
  61. ),
  62. );
  63. //Field: description (varchar 255)
  64. $data['nd_geolocation']['description'] = array(
  65. 'title' => t('Description'),
  66. 'help' => t('A short description of a given geolocation.'),
  67. 'field' => array(
  68. 'handler' => 'views_handler_field',
  69. 'click sortable' => TRUE,
  70. ),
  71. 'sort' => array(
  72. 'handler' => 'views_handler_sort',
  73. ),
  74. 'filter' => array(
  75. 'handler' => 'views_handler_filter_string',
  76. ),
  77. 'argument' => array(
  78. 'handler' => 'views_handler_argument_string',
  79. ),
  80. );
  81. //Field: latitude (real)
  82. $data['nd_geolocation']['latitude'] = array(
  83. 'title' => t('Latitude'),
  84. 'help' => t('The decimal latitude coordinate of the georeference, using positive and negative sign to indicate N and S, respectively.'),
  85. 'field' => array(
  86. 'handler' => 'views_handler_field_numeric',
  87. 'click sortable' => TRUE,
  88. ),
  89. 'sort' => array(
  90. 'handler' => 'views_handler_sort',
  91. ),
  92. 'filter' => array(
  93. 'handler' => 'views_handler_filter_numeric',
  94. ),
  95. );
  96. //Field: longitude (real)
  97. $data['nd_geolocation']['longitude'] = array(
  98. 'title' => t('Longitude'),
  99. 'help' => t('The decimal longitude coordinate of the georeference, using positive and negative sign to indicate E and W, respectively.'),
  100. 'field' => array(
  101. 'handler' => 'views_handler_field_numeric',
  102. 'click sortable' => TRUE,
  103. ),
  104. 'sort' => array(
  105. 'handler' => 'views_handler_sort',
  106. ),
  107. 'filter' => array(
  108. 'handler' => 'views_handler_filter_numeric',
  109. ),
  110. );
  111. //Field: altitude (real)
  112. $data['nd_geolocation']['altitude'] = array(
  113. 'title' => t('Altitude'),
  114. 'help' => t('The altitude (elevation) of the location in meters. If the altitude is only known as a range, this is the average, and altitude_dev will hold half of the width of the range.'),
  115. 'field' => array(
  116. 'handler' => 'views_handler_field_numeric',
  117. 'click sortable' => TRUE,
  118. ),
  119. 'sort' => array(
  120. 'handler' => 'views_handler_sort',
  121. ),
  122. 'filter' => array(
  123. 'handler' => 'views_handler_filter_numeric',
  124. ),
  125. );
  126. //Field: geodetic_datum (varchar 255)
  127. $data['nd_geolocation']['geodetic_datum'] = array(
  128. 'title' => t('Deodetic Datum'),
  129. 'help' => t('The geodetic system on which the geo-reference coordinates are based. For geo-references measured between 1984 and 2010, this will typically be WGS84.'),
  130. 'field' => array(
  131. 'handler' => 'views_handler_field',
  132. 'click sortable' => TRUE,
  133. ),
  134. 'sort' => array(
  135. 'handler' => 'views_handler_sort',
  136. ),
  137. 'filter' => array(
  138. 'handler' => 'views_handler_filter_string',
  139. ),
  140. 'argument' => array(
  141. 'handler' => 'views_handler_argument_string',
  142. ),
  143. );
  144. return $data;
  145. }