Tripal v1.0 (6.x-1.0)
views_handler_join_chado_through_linking Class Reference

List of all members.

Public Member Functions

 construct ($table=NULL, $left_table=NULL, $left_field=NULL, $field=NULL, $extra=array(), $type= 'LEFT', $added=NULL)
 join ($table, &$query)
 create_single_join (&$query, $right_spec, $left_spec, $join_type)

Detailed Description

Definition at line 36 of file views_handler_join_chado_through_linking.inc.


Member Function Documentation

views_handler_join_chado_through_linking::construct ( table = NULL,
left_table = NULL,
left_field = NULL,
field = NULL,
extra = array(),
type = 'LEFT',
added = NULL 
)

Definition at line 41 of file views_handler_join_chado_through_linking.inc.

                                                                                                                                            {
    parent::construct($table, $left_table, $left_field, $field, $extra, $type);
  }
views_handler_join_chado_through_linking::create_single_join ( &$  query,
right_spec,
left_spec,
join_type 
)

Creates SQL for a single join based on parameters

Definition at line 88 of file views_handler_join_chado_through_linking.inc.

                                                                            {

    if ($right_spec['table']) {
      $right = $query->get_table_info($right_spec['table']);
      if (!$right['alias']) {
        $right['alias'] = $right_spec['table'];
      }
      $right_field = "$right[alias].$right_spec[field]";

      if ($right_spec['is_drupal']) {
        $right_table = '{' . $right_spec['table'] . '}';
      }
      else {
        $right_table = $right_spec['table'];
      }
    }

    if ($left_spec['table']) {
      $left = $query->get_table_info($left_spec['table']);
      if (!$left['alias']) {
        $left['alias'] = $left_spec['table'];
        }
      $left_field = "$left[alias].$left_spec[field]";
    }
    else {
      // This can be used if left_field is a formula or something. It should be used only *very* rarely.
      $left_field = $this->left_spec['field'];
    }

    $output = " $join_type JOIN $right_table $right[alias] ON $left_field = $right_field";

    return $output;
  }
views_handler_join_chado_through_linking::join ( table,
&$  query 
)

Creates SQL for both joins table => linking_table and linking_table => left_table NOTE: Uses fields in definition as passed in from hook_views_data join definition

Definition at line 49 of file views_handler_join_chado_through_linking.inc.

                                 {
    $output = '';
    $joins = array();

    $joins[] = $this->create_single_join(
      $query,
      array(
        'table' => $this->definition['linking']['table'],
        'field' => $this->definition['linking']['left_field'],
        'is_drupal' => FALSE,
      ),
      array(
        'table' => $this->definition['left_table'],
        'field' => $this->definition['left_field'],
      ),
      'LEFT'
    );

    $joins[] = $this->create_single_join(
      $query,
      array(
        'table' => $this->definition['table'],
        'field' => $this->definition['field'],
        'is_drupal' => $this->definition['table_is_drupal'],
      ),
      array(
        'table' => $this->definition['linking']['table'],
        'field' => $this->definition['linking']['field'],
      ),
      'LEFT'
    );

    $output .= implode("\n", $joins);
    return $output;
  }

The documentation for this class was generated from the following file:
 All Classes Files Functions Variables