tripal_phylogeny.module

  1. 2.x tripal_phylogeny/tripal_phylogeny.module
  2. 3.x legacy/tripal_phylogeny/tripal_phylogeny.module

Integrates the Chado Phylotree module with Drupal Nodes & Views

File

legacy/tripal_phylogeny/tripal_phylogeny.module
View source
  1. <?php
  2. /**
  3. * @file
  4. * Integrates the Chado Phylotree module with Drupal Nodes & Views
  5. */
  6. /**
  7. * @defgroup tripal_legacy_phylogeny Legacy Phylotree Module
  8. * @ingroup tripal_legacy_modules
  9. * @{
  10. * Integrates the Chado Phylotree module with Drupal Nodes
  11. * @}
  12. */
  13. require_once 'api/tripal_phylogeny.api.inc';
  14. require_once 'theme/tripal_phylogeny.theme.inc';
  15. require_once 'includes/tripal_phylogeny.admin.inc';
  16. require_once 'includes/tripal_phylogeny.chado_node.inc';
  17. require_once 'includes/tripal_phylogeny.import_tree.inc';
  18. require_once 'includes/tripal_phylogeny.taxonomy.inc';
  19. /**
  20. * Implements hook_permission().
  21. *
  22. * Set the permission types that the chado module uses. Essentially we
  23. * want permissionis that protect creation, editing and deleting of chado
  24. * data objects
  25. *
  26. * @ingroup tripal_legacy_phylogeny
  27. */
  28. function tripal_phylogeny_permission() {
  29. return array(
  30. 'access chado_phylotree content' => array(
  31. 'title' => t('View Phylotrees'),
  32. 'description' => t('Allow users to view phylotree pages.'),
  33. ),
  34. 'administer tripal phylotree' => array(
  35. 'title' => t('Administer Phylotrees'),
  36. 'description' => t('Allow users to administer all phylotrees.'),
  37. ),
  38. );
  39. }
  40. /**
  41. * Implements hook_menu().
  42. *
  43. * Menu items are automatically added for the new node types created
  44. * by this module to the 'Create Content' Navigation menu item. This function
  45. * adds more menu items needed for this module.
  46. *
  47. * @ingroup tripal_legacy_phylogeny
  48. */
  49. function tripal_phylogeny_menu() {
  50. $items = array();
  51. $items['taxonomy_view'] = array(
  52. 'title' => 'Taxonomy',
  53. 'description' => 'Taxonomic view of the species available on this site.',
  54. 'page callback' => 'tripal_phylogeny_taxonomy_view',
  55. 'access arguments' => array('access taxonomy content'),
  56. 'file' => '/includes/tripal_phylogeny.taxonomy.inc',
  57. 'type' => MENU_NORMAL_ITEM,
  58. );
  59. // administration landing page. currently has no content but is
  60. // apparently required for the Sync and Help links to work.
  61. $items['admin/tripal/legacy/tripal_phylogeny'] = array(
  62. 'title' => 'Phylogeny and Taxonomy',
  63. 'description' => 'Phylogenetic and taxonomic trees.',
  64. 'page callback' => 'tripal_phylogeny_admin_phylotrees_listing',
  65. 'access arguments' => array('administer tripal phylotree'),
  66. 'type' => MENU_NORMAL_ITEM,
  67. );
  68. // help menu
  69. $items['admin/tripal/legacy/tripal_phylogeny/help'] = array(
  70. 'title' => 'Help',
  71. 'description' => 'Basic Description of Tripal Phylotree Module Functionality',
  72. 'page callback' => 'theme',
  73. 'page arguments' => array('tripal_phylogeny_help'),
  74. 'access arguments' => array('administer tripal phylotree'),
  75. 'type' => MENU_LOCAL_TASK,
  76. 'weight' => 10
  77. );
  78. // configuration menu item
  79. $items['admin/tripal/legacy/tripal_phylogeny/configuration'] = array(
  80. 'title' => 'Settings',
  81. 'description' => 'Configure the Tripal Phylotree module',
  82. 'page callback' => 'drupal_get_form',
  83. 'page arguments' => array('tripal_phylogeny_admin'),
  84. 'access arguments' => array('administer tripal phylotree'),
  85. 'type' => MENU_LOCAL_TASK,
  86. 'weight' => 1
  87. );
  88. // sync menu item (will be rendered as a tab by tripal)
  89. $items['admin/tripal/legacy/tripal_phylogeny/sync'] = array(
  90. 'title' => ' Sync',
  91. 'description' => 'Create pages on this site for phylotrees stored in Chado',
  92. 'page callback' => 'drupal_get_form',
  93. 'page arguments' => array('chado_node_sync_form', 'tripal_phylogeny', 'chado_phylotree'),
  94. 'access arguments' => array('administer tripal phylotree'),
  95. 'type' => MENU_LOCAL_TASK,
  96. 'weight' => 3
  97. );
  98. // Enable admin view
  99. $items['admin/tripal/legacy/tripal_phylogeny/views/phylotree/enable'] = array(
  100. 'title' => 'Enable Phylotree Administrative View',
  101. 'page callback' => 'tripal_enable_view',
  102. 'page arguments' => array('tripal_phylogeny_admin_phylotree', 'admin/tripal/legacy/tripal_phylogeny'),
  103. 'access arguments' => array('administer tripal phylotree'),
  104. 'type' => MENU_CALLBACK,
  105. );
  106. // create a route for viewing json of all phylonodes having this phylotree_id
  107. $items['ajax/chado_phylotree/%/json'] = array(
  108. 'page callback' => 'tripal_phylogeny_ajax_get_tree_json',
  109. 'page arguments' => array(2),
  110. // allow all anonymous http clients
  111. 'access callback' => TRUE
  112. );
  113. return $items;
  114. }
  115. /**
  116. * Implements hook_search_biological_data_views().
  117. *
  118. * Adds the described views to the "Search Data" Page created by Tripal Views
  119. */
  120. function tripal_phylogeny_search_biological_data_views() {
  121. return array(
  122. 'tripal_phylogeny_user_phylotree' => array(
  123. 'machine_name' => 'tripal_phylogeny_user_phylotree',
  124. 'human_name' => 'Phylogenetic Trees',
  125. 'description' => 'Gene trees, species trees, etc.',
  126. 'link' => 'chado/phylotree'
  127. ),
  128. );
  129. }
  130. /**
  131. * Implements hook_views_api().
  132. *
  133. * Essentially this hook tells drupal that there is views support for
  134. * for this module which then includes tripal_db.views.inc where all the
  135. * views integration code is
  136. *
  137. * @ingroup tripal_legacy_phylogeny
  138. */
  139. function tripal_phylogeny_views_api() {
  140. return array(
  141. 'api' => 3.0,
  142. );
  143. }
  144. /**
  145. * Implements hook_theme().
  146. *
  147. * We need to let drupal know about our theme functions and their arguments.
  148. * We create theme functions to allow users of the module to customize the
  149. * look and feel of the output generated in this module
  150. *
  151. * @ingroup tripal_legacy_phylogeny
  152. */
  153. function tripal_phylogeny_theme($existing, $type, $theme, $path) {
  154. $core_path = drupal_get_path('module', 'tripal_core');
  155. $items = array(
  156. // built-in theme
  157. 'node__chado_phylotree' => array(
  158. 'template' => 'node--chado-generic',
  159. 'render element' => 'node',
  160. 'base hook' => 'node',
  161. 'path' => "$core_path/theme/templates",
  162. ),
  163. // base template for this page (default tab) includes the phylogram
  164. 'tripal_phylogeny_base' => array(
  165. 'variables' => array('node' => NULL),
  166. 'template' => 'tripal_phylogeny_base',
  167. 'path' => "$path/theme/templates",
  168. ),
  169. // Template for the phylogram.
  170. 'tripal_phylogeny_phylogram' => array(
  171. 'variables' => array('node' => NULL),
  172. 'template' => 'tripal_phylogeny_phylogram',
  173. 'path' => "$path/theme/templates",
  174. ),
  175. // Template for the taxonomic tree.
  176. 'tripal_phylogeny_taxonomic_tree' => array(
  177. 'variables' => array('node' => NULL),
  178. 'template' => 'tripal_phylogeny_taxonomic_tree',
  179. 'path' => "$path/theme/templates",
  180. ),
  181. // partial for organisms block
  182. 'tripal_phylogeny_organisms' => array(
  183. 'variables' => array('node' => NULL),
  184. 'template' => 'tripal_phylogeny_organisms',
  185. 'path' => "$path/theme/templates",
  186. ),
  187. // partial for cross references block
  188. 'tripal_phylogeny_references' => array(
  189. 'variables' => array('node' => NULL),
  190. 'template' => 'tripal_phylogeny_references',
  191. 'path' => "$path/theme/templates",
  192. ),
  193. // partial for cross references block
  194. 'tripal_phylogeny_analysis' => array(
  195. 'variables' => array('node' => NULL),
  196. 'template' => 'tripal_phylogeny_analysis',
  197. 'path' => "$path/theme/templates",
  198. ),
  199. // partial for teaser view
  200. 'tripal_phylogeny_teaser' => array(
  201. 'variables' => array('node' => NULL),
  202. 'template' => 'tripal_phylogeny_teaser',
  203. 'path' => "$path/theme/templates",
  204. ),
  205. // FORM THEMES
  206. // Theme function for the project table in admin projects form
  207. 'tripal_phylogeny_admin_org_color_tables' => array(
  208. 'render element' => 'element',
  209. )
  210. );
  211. return $items;
  212. }
  213. /**
  214. * Implements hook_help().
  215. * Adds a help page to the module list
  216. *
  217. * @ingroup tripal_legacy_phylogeny
  218. */
  219. function tripal_phylogeny_help ($path, $arg) {
  220. if ($path == 'admin/help#tripal_phylogeny') {
  221. return theme('tripal_phylogeny_help', array());
  222. }
  223. }