tripal_analysis.module 7.4 KB

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