tripal_cv.module

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

Provides functions for managing chado controlled vocabularies which are used ubiquitously throughout chado.

File

legacy/tripal_cv/tripal_cv.module
View source
  1. <?php
  2. /**
  3. * @file
  4. * Provides functions for managing chado controlled vocabularies which are used ubiquitously
  5. * throughout chado.
  6. */
  7. /**
  8. * @defgroup tripal_legacy_cv Legacy Controlled Vocabulary Module
  9. * @ingroup tripal_legacy_modules
  10. * @{
  11. * Provides functions for managing chado controlled vocabularies which are used ubiquitously
  12. * throughout chado.
  13. * @}
  14. */
  15. require_once 'api/tripal_cv.DEPRECATED.inc';
  16. require_once 'api/tripal_cv.api.inc';
  17. require_once 'includes/tripal_cv.admin.inc';
  18. require_once 'includes/tripal_cv.cv_form.inc';
  19. require_once 'includes/tripal_cv.cv_defaults.inc';
  20. require_once 'includes/tripal_cv.cvterm_form.inc';
  21. /**
  22. * Implements hook_init().
  23. * Adds CSS and JS needed for this modules rendered content
  24. *
  25. * @ingroup tripal_legacy_cv
  26. */
  27. function tripal_cv_init() {
  28. }
  29. /**
  30. * Implements hook_menu().
  31. * Registers all menu items associated with this module
  32. *
  33. * @ingroup tripal_legacy_cv
  34. */
  35. function tripal_cv_menu() {
  36. $items = array();
  37. $items['admin/tripal/legacy/vocab'] = array(
  38. 'title' => 'Controlled Vocabularies',
  39. 'description' => 'Controlled Vocabularies control the types available for entities and fields.',
  40. 'page callback' => 'tripal_cv_admin_cv_listing',
  41. 'access arguments' => array('administer controlled vocabularies'),
  42. 'type' => MENU_NORMAL_ITEM,
  43. 'weight' => 2,
  44. );
  45. $items['admin/tripal/legacy/vocab/help'] = array(
  46. 'title' => 'Help',
  47. 'description' => "A description of the Tripal Controlled Vocabulary module including a short description of it's usage.",
  48. 'page callback' => 'theme',
  49. 'page arguments' => array('tripal_cv_admin'),
  50. 'access arguments' => array('administer controlled vocabularies'),
  51. 'type' => MENU_LOCAL_TASK,
  52. 'weight' => 10
  53. );
  54. $items['admin/tripal/legacy/vocab/cv/edit/%'] = array(
  55. 'title' => 'Edit a Controlled Vocabulary',
  56. 'description' => 'Edit the details such as name and description for an existing controlled vocabulary.',
  57. 'page callback' => 'drupal_get_form',
  58. 'page arguments' => array('tripal_cv_cv_edit_form', 6),
  59. 'access callback' => 'user_access',
  60. 'access arguments' => array('administer controlled vocabularies'),
  61. 'type' => MENU_CALLBACK,
  62. );
  63. $items['admin/tripal/legacy/vocab/cv/add'] = array(
  64. 'title' => 'Add a Controlled Vocabulary',
  65. 'description' => 'Manually a new controlled vocabulary.',
  66. 'page callback' => 'drupal_get_form',
  67. 'page arguments' => array('tripal_cv_cv_add_form'),
  68. 'access callback' => 'user_access',
  69. 'access arguments' => array('administer controlled vocabularies'),
  70. 'type' => MENU_CALLBACK,
  71. );
  72. $items['admin/tripal/legacy/vocab/cv/%/cvterm/add'] = array(
  73. 'title' => 'Add a Controlled Vocabulary Term',
  74. 'description' => 'Add a new controlled vocabulary term.',
  75. 'page callback' => 'drupal_get_form',
  76. 'page arguments' => array('tripal_cv_cvterm_add_form',5),
  77. 'access arguments' => array('administer controlled vocabularies'),
  78. 'type' => MENU_CALLBACK,
  79. );
  80. $items['admin/tripal/legacy/vocab/cvterm/add'] = array(
  81. 'title' => 'Add a Controlled Vocabulary Term',
  82. 'description' => 'Add a new controlled vocabulary term.',
  83. 'page callback' => 'drupal_get_form',
  84. 'page arguments' => array('tripal_cv_cvterm_add_form'),
  85. 'access arguments' => array('administer controlled vocabularies'),
  86. 'type' => MENU_CALLBACK,
  87. );
  88. $items['admin/tripal/legacy/vocab/cv/%/cvterm/edit/%'] = array(
  89. 'title' => 'Edit a Controlled Vocabulary Term',
  90. 'description' => 'Edit an existing controlled vocabulary term.',
  91. 'page callback' => 'drupal_get_form',
  92. 'page arguments' => array('tripal_cv_cvterm_edit_form',5,8),
  93. 'access arguments' => array('administer controlled vocabularies'),
  94. 'type' => MENU_CALLBACK,
  95. );
  96. $items['admin/tripal/legacy/vocab/cvterm/auto_name/%/%'] = array(
  97. 'page callback' => 'tripal_autocomplete_cvterm',
  98. 'page arguments' => array(6, 7),
  99. 'access arguments' => array('administer controlled vocabularies'),
  100. 'type' => MENU_CALLBACK,
  101. );
  102. $items['admin/tripal/legacy/vocab/views/cvs/enable'] = array(
  103. 'title' => 'Enable Vocabulary Administrative View',
  104. 'page callback' => 'tripal_enable_view',
  105. 'page arguments' => array('tripal_cv_admin_cvs', 'admin/tripal/vocab'),
  106. 'access arguments' => array('administer controlled vocabularies'),
  107. 'type' => MENU_CALLBACK,
  108. );
  109. $items['admin/tripal/legacy/vocab/views/cvterms/enable'] = array(
  110. 'title' => 'Enable Vocabulary Terms Administrative View',
  111. 'page callback' => 'tripal_enable_view',
  112. 'page arguments' => array('tripal_cv_admin_cvterms', 'admin/tripal/vocab'),
  113. 'access arguments' => array('administer controlled vocabularies'),
  114. 'type' => MENU_CALLBACK,
  115. );
  116. $items['admin/tripal/legacy/chado/tripal_cv/defaults'] = array(
  117. 'title' => 'Defaults',
  118. 'description' => 'Set the default vocabularies for properties and relationships.',
  119. 'page callback' => 'drupal_get_form',
  120. 'page arguments' => array('tripal_cv_admin_set_defaults_form'),
  121. 'access arguments' => array('administer controlled vocabularies'),
  122. 'type' => MENU_LOCAL_TASK,
  123. 'weight' => 5
  124. );
  125. $items['tripal_cv_chart'] = array(
  126. 'path' => 'tripal_cv_chart',
  127. 'page callback' => 'tripal_cv_chart',
  128. 'page arguments' => array(1),
  129. 'access arguments' => array('access content'),
  130. 'type' => MENU_CALLBACK
  131. );
  132. $items['cv_browser'] = array(
  133. 'page callback' => 'tripal_cv_show_browser',
  134. 'access arguments' => array('access content'),
  135. 'type' => MENU_CALLBACK
  136. );
  137. $items['tripal_cv_tree'] = array(
  138. 'path' => 'tripal_cv_tree',
  139. 'page callback' => 'tripal_cv_tree',
  140. 'page arguments' => array(1),
  141. 'access arguments' => array('access content'),
  142. 'type' => MENU_CALLBACK
  143. );
  144. $items['tripal_cv_init_browser'] = array(
  145. 'path' => 'tripal_cv_init_browser',
  146. 'page callback' => 'tripal_cv_init_browser',
  147. 'page arguments' => array(1),
  148. 'access arguments' => array('access content'),
  149. 'type' => MENU_CALLBACK
  150. );
  151. // menu item for interaction with the tree
  152. $items['tripal_cv_update_tree'] = array(
  153. 'path' => 'tripal_cv_update_tree',
  154. 'page callback' => 'tripal_cv_update_tree',
  155. 'page arguments' => array(2, 3),
  156. 'access arguments' => array('access content'),
  157. 'type' => MENU_CALLBACK
  158. );
  159. // menu items for working with terms
  160. $items['tripal_cv_cvterm_info'] = array(
  161. 'path' => 'tripal_cv_cvterm_info',
  162. 'title' => 'CV Term Viewer',
  163. 'page callback' => 'tripal_cv_cvterm_info',
  164. 'page arguments' => array(1),
  165. 'access arguments' => array('access content'),
  166. 'type' => MENU_CALLBACK
  167. );
  168. return $items;
  169. }
  170. /**
  171. * Implements hook_help().
  172. * Adds a help page to the module list
  173. */
  174. function tripal_cv_help ($path, $arg) {
  175. if ($path == 'admin/help#tripal_cv') {
  176. return theme('tripal_cv_help', array());
  177. }
  178. }
  179. /**
  180. * Implements hook_permission().
  181. *
  182. * Set the permission types that the chado module uses. Essentially we
  183. * want permissionis that protect creation, editing and deleting of chado
  184. * data objects
  185. *
  186. * @ingroup tripal_legacy_cv
  187. */
  188. function tripal_cv_permission() {
  189. return array(
  190. );
  191. }
  192. /**
  193. * Implements hook_views_api().
  194. * Essentially this hook tells drupal that there is views support for
  195. * for this module which then includes tripal_cv.views.inc where all the
  196. * views integration code is
  197. *
  198. * @ingroup tripal_legacy_cv
  199. */
  200. function tripal_cv_views_api() {
  201. return array('api' => 3.0);
  202. }
  203. /**
  204. * Implements hook_coder_ignore().
  205. * Defines the path to the file (tripal_cv.coder_ignores.txt) where ignore rules for coder are stored
  206. *
  207. * @ingroup tripal_legacy_cv
  208. */
  209. function tripal_cv_coder_ignore() {
  210. return array(
  211. 'path' => drupal_get_path('module', 'tripal_cv'),
  212. 'line prefix' => drupal_get_path('module', 'tripal_cv'),
  213. );
  214. }
  215. /**
  216. * Implements hook_form_alter().
  217. * Alter Forms
  218. *
  219. * @ingroup tripal_legacy_cv
  220. */
  221. function tripal_cv_form_alter(&$form, &$form_state, $form_id) {
  222. if ($form_id == "tripal_cv_cvterm_form") {
  223. // updating the form through the ahah callback sets the action of
  224. // the form to the ahah callback URL. We need to set it back
  225. // to the normal form URL
  226. if ($form_state['values']['form_action'] == 'edit') {
  227. $form['#action'] = url("admin/tripal/tripal_cv/cvterm/edit");
  228. }
  229. else {
  230. $form['#action'] = url("admin/tripal/tripal_cv/cvterm/add");
  231. }
  232. }
  233. }
  234. /**
  235. * Implements hook_theme().
  236. * We need to let drupal know about our theme functions and their arguments.
  237. * We create theme functions to allow users of the module to customize the
  238. * look and feel of the output generated in this module
  239. *
  240. * @ingroup tripal_legacy_cv
  241. */
  242. function tripal_cv_theme($existing, $type, $theme, $path) {
  243. $items = array(
  244. 'tripal_cv_help' => array(
  245. 'template' => 'tripal_cv_help',
  246. 'variables' => array(NULL),
  247. 'path' => "$path/theme/templates"
  248. ),
  249. 'tripal_cv_admin_set_defaults_form' => array(
  250. 'function' => 'theme_tripal_cv_admin_set_defaults_form',
  251. 'render element' => 'element',
  252. ),
  253. );
  254. return $items;
  255. }