You are here

public function OgHeartbeat::addViewQuery in Heartbeat 6.4

Function to add a part of a sql to a query built by views UI

Parameters

object $view The view handler object by reference to add our part to the query:

Overrides HeartbeatAccess::addViewQuery

File

modules/og_activity/ogheartbeat.inc, line 146

Class

OgHeartbeat
Class OgHeartbeat Concrete class to prepare messages for the current user and all of his/her relations.

Code

public function addViewQuery(&$view) {

  // Make the sql limited to the access
  $field = "{$view->table_alias}.{$view->real_field}";
  $view->query
    ->set_where_group('AND', 'extra');
  $sql = "{$view->table_alias}.nid <> 0 AND ( {$view->table_alias}.nid = %d OR {$view->table_alias}.nid_target = %d ) ";
  $view->query
    ->add_where('extra', $sql, $this->_gid, $this->_gid);
}