public function taxrank__infraspecific_taxon::queryOrder

3.x taxrank__infraspecific_taxon.inc public taxrank__infraspecific_taxon::queryOrder($query, $order)

Overrides ChadoField::queryOrder

See also

ChadoField::queryOrder()

File

tripal_chado/includes/TripalFields/taxrank__infraspecific_taxon/taxrank__infraspecific_taxon.inc, line 136

Class

taxrank__infraspecific_taxon

Code

public function queryOrder($query, $order) {
  $alias = $this->field['field_name'];

  $field_term_id = $this->getFieldTermID();
  $label_term = $field_term_id . ',' . 'rdfs:label';
  $infraspecific_name_term = $field_term_id . ',' . chado_get_semweb_term('organism', 'infraspecific_name');
  $infraspecific_type_term = $field_term_id . ',' . chado_get_semweb_term('organism', 'type_id');

  if ($order['column'] == $infraspecific_name_term) {
    $query->orderBy('base.infraspecific_name', $order['direction']);
  }
  if ($order['column'] == $infraspecific_type_term) {
    $this->queryJoinOnce($query, 'cvterm', $alias . '_cvterm', $alias . "_cvterm.cvterm_id = base.type_id", "LEFT OUTER");
    $query->orderBy($alias . '_cvterm.name', $order['direction']);
  }
}