Tripal v1.0 (6.x-1.0)
tripal_library.views.inc File Reference

Go to the source code of this file.

Functions

 tripal_library_views_data ()
 tripal_library_views_handlers ()
 tripal_library_views_data_alter (&$data)
 tripal_library_views_default_views ()

Detailed Description

This file contains the basic functions for views integration of chado/tripal organism tables. Supplementary functions can be found in ./views/

Documentation on views integration can be found at http://views2.logrus.com/doc/html/index.html.

Definition in file tripal_library.views.inc.


Function Documentation

tripal_library_views_data ( )

Definition at line 29 of file tripal_library.views.inc.

                                      {
  $data = array();

  if (module_exists('tripal_views')) {
    $tables = array(
      'library'
    );
    foreach ($tables as $tablename) {
      $priority = 9;

      // check to see if the table is integrated. If it is then integrate it's
      // corresponding 'chado_[table]' table.
      if (!tripal_views_is_integrated($tablename, $priority)) {
        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);

        // Add in node relationships if chado is in the same db as drupal
        if (tripal_core_chado_schema_exists()) {
          $integrations = tripal_views_add_node_relationship_to_chado_table_integration($table_integration_array);
          foreach ($integrations as $integration) {
            tripal_views_integration_add_entry($integration);
          }
        }
        else {
          tripal_views_integration_add_entry($table_integration_array);
        }

      }
    }

    $tables = array(
      'library_cvterm',
      'library_feature',
      'library_pub',
      'library_synonym',
      'libraryprop'
    );
    foreach ($tables as $tablename) {
      $priority = 9;
      if (!tripal_views_is_integrated($tablename, $priority)) {
        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
        tripal_views_integration_add_entry($table_integration_array);
      }
    }
  }

  return $data;
}
tripal_library_views_data_alter ( &$  data)

Implementation of hook_views_data_alter().

Definition at line 102 of file tripal_library.views.inc.

                                                 {

  if ( !(is_array($db_url) and array_key_exists('chado', $db_url)) ) {

    // Add featuer relationship to node
    $data['node']['library_chado_nid'] = array(
      'group' => 'Library',
      'title' => 'Library Node',
      'help' => 'Links Chado Library Fields/Data to the Nodes in the current View.',
      'real field' => 'nid',
      'relationship' => array(
        'handler' => 'views_handler_relationship',
        'title' => t('Node => Chado'),
        'label' => t('Node => Chado'),
        'real field' => 'nid',
        'base' => 'chado_library',
        'base field' => 'nid'
      ),
    );
  }

}
tripal_library_views_handlers ( )

Definition at line 86 of file tripal_library.views.inc.

                                         {
  return array(
   'info' => array(
     'path' => drupal_get_path('module', 'tripal_library') . '/views/handlers',
      ),
   'handlers' => array(
     'views_handler_field_computed_library_nid' => array(
       'parent' => 'views_handler_field_numeric',
      ),
    ),
  );
}
 All Classes Files Functions Variables