public function ConnectedHeartbeat::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/
friendlist_activity/ connectedheartbeat.inc, line 50
Class
- ConnectedHeartbeat
- Class ConnectedHeartbeat 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}";
if (!empty($this->stream->heartbeat_relations)) {
$view->query
->set_where_group('OR', 'orgroup');
$sql = "{$field} in( " . implode(',', $this->stream->heartbeat_relations) . " ) AND {$view->table_alias}.access >= 0 ";
$view->query
->add_where('orgroup', $sql);
$sql = "{$view->table_alias}.uid_target = %d AND {$view->table_alias}.nid <> 0";
$view->query
->add_where('orgroup', $sql, $this->_uid);
}
else {
$view->query
->add_where('deny', "{$view->table_alias}.access < 0");
}
}