tripal_analysis.module

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

Contains basic functionality for the analysis module.

File

tripal_analysis/tripal_analysis.module
View source
  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.delete.inc';
  12. require_once 'includes/tripal_analysis_privacy.inc';
  13. require_once 'includes/tripal_analysis.admin.inc';
  14. require_once 'includes/tripal_analysis.chado_node.inc';
  15. /**
  16. * @defgroup tripal_analysis Analysis Module
  17. * @ingroup tripal_modules
  18. * @{
  19. * Integrates the Chado Analysis module with Drupal Nodes & Views
  20. * @}
  21. */
  22. /**
  23. * Implements hook_init().
  24. * Add tripal javascript to page headers
  25. *
  26. * @ingroup tripal_analysis
  27. */
  28. function tripal_analysis_init() {
  29. }
  30. /**
  31. * Implementation of hook_menu().
  32. * Entry points and paths of the module
  33. *
  34. * @ingroup tripal_analysis
  35. */
  36. function tripal_analysis_menu() {
  37. // Tripal Analysis administrative settings
  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. return $items;
  95. }
  96. /**
  97. * Implements hook_search_biological_data_views().
  98. *
  99. * Adds the described views to the "Search Data" Page created by Tripal Views
  100. */
  101. function tripal_analysis_search_biological_data_views() {
  102. return array(
  103. 'tripal_analysis_user_analyses' => array(
  104. 'machine_name' => 'tripal_analysis_user_analyses',
  105. 'human_name' => 'Analyses',
  106. 'description' => 'Bioinformatics analyses which often produces features.',
  107. 'link' => 'chado/analysis'
  108. ),
  109. );
  110. }
  111. /**
  112. * Implements hook_help().
  113. * Purpose: Adds a help page to the module list
  114. *
  115. * @ingroup tripal_analysis
  116. */
  117. function tripal_analysis_help ($path, $arg) {
  118. if ($path == 'admin/help#tripal_analysis') {
  119. return theme('tripal_analysis_help', array());
  120. }
  121. }
  122. /**
  123. * Implements hook_permission().
  124. *
  125. * Set the permission types that the chado module uses. Essentially we
  126. * want permissionis that protect creation, editing and deleting of chado
  127. * data objects
  128. *
  129. * @ingroup tripal_analysis
  130. */
  131. function tripal_analysis_permission() {
  132. return array(
  133. 'access chado_analysis content' => array(
  134. 'title' => t('View Analyses'),
  135. 'description' => t('Allow users to view analysis pages.'),
  136. ),
  137. 'create chado_analysis content' => array(
  138. 'title' => t('Create Analyses'),
  139. 'description' => t('Allow users to create new analysis pages.'),
  140. ),
  141. 'delete chado_analysis content' => array(
  142. 'title' => t('Delete Analyses'),
  143. 'description' => t('Allow users to delete analysis pages.'),
  144. ),
  145. 'edit chado_analysis content' => array(
  146. 'title' => t('Edit Analyses'),
  147. 'description' => t('Allow users to edit analysis pages.'),
  148. ),
  149. 'administer tripal analysis' => array(
  150. 'title' => t('Administer Analyses'),
  151. 'description' => t('Allow users to administer all analyses.'),
  152. ),
  153. );
  154. }
  155. /**
  156. * We need to let drupal know about our theme functions and their arguments.
  157. * We create theme functions to allow users of the module to customize the
  158. * look and feel of the output generated in this module
  159. *
  160. * @ingroup tripal_analysis
  161. */
  162. function tripal_analysis_theme($existing, $type, $theme, $path) {
  163. $core_path = drupal_get_path('module', 'tripal_core');
  164. $items = array(
  165. 'node__chado_analysis' => array(
  166. 'template' => 'node--chado-generic',
  167. 'render element' => 'node',
  168. 'base hook' => 'node',
  169. 'path' => "$core_path/theme/templates",
  170. ),
  171. 'tripal_analysis_base' => array(
  172. 'variables' => array('node' => NULL),
  173. 'template' => 'tripal_analysis_base',
  174. 'path' => "$path/theme/templates",
  175. ),
  176. 'tripal_analysis_properties' => array(
  177. 'variables' => array('node' => NULL),
  178. 'template' => 'tripal_analysis_properties',
  179. 'path' => "$path/theme/templates",
  180. ),
  181. 'tripal_analysis_teaser' => array(
  182. 'variables' => array('node' => NULL),
  183. 'template' => 'tripal_analysis_teaser',
  184. 'path' => "$path/theme/templates",
  185. ),
  186. 'tripal_analysis_help' => array(
  187. 'template' => 'tripal_analysis_help',
  188. 'variables' => array(NULL),
  189. 'path' => "$path/theme/templates",
  190. ),
  191. // tripal_feature theme
  192. 'tripal_feature_analyses' => array(
  193. 'template' => 'tripal_feature_analyses',
  194. 'variables' => array('node' => NULL),
  195. 'path' => "$path/theme/templates",
  196. ),
  197. );
  198. return $items;
  199. }
  200. /**
  201. * Implements hook_views_api().
  202. * Essentially this hook tells drupal that there is views support for
  203. * for this module which then includes tripal_analysis.views.inc where all the
  204. * views integration code is
  205. *
  206. * @ingroup tripal_analysis
  207. */
  208. function tripal_analysis_views_api() {
  209. return array(
  210. 'api' => 3.0,
  211. );
  212. }
  213. /**
  214. * Implementation of hook_form_alter().
  215. *
  216. * @ingroup tripal_analysis
  217. */
  218. function tripal_analysis_form_alter(&$form, &$form_state, $form_id) {
  219. // turn of preview button for insert/updates
  220. if ($form_id == "chado_analysis_node_form") {
  221. $form['actions']['preview']['#access'] = FALSE;
  222. //remove the body field
  223. unset($form['body']);
  224. }
  225. }

Related topics