tripal_genetic.views.inc 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. /*************************************************************************
  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_genetic_views_data() {
  22. $data = array();
  23. if (module_exists('tripal_views')) {
  24. $tables = array(
  25. 'environment',
  26. 'genotype',
  27. 'phenstatement'
  28. );
  29. foreach ($tables as $tablename) {
  30. if (!tripal_views_is_integrated($tablename, 10)) {
  31. $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename,TRUE);
  32. tripal_views_integration_add_entry($table_integration_array);
  33. }
  34. }
  35. $tables = array(
  36. 'environment_cvterm',
  37. 'feautre_genotype',
  38. 'phendesc',
  39. 'phenotype_comparison'
  40. );
  41. foreach ($tables as $tablename) {
  42. if (!tripal_views_is_integrated($tablename, 10)) {
  43. $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename,FALSE);
  44. tripal_views_integration_add_entry($table_integration_array);
  45. }
  46. }
  47. }
  48. return $data;
  49. }
  50. /*************************************************************************
  51. * Implements hook_views_handlers()
  52. * Purpose: Register all custom handlers with views
  53. * where a handler describes either "the type of field",
  54. * "how a field should be filtered", "how a field should be sorted"
  55. *
  56. * @return: An array of handler definitions
  57. */
  58. function tripal_genetic_views_handlers() {
  59. return array(
  60. 'info' => array(
  61. 'path' => drupal_get_path('module', 'tripal_genetic') . '/views/handlers',
  62. ),
  63. 'handlers' => array(
  64. ),
  65. );
  66. }