tripal_cv.module
Provides functions for managing chado controlled vocabularies which are used ubiquitously throughout chado.
File
legacy/tripal_cv/tripal_cv.moduleView source
- <?php
- /**
- * @file
- * Provides functions for managing chado controlled vocabularies which are used ubiquitously
- * throughout chado.
- */
-
- /**
- * @defgroup tripal_legacy_cv Legacy Controlled Vocabulary Module
- * @ingroup tripal_legacy_modules
- * @{
- * Provides functions for managing chado controlled vocabularies which are used ubiquitously
- * throughout chado.
- * @}
- */
-
- require_once 'api/tripal_cv.DEPRECATED.inc';
- require_once 'api/tripal_cv.api.inc';
- require_once 'includes/tripal_cv.admin.inc';
- require_once 'includes/tripal_cv.cv_form.inc';
- require_once 'includes/tripal_cv.cv_defaults.inc';
- require_once 'includes/tripal_cv.cvterm_form.inc';
-
- /**
- * Implements hook_init().
- * Adds CSS and JS needed for this modules rendered content
- *
- * @ingroup tripal_legacy_cv
- */
- function tripal_cv_init() {
-
- }
-
- /**
- * Implements hook_menu().
- * Registers all menu items associated with this module
- *
- * @ingroup tripal_legacy_cv
- */
- function tripal_cv_menu() {
- $items = array();
-
- $items['admin/tripal/legacy/vocab'] = array(
- 'title' => 'Controlled Vocabularies',
- 'description' => 'Controlled Vocabularies control the types available for entities and fields.',
- 'page callback' => 'tripal_cv_admin_cv_listing',
- 'access arguments' => array('administer controlled vocabularies'),
- 'type' => MENU_NORMAL_ITEM,
- 'weight' => 2,
- );
-
-
- $items['admin/tripal/legacy/vocab/help'] = array(
- 'title' => 'Help',
- 'description' => "A description of the Tripal Controlled Vocabulary module including a short description of it's usage.",
- 'page callback' => 'theme',
- 'page arguments' => array('tripal_cv_admin'),
- 'access arguments' => array('administer controlled vocabularies'),
- 'type' => MENU_LOCAL_TASK,
- 'weight' => 10
- );
-
- $items['admin/tripal/legacy/vocab/cv/edit/%'] = array(
- 'title' => 'Edit a Controlled Vocabulary',
- 'description' => 'Edit the details such as name and description for an existing controlled vocabulary.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_cv_cv_edit_form', 6),
- 'access callback' => 'user_access',
- 'access arguments' => array('administer controlled vocabularies'),
- 'type' => MENU_CALLBACK,
- );
-
- $items['admin/tripal/legacy/vocab/cv/add'] = array(
- 'title' => 'Add a Controlled Vocabulary',
- 'description' => 'Manually a new controlled vocabulary.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_cv_cv_add_form'),
- 'access callback' => 'user_access',
- 'access arguments' => array('administer controlled vocabularies'),
- 'type' => MENU_CALLBACK,
- );
-
- $items['admin/tripal/legacy/vocab/cv/%/cvterm/add'] = array(
- 'title' => 'Add a Controlled Vocabulary Term',
- 'description' => 'Add a new controlled vocabulary term.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_cv_cvterm_add_form',5),
- 'access arguments' => array('administer controlled vocabularies'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/legacy/vocab/cvterm/add'] = array(
- 'title' => 'Add a Controlled Vocabulary Term',
- 'description' => 'Add a new controlled vocabulary term.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_cv_cvterm_add_form'),
- 'access arguments' => array('administer controlled vocabularies'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/legacy/vocab/cv/%/cvterm/edit/%'] = array(
- 'title' => 'Edit a Controlled Vocabulary Term',
- 'description' => 'Edit an existing controlled vocabulary term.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_cv_cvterm_edit_form',5,8),
- 'access arguments' => array('administer controlled vocabularies'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/legacy/vocab/cvterm/auto_name/%/%'] = array(
- 'page callback' => 'tripal_autocomplete_cvterm',
- 'page arguments' => array(6, 7),
- 'access arguments' => array('administer controlled vocabularies'),
- 'type' => MENU_CALLBACK,
- );
-
- $items['admin/tripal/legacy/vocab/views/cvs/enable'] = array(
- 'title' => 'Enable Vocabulary Administrative View',
- 'page callback' => 'tripal_enable_view',
- 'page arguments' => array('tripal_cv_admin_cvs', 'admin/tripal/vocab'),
- 'access arguments' => array('administer controlled vocabularies'),
- 'type' => MENU_CALLBACK,
- );
- $items['admin/tripal/legacy/vocab/views/cvterms/enable'] = array(
- 'title' => 'Enable Vocabulary Terms Administrative View',
- 'page callback' => 'tripal_enable_view',
- 'page arguments' => array('tripal_cv_admin_cvterms', 'admin/tripal/vocab'),
- 'access arguments' => array('administer controlled vocabularies'),
- 'type' => MENU_CALLBACK,
- );
-
- $items['admin/tripal/legacy/chado/tripal_cv/defaults'] = array(
- 'title' => 'Defaults',
- 'description' => 'Set the default vocabularies for properties and relationships.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_cv_admin_set_defaults_form'),
- 'access arguments' => array('administer controlled vocabularies'),
- 'type' => MENU_LOCAL_TASK,
- 'weight' => 5
- );
-
- $items['tripal_cv_chart'] = array(
- 'path' => 'tripal_cv_chart',
- 'page callback' => 'tripal_cv_chart',
- 'page arguments' => array(1),
- 'access arguments' => array('access content'),
- 'type' => MENU_CALLBACK
- );
-
- $items['cv_browser'] = array(
- 'page callback' => 'tripal_cv_show_browser',
- 'access arguments' => array('access content'),
- 'type' => MENU_CALLBACK
- );
-
- $items['tripal_cv_tree'] = array(
- 'path' => 'tripal_cv_tree',
- 'page callback' => 'tripal_cv_tree',
- 'page arguments' => array(1),
- 'access arguments' => array('access content'),
- 'type' => MENU_CALLBACK
- );
-
- $items['tripal_cv_init_browser'] = array(
- 'path' => 'tripal_cv_init_browser',
- 'page callback' => 'tripal_cv_init_browser',
- 'page arguments' => array(1),
- 'access arguments' => array('access content'),
- 'type' => MENU_CALLBACK
- );
-
- // menu item for interaction with the tree
- $items['tripal_cv_update_tree'] = array(
- 'path' => 'tripal_cv_update_tree',
- 'page callback' => 'tripal_cv_update_tree',
- 'page arguments' => array(2, 3),
- 'access arguments' => array('access content'),
- 'type' => MENU_CALLBACK
- );
-
- // menu items for working with terms
- $items['tripal_cv_cvterm_info'] = array(
- 'path' => 'tripal_cv_cvterm_info',
- 'title' => 'CV Term Viewer',
- 'page callback' => 'tripal_cv_cvterm_info',
- 'page arguments' => array(1),
- 'access arguments' => array('access content'),
- 'type' => MENU_CALLBACK
- );
-
- return $items;
- }
-
- /**
- * Implements hook_help().
- * Adds a help page to the module list
- */
- function tripal_cv_help ($path, $arg) {
- if ($path == 'admin/help#tripal_cv') {
- return theme('tripal_cv_help', array());
- }
- }
-
- /**
- * Implements hook_permission().
- *
- * Set the permission types that the chado module uses. Essentially we
- * want permissionis that protect creation, editing and deleting of chado
- * data objects
- *
- * @ingroup tripal_legacy_cv
- */
- function tripal_cv_permission() {
- return array(
-
- );
- }
-
- /**
- * Implements hook_views_api().
- * Essentially this hook tells drupal that there is views support for
- * for this module which then includes tripal_cv.views.inc where all the
- * views integration code is
- *
- * @ingroup tripal_legacy_cv
- */
- function tripal_cv_views_api() {
- return array('api' => 3.0);
- }
-
- /**
- * Implements hook_coder_ignore().
- * Defines the path to the file (tripal_cv.coder_ignores.txt) where ignore rules for coder are stored
- *
- * @ingroup tripal_legacy_cv
- */
- function tripal_cv_coder_ignore() {
- return array(
- 'path' => drupal_get_path('module', 'tripal_cv'),
- 'line prefix' => drupal_get_path('module', 'tripal_cv'),
- );
- }
-
- /**
- * Implements hook_form_alter().
- * Alter Forms
- *
- * @ingroup tripal_legacy_cv
- */
- function tripal_cv_form_alter(&$form, &$form_state, $form_id) {
- if ($form_id == "tripal_cv_cvterm_form") {
- // updating the form through the ahah callback sets the action of
- // the form to the ahah callback URL. We need to set it back
- // to the normal form URL
- if ($form_state['values']['form_action'] == 'edit') {
- $form['#action'] = url("admin/tripal/tripal_cv/cvterm/edit");
- }
- else {
- $form['#action'] = url("admin/tripal/tripal_cv/cvterm/add");
- }
- }
- }
-
- /**
- * Implements hook_theme().
- * We need to let drupal know about our theme functions and their arguments.
- * We create theme functions to allow users of the module to customize the
- * look and feel of the output generated in this module
- *
- * @ingroup tripal_legacy_cv
- */
- function tripal_cv_theme($existing, $type, $theme, $path) {
-
- $items = array(
- 'tripal_cv_help' => array(
- 'template' => 'tripal_cv_help',
- 'variables' => array(NULL),
- 'path' => "$path/theme/templates"
- ),
- 'tripal_cv_admin_set_defaults_form' => array(
- 'function' => 'theme_tripal_cv_admin_set_defaults_form',
- 'render element' => 'element',
- ),
- );
-
- return $items;
- }