class ConnectedHeartbeat in Heartbeat 6.4
Same name and namespace in other branches
- 6.3 includes/connectedheartbeat.inc \ConnectedHeartbeat
Class ConnectedHeartbeat Concrete class to prepare messages for the current user and all of his/her relations.
Hierarchy
- class \HeartbeatAccess
- class \ConnectedHeartbeat
Expanded class hierarchy of ConnectedHeartbeat
1 string reference to 'ConnectedHeartbeat'
- friendlist_activity_heartbeat_register_access_types in modules/
friendlist_activity/ friendlist_activity.module - Implementation of hook_heartbeat_register_access_types().
File
- modules/
friendlist_activity/ connectedheartbeat.inc, line 16
View source
class ConnectedHeartbeat extends HeartbeatAccess {
/**
* proctected fuinction whoIsActor
* Add the heartbeat relations for the stream's active user.
*/
protected function whoIsActor($account = NULL) {
parent::whoIsActor($account);
$this->stream->heartbeat_relations = heartbeat_get_related_uids($this->stream->uid);
}
/**
* Override dressupMessages to change the query.
* @see HeartbeatAccess::dressUpMessages().
*/
public function dressUpMessages(HeartbeatParser $heartbeat) {
if (!empty($this->stream->heartbeat_relations)) {
// filter activity for related users and activity that was addressed to the current user.
$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;
}
/**
* Function to add a part of a sql to a query built by views UI
*
* @param object $view The view handler object by reference to add our part to the query
*/
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");
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConnectedHeartbeat:: |
public | function |
Function to add a part of a sql to a query built by views UI Overrides HeartbeatAccess:: |
|
ConnectedHeartbeat:: |
public | function |
Override dressupMessages to change the query. Overrides HeartbeatAccess:: |
|
ConnectedHeartbeat:: |
protected | function |
proctected fuinction whoIsActor
Add the heartbeat relations for the stream's active user. Overrides HeartbeatAccess:: |
|
HeartbeatAccess:: |
public | property | ||
HeartbeatAccess:: |
protected | property | ||
HeartbeatAccess:: |
protected | property | ||
HeartbeatAccess:: |
protected | property | ||
HeartbeatAccess:: |
protected | property | ||
HeartbeatAccess:: |
protected | property | ||
HeartbeatAccess:: |
protected | property | ||
HeartbeatAccess:: |
protected | property | ||
HeartbeatAccess:: |
protected | property | ||
HeartbeatAccess:: |
protected | function | Check denied messages | |
HeartbeatAccess:: |
public | function | ConfigurationForm Basic configuration form for streams. | |
HeartbeatAccess:: |
public | function | Fake constructor to hook this method instead of the constructor. | 2 |
HeartbeatAccess:: |
protected | function | createHeartbeatParser | |
HeartbeatAccess:: |
public | function | ||
HeartbeatAccess:: |
protected | function | finishMessages | |
HeartbeatAccess:: |
final public | function | getAccess | |
HeartbeatAccess:: |
public | function | Function to retrieve the active user. | |
HeartbeatAccess:: |
public | function | ||
HeartbeatAccess:: |
final public | function | getOffsetSql | |
HeartbeatAccess:: |
public | function | Get HeartbeatStream object with all configurations | |
HeartbeatAccess:: |
protected | function | hasAccess | 4 |
HeartbeatAccess:: |
public | function | hasErrors | |
HeartbeatAccess:: |
public | function | Getter function for heartbeat page/blocks | |
HeartbeatAccess:: |
protected | function | prepareStream | 2 |
HeartbeatAccess:: |
protected | function | resultSql | 1 |
HeartbeatAccess:: |
protected | function | setError | |
HeartbeatAccess:: |
final public | function | setOffsetSql | |
HeartbeatAccess:: |
public | function | Skip active user. Return whether you want to skip the active user (being the logged-in user and NOT the displayed user) from display. Typical private will not skip this one ofcourse where most other will skip active user since you don't want to… | 5 |
HeartbeatAccess:: |
constant | |||
HeartbeatAccess:: |
constant | |||
HeartbeatAccess:: |
public | function | Constructor |