You are here

protected function SingleHeartbeat::resultSql in Heartbeat 6.4

resultSql

Parameters

$sql String query to extend the current query:

$values Array of values to substitute in the query extension:

Return value

array results

Overrides HeartbeatAccess::resultSql

File

includes/singleheartbeat.inc, line 88

Class

SingleHeartbeat
Concrete class SingleHeartbeat Defines a stream for one activity message.

Code

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;
}