class SingleHeartbeat in Heartbeat 6.4
Concrete class SingleHeartbeat Defines a stream for one activity message.
Hierarchy
- class \HeartbeatAccess
- class \SingleHeartbeat
Expanded class hierarchy of SingleHeartbeat
1 string reference to 'SingleHeartbeat'
- heartbeat_heartbeat_register_access_types in ./
heartbeat.module - Implementation of hook_heartbeat_register_access_types().
File
- includes/
singleheartbeat.inc, line 14
View source
class SingleHeartbeat extends heartbeataccess {
/**
* Skip active user.
* We never want to skip the active user. not for
* logged-in user and not for displayed user (profile).
* This is ofcourse because private stream is intended to
* show own activity.
*/
public function skipActiveUser() {
return FALSE;
}
/**
* hasAccess
*
* @param $text
* @return boolean to indicate the access to the stream
*/
protected function hasAccess() {
return TRUE;
}
/**
* prepareStream
*
* @param $text
* @return HeartbeatParser object
*/
protected function prepareStream() {
global $user, $language;
$this->stream->offset_sql = $this->_offset_sql;
// Prevent already assigned language to be overriden
if (empty($this->stream->language)) {
$this->stream->language = $language->language;
}
// Sql parts
// If users are involved (uid or uid_target) in heartbeat_activity
// check if they are not blocked (status = 1).
$this->stream->sql_start = "SELECT\n hm.hid AS 'hid', hm.message AS 'message_orig',\n hm.message_concat AS 'message_concat_orig',\n hm.attachments AS 'attachments', hm.concat_args,\n hm.custom AS 'custom', hm.description as 'description',\n hm.perms, hm.variables AS 'variables_orig',\n ua.*, ua_users.*,\n 1 AS 'count'\n FROM {heartbeat_activity} ua\n LEFT JOIN {heartbeat_messages} hm ON ua.message_id = hm.message_id\n LEFT JOIN {users} ua_users ON ua.uid = ua_users.uid\n LEFT JOIN {users} ua_target_users ON ua.uid_target = ua_target_users.uid\n WHERE\n ua.uaid = %d\n AND (ua_users.uid = 0 OR ua_users.status = 1)\n AND (ua_target_users.uid = 0 OR ua_target_users.status = 1)\n ";
$this->stream->sql_end = "";
$heartbeat = $this
->createHeartbeatParser();
return $heartbeat;
}
/**
* resultSql
*
* @param $sql String query to extend the current query
* @param $values Array of values to substitute in the query extension
* @return array results
*/
protected function resultSql($sql = '', $values = array()) {
$result = db_query($this->stream->sql_start, $this->stream->latest_uaid);
$results = array();
while ($row = db_fetch_object($result)) {
$template = new HeartbeatMessageTemplate($row->hid, $row->message_id, $row->message_orig, $row->message_concat_orig, $row->concat_args);
$template->perms = $row->perms;
$template->custom = $row->custom;
$template->description = $row->description;
$template
->set_variables($row->variables_orig);
$template
->set_attachments($row->attachments);
$template
->set_roles(isset($template->concat_args['roles']) ? $template->concat_args['roles'] : array());
$template->variables['build_mode'] = 'none';
$heartbeatactivity = new HeartbeatActivity($row, $template);
$results[$row->uaid] = $heartbeatactivity;
}
$stream = heartbeat_stream_load($this
->getAccess());
$this->stream->filters = array();
$this->stream->variables['build_mode'] = 'none';
return $results;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
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:: |
public | function | addViewQuery | 7 |
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:: |
protected | function | 7 | |
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:: |
public | function | hasErrors | |
HeartbeatAccess:: |
public | function | Getter function for heartbeat page/blocks | |
HeartbeatAccess:: |
protected | function | setError | |
HeartbeatAccess:: |
final public | function | setOffsetSql | |
HeartbeatAccess:: |
constant | |||
HeartbeatAccess:: |
constant | |||
HeartbeatAccess:: |
protected | function | proctected fuinction whoIsActor Calculate the user of whom we want to see activity for. Set the actor of the stream. | 1 |
HeartbeatAccess:: |
public | function | Constructor | |
SingleHeartbeat:: |
protected | function |
hasAccess Overrides HeartbeatAccess:: |
|
SingleHeartbeat:: |
protected | function |
prepareStream Overrides HeartbeatAccess:: |
|
SingleHeartbeat:: |
protected | function |
resultSql Overrides HeartbeatAccess:: |
|
SingleHeartbeat:: |
public | function |
Skip active user.
We never want to skip the active user. not for
logged-in user and not for displayed user (profile).
This is ofcourse because private stream is intended to
show own activity. Overrides HeartbeatAccess:: |