tripal_analysis.module 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <?php
  2. /**
  3. * @file
  4. * Contains basic functionality for the analysis module.
  5. *
  6. * @ingroup tripal_analysis
  7. */
  8. require_once 'api/tripal_analysis.api.inc';
  9. require_once 'api/tripal_analysis.schema.api.inc';
  10. require_once 'api/tripal_analysis.DEPRECATED.inc';
  11. require_once 'includes/tripal_analysis_privacy.inc';
  12. require_once 'includes/tripal_analysis.admin.inc';
  13. require_once 'includes/tripal_analysis.chado_node.inc';
  14. /**
  15. * @defgroup tripal_analysis Analysis Module
  16. * @ingroup tripal_modules
  17. * @{
  18. * Integrates the Chado Analysis module with Drupal Nodes & Views
  19. * @}
  20. */
  21. /**
  22. * Implements hook_init().
  23. * Add tripal javascript to page headers
  24. *
  25. * @ingroup tripal_analysis
  26. */
  27. function tripal_analysis_init() {
  28. }
  29. /**
  30. * Implementation of hook_menu().
  31. * Entry points and paths of the module
  32. *
  33. * @ingroup tripal_analysis
  34. */
  35. function tripal_analysis_menu() {
  36. // Tripal Analysis administrative settings
  37. $items['admin/tripal/chado/tripal_analysis'] = array(
  38. 'title' => 'Analyses',
  39. 'description' => 'A bioinformatics analysis producing features.',
  40. 'page callback' => 'tripal_analysis_admin_analysis_view',
  41. 'access arguments' => array('administer tripal analysis'),
  42. 'type' => MENU_NORMAL_ITEM,
  43. );
  44. $items['admin/tripal/chado/tripal_analysis/help'] = array(
  45. 'title' => 'Help',
  46. 'description' => "A description of the Tripal Analysis module including a short description of it's usage.",
  47. 'page callback' => 'theme',
  48. 'page arguments' => array('tripal_analysis_help'),
  49. 'access arguments' => array('administer tripal analysis'),
  50. 'type' => MENU_LOCAL_TASK,
  51. 'weight' => 10,
  52. );
  53. $items['admin/tripal/chado/tripal_analysis/configuration'] = array(
  54. 'title' => 'Settings',
  55. 'description' => 'Settings for the displays of analysis results.',
  56. 'page callback' => 'drupal_get_form',
  57. 'page arguments' => array('tripal_analysis_admin'),
  58. 'access arguments' => array('administer tripal analysis'),
  59. 'type' => MENU_LOCAL_TASK,
  60. 'weight' => 5
  61. );
  62. $items['admin/tripal/chado/tripal_analysis/sync'] = array(
  63. 'title' => ' Sync',
  64. 'description' => 'Create pages on this site for analyses stored in Chado',
  65. 'page callback' => 'drupal_get_form',
  66. 'page arguments' => array('chado_node_sync_form', 'tripal_analysis', 'chado_analysis'),
  67. 'access arguments' => array('administer tripal analysis'),
  68. 'type' => MENU_LOCAL_TASK,
  69. 'weight' => 2
  70. );
  71. $items['admin/tripal/chado/tripal_analysis/chado_analysis_toc'] = array(
  72. 'title' => ' TOC',
  73. 'description' => 'Manage the table of contents for analysis nodes.',
  74. 'page callback' => 'drupal_get_form',
  75. 'page arguments' => array('tripal_core_content_type_toc_form', 'chado_analysis'),
  76. 'access arguments' => array('administer tripal analysis'),
  77. 'type' => MENU_LOCAL_TASK,
  78. 'file' => 'includes/tripal_core.toc.inc',
  79. 'file path' => drupal_get_path('module', 'tripal_core'),
  80. 'weight' => 3
  81. );
  82. return $items;
  83. }
  84. /**
  85. * Implements hook_search_biological_data_views().
  86. *
  87. * Adds the described views to the "Search Data" Page created by Tripal Views
  88. */
  89. function tripal_analysis_search_biological_data_views() {
  90. return array(
  91. 'tripal_analysis_user_analyses' => array(
  92. 'machine_name' => 'tripal_analysis_user_analyses',
  93. 'human_name' => 'Analyses',
  94. 'description' => 'Bioinformatics analyses which often produces features.',
  95. 'link' => 'chado/analysis'
  96. ),
  97. );
  98. }
  99. /**
  100. * Implements hook_help().
  101. * Purpose: Adds a help page to the module list
  102. *
  103. * @ingroup tripal_analysis
  104. */
  105. function tripal_analysis_help ($path, $arg) {
  106. if ($path == 'admin/help#tripal_analysis') {
  107. return theme('tripal_analysis_help', array());
  108. }
  109. }
  110. /**
  111. * Implements hook_permission().
  112. *
  113. * Set the permission types that the chado module uses. Essentially we
  114. * want permissionis that protect creation, editing and deleting of chado
  115. * data objects
  116. *
  117. * @ingroup tripal_analysis
  118. */
  119. function tripal_analysis_permission() {
  120. return array(
  121. 'access chado_analysis content' => array(
  122. 'title' => t('View Analyses'),
  123. 'description' => t('Allow users to view analysis pages.'),
  124. ),
  125. 'create chado_analysis content' => array(
  126. 'title' => t('Create Analyses'),
  127. 'description' => t('Allow users to create new analysis pages.'),
  128. ),
  129. 'delete chado_analysis content' => array(
  130. 'title' => t('Delete Analyses'),
  131. 'description' => t('Allow users to delete analysis pages.'),
  132. ),
  133. 'edit chado_analysis content' => array(
  134. 'title' => t('Edit Analyses'),
  135. 'description' => t('Allow users to edit analysis pages.'),
  136. ),
  137. 'administer tripal analysis' => array(
  138. 'title' => t('Administer Analyses'),
  139. 'description' => t('Allow users to administer all analyses.'),
  140. ),
  141. );
  142. }
  143. /**
  144. * We need to let drupal know about our theme functions and their arguments.
  145. * We create theme functions to allow users of the module to customize the
  146. * look and feel of the output generated in this module
  147. *
  148. * @ingroup tripal_analysis
  149. */
  150. function tripal_analysis_theme($existing, $type, $theme, $path) {
  151. $core_path = drupal_get_path('module', 'tripal_core');
  152. $items = array(
  153. 'node__chado_analysis' => array(
  154. 'template' => 'node--chado-generic',
  155. 'render element' => 'node',
  156. 'base hook' => 'node',
  157. 'path' => "$core_path/theme/templates",
  158. ),
  159. 'tripal_analysis_base' => array(
  160. 'variables' => array('node' => NULL),
  161. 'template' => 'tripal_analysis_base',
  162. 'path' => "$path/theme/templates",
  163. ),
  164. 'tripal_analysis_properties' => array(
  165. 'variables' => array('node' => NULL),
  166. 'template' => 'tripal_analysis_properties',
  167. 'path' => "$path/theme/templates",
  168. ),
  169. 'tripal_analysis_teaser' => array(
  170. 'variables' => array('node' => NULL),
  171. 'template' => 'tripal_analysis_teaser',
  172. 'path' => "$path/theme/templates",
  173. ),
  174. 'tripal_analysis_help' => array(
  175. 'template' => 'tripal_analysis_help',
  176. 'variables' => array(NULL),
  177. 'path' => "$path/theme/templates",
  178. ),
  179. // tripal_feature theme
  180. 'tripal_feature_analyses' => array(
  181. 'template' => 'tripal_feature_analyses',
  182. 'variables' => array('node' => NULL),
  183. 'path' => "$path/theme/templates",
  184. ),
  185. );
  186. return $items;
  187. }
  188. /**
  189. * Implements hook_views_api().
  190. * Essentially this hook tells drupal that there is views support for
  191. * for this module which then includes tripal_analysis.views.inc where all the
  192. * views integration code is
  193. *
  194. * @ingroup tripal_analysis
  195. */
  196. function tripal_analysis_views_api() {
  197. return array(
  198. 'api' => 3.0,
  199. );
  200. }
  201. /**
  202. * Implementation of hook_form_alter().
  203. *
  204. * @ingroup tripal_analysis
  205. */
  206. function tripal_analysis_form_alter(&$form, &$form_state, $form_id) {
  207. // turn of preview button for insert/updates
  208. if ($form_id == "chado_analysis_node_form") {
  209. $form['actions']['preview']['#access'] = FALSE;
  210. //remove the body field
  211. unset($form['body']);
  212. }
  213. }