You are here

function oa_core_views_handler_argument_numeric_og_membership_gid::query in Open Atrium Core 7.2

Set up the query for this argument.

The argument sent may be found at $this->argument.

Parameters

bool $group_by: Whether the query uses a group-by.

Overrides views_handler_argument_numeric::query

File

plugins/views/oa_core_views_handler_argument_numeric_og_membership_gid.inc, line 37
Definition of views_handler_argument_numeric.

Class

oa_core_views_handler_argument_numeric_og_membership_gid
Basic argument handler for arguments that are numeric. Incorporates break_phrase.

Code

function query($group_by = FALSE) {
  if (empty($this->options['oa_subspaces_expand'])) {
    return parent::query($group_by);
  }
  if (!empty($this->options['break_phrase'])) {
    views_break_phrase($this->argument, $this);
  }
  else {
    $this->value = array(
      $this->argument,
    );
  }

  // Add parents.
  $original_breakphrase = $this->options['break_phrase'];
  $parents = count($this->value) == 1 ? og_subgroups_parents_load('node', current($this->value)) : og_subgroups_parents_load_multiple(array(
    'node' => $this->value,
  ));
  if (!empty($parents['node'])) {
    $this->options['break_phrase'] = TRUE;
    $seperator = isset($this->operator) && $this->operator == 'and' ? '-' : '+';
    $this->value = array_unique(array_merge($this->value, $parents['node']));
    $this->argument = implode($seperator, $this->value);
  }
  parent::query($group_by);
  $this->options['break_phrase'] = $original_breakphrase;
}