You are here

class views_join_course in Course 8.2

Same name and namespace in other branches
  1. 8.3 views/handlers/views_join_course.inc \views_join_course
  2. 6 views/handlers/views_join_course.inc \views_join_course
  3. 7.2 views/handlers/views_join_course.inc \views_join_course
  4. 7 views/handlers/views_join_course.inc \views_join_course

Special join handler to allow join on two colums.

Do not sanitize the extra data coming from our course.views.inc. See http://drupal.org/node/560492

Hierarchy

Expanded class hierarchy of views_join_course

File

views/handlers/views_join_course.inc, line 9

View source
class views_join_course extends views_join {

  /**
   * Build the SQL for the join this object represents.
   *
   * When possible, try to use table alias instead of table names.
   *
   * @param $select_query
   *   An implementation of SelectQueryInterface.
   * @param $table
   *   The base table to join.
   * @param $view_query
   *   The source query, implementation of views_plugin_query.
   */
  function build_join($select_query, $table, $view_query) {
    if (empty($this->definition['table formula'])) {
      $right_table = $this->table;
    }
    else {
      $right_table = $this->definition['table formula'];
    }
    if ($this->left_table) {
      $left = $view_query
        ->get_table_info($this->left_table);
      $left_field = "{$left['alias']}.{$this->left_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_field;
    }
    $condition = "{$left_field} = {$table['alias']}.{$this->field}";
    $condition2 = "{$left['alias']}.{$this->extra[0]['field']} = {$table['alias']}.{$this->extra[0]['value']}";
    $condition = "({$condition} AND {$condition2})";
    $arguments = array();
    $select_query
      ->addJoin($this->type, $right_table, $table['alias'], $condition, $arguments);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
views_join_course::build_join function Build the SQL for the join this object represents.