|
Tripal 0.3b
|
00001 <?php 00002 00003 /** 00004 * Purpose: this function returns the portion of the data array 00005 * which describes the chado_library drupal table, it's fields and any joins between it and other tables 00006 * @see tripal_library_views_data() --in tripal_library.views.inc 00007 * 00008 * The main need for description of this table to views is to join chado data with drupal nodes 00009 * 00010 * @ingroup tripal_library_views 00011 */ 00012 function retrieve_chado_library_views_data () { 00013 global $db_url; 00014 $data = array(); 00015 00016 // if the chado database is not local to the drupal database 00017 // then we need to set the database name. This should always 00018 // be 'chado'. 00019 if(is_array($db_url) and array_key_exists('chado',$db_url)){ 00020 // return empty data array b/c if chado is external then no join to the nodetable can be made 00021 return $data; 00022 } 00023 00024 // Basic table definition 00025 $data['chado_library']['table'] = array( 00026 'field' => 'nid', 00027 ); 00028 00029 // Note: No joins need to be made from $data['library']['table'] 00030 00031 // Join the chado library table to library 00032 $data['chado_library']['table']['join']['library'] = array( 00033 'left_field' => 'library_id', 00034 'field' => 'library_id', 00035 ); 00036 00037 // Join the node table to chado library 00038 $data['node']['table']['join']['chado_library'] = array( 00039 'left_field' => 'nid', 00040 'field' => 'nid', 00041 ); 00042 00043 // Join the node table to library 00044 $data['node']['table']['join']['library'] = array( 00045 'left_table' => 'chado_library', 00046 'left_field' => 'nid', 00047 'field' => 'nid', 00048 ); 00049 00050 return $data; 00051 }