tripal_genetic.views.inc 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * @file
  4. * This file contains the basic functions for views integration of
  5. * chado/tripal_genetic 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. require_once('views/genotype.views.inc');
  12. /*************************************************************************
  13. * Implements hook_views_data()
  14. * Purpose: Describe chado/tripal tables & fields to views
  15. *
  16. * @return: a data array which follows the structure outlined in the
  17. * views2 documentation for this hook. Essentially, it's an array of table
  18. * definitions keyed by chado/tripal table name. Each table definition
  19. * includes basic details about the table, fields in that table and
  20. * relationships between that table and others (joins)
  21. */
  22. function tripal_genetic_views_data() {
  23. $data = array();
  24. //$data = array_merge($data, retrieve_genotype_views_data());
  25. if (module_exists('tripal_views')) {
  26. $tables = array(
  27. 'environment',
  28. 'genotype',
  29. 'phenstatement'
  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. 'environment_cvterm',
  39. 'feautre_genotype',
  40. 'phendesc',
  41. 'phenotype_comparison'
  42. );
  43. foreach ($tables as $tablename) {
  44. if (!tripal_views_is_integrated($tablename, 10)) {
  45. $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename,FALSE);
  46. tripal_views_integration_add_entry($table_integration_array);
  47. }
  48. }
  49. }
  50. return $data;
  51. }
  52. /*************************************************************************
  53. * Implements hook_views_handlers()
  54. * Purpose: Register all custom handlers with views
  55. * where a handler describes either "the type of field",
  56. * "how a field should be filtered", "how a field should be sorted"
  57. *
  58. * @return: An array of handler definitions
  59. */
  60. function tripal_genetic_views_handlers() {
  61. return array(
  62. 'info' => array(
  63. 'path' => drupal_get_path('module', 'tripal_genetic') . '/views/handlers',
  64. ),
  65. 'handlers' => array(
  66. ),
  67. );
  68. }