tripal_natural_diversity.views.inc.orig 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. /**
  3. * @file
  4. * This file contains the basic functions for views integration of
  5. * chado/tripal_natural_diversity tables. Supplementary functions can be found in
  6. * ./views/
  7. *
  8. * Documentation on views integration can be found at
  9. * http://views2.logrus.com/doc/html/index.html.
  10. */
  11. /*************************************************************************
  12. * Implements hook_views_data()
  13. * Purpose: Describe chado/tripal tables & fields to views
  14. *
  15. * @return: a data array which follows the structure outlined in the
  16. * views2 documentation for this hook. Essentially, it's an array of table
  17. * definitions keyed by chado/tripal table name. Each table definition
  18. * includes basic details about the table, fields in that table and
  19. * relationships between that table and others (joins)
  20. */
  21. function tripal_natural_diversity_views_data() {
  22. $data = array();
  23. <<<<<<< HEAD
  24. if (module_exists('tripal_views')) {
  25. $tables = array(
  26. 'nd_experiment',
  27. 'nd_geolocation',
  28. 'nd_protocol',
  29. 'nd_reagent'
  30. );
  31. foreach ($tables as $tablename) {
  32. if (!tripal_views_is_integrated($tablename, 10)) {
  33. $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename,TRUE);
  34. tripal_views_integration_add_entry($table_integration_array);
  35. }
  36. }
  37. $tables = array(
  38. 'nd_experiment_contact',
  39. 'nd_experiment_dbxref',
  40. 'nd_experiment_genotype',
  41. 'nd_experiment_phenotype',
  42. 'nd_experiment_project',
  43. 'nd_experiment_protocol',
  44. 'nd_experiment_pub',
  45. 'nd_experiment_stock',
  46. 'nd_experiment_stock_dbxref',
  47. 'nd_experiment_stockprop',
  48. 'nd_experimentprop',
  49. 'nd_geolocationprop',
  50. 'nd_protocol_reagent',
  51. 'nd_protocolprop',
  52. 'nd_reagent_relationship',
  53. 'nd_reagentprop'
  54. );
  55. foreach ($tables as $tablename) {
  56. if (!tripal_views_is_integrated($tablename, 10)) {
  57. $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename,FALSE);
  58. tripal_views_integration_add_entry($table_integration_array);
  59. }
  60. }
  61. }
  62. =======
  63. //EXPERIMENT
  64. $data = array_merge($data, retrieve_nd_experiment_views_data());
  65. $data = array_merge($data, retrieve_nd_experimentprop_views_data());
  66. // GEOLOCATION
  67. $data = array_merge($data, retrieve_nd_geolocation_views_data());
  68. $data = array_merge($data, retrieve_nd_geolocationprop_views_data());
  69. // REAGENTS
  70. $data = array_merge($data, retrieve_nd_reagent_views_data());
  71. $data = array_merge($data, retrieve_nd_reagentprop_views_data());
  72. >>>>>>> 6.x-0.4-dev
  73. return $data;
  74. }
  75. /*************************************************************************
  76. * Implements hook_views_handlers()
  77. * Purpose: Register all custom handlers with views
  78. * where a handler describes either "the type of field",
  79. * "how a field should be filtered", "how a field should be sorted"
  80. *
  81. * @return: An array of handler definitions
  82. */
  83. function tripal_natural_diversity_views_handlers() {
  84. return array(
  85. 'info' => array(
  86. 'path' => drupal_get_path('module', 'tripal_natural_diversity') . '/views/handlers',
  87. ),
  88. 'handlers' => array(
  89. 'views_handler_field_chado_relationship_all' => array(
  90. 'parent' => 'views_handler_field_prerender_list',
  91. ),
  92. 'views_handler_field_chado_relationship_by_type' => array(
  93. 'parent' => 'views_handler_field_prerender_list',
  94. ),
  95. ),
  96. );
  97. }