connectedheartbeat.inc in Heartbeat 6.4
File
modules/friendlist_activity/connectedheartbeat.inc
View source
<?php
heartbeat_include('HeartbeatAccess');
class ConnectedHeartbeat extends HeartbeatAccess {
protected function whoIsActor($account = NULL) {
parent::whoIsActor($account);
$this->stream->heartbeat_relations = heartbeat_get_related_uids($this->stream->uid);
}
public function dressUpMessages(HeartbeatParser $heartbeat) {
if (!empty($this->stream->heartbeat_relations)) {
$sql = " AND ((ua.uid in( %s ) AND ua.access >= 0) OR (ua.uid_target = %d AND ua.nid <> 0))";
$heartbeat->raw_messages = $this
->resultSql($sql, array(
implode(',', $this->stream->heartbeat_relations),
$this->stream->uid,
));
}
else {
$heartbeat->raw_messages = array();
}
return $heartbeat;
}
public function addViewQuery(&$view) {
$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");
}
}
}
Classes
Name |
Description |
ConnectedHeartbeat |
Class ConnectedHeartbeat
Concrete class to prepare messages for the current user
and all of his/her relations. |