protected function HeartbeatAccess::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
8 calls to HeartbeatAccess::resultSql()
- ConnectedHeartbeat::dressUpMessages in modules/
friendlist_activity/ connectedheartbeat.inc - Override dressupMessages to change the query.
- GroupsActivity::dressUpMessages in modules/
og_activity/ groupsactivity.inc - HeartbeatAccess::dressUpMessages in includes/
heartbeataccess.inc - MembersActivity::dressUpMessages in modules/
og_activity/ membersactivity.inc - dressUpMessages
- OgHeartbeat::dressUpMessages in modules/
og_activity/ ogheartbeat.inc - dressUpMessages
1 method overrides HeartbeatAccess::resultSql()
- SingleHeartbeat::resultSql in includes/
singleheartbeat.inc - resultSql
File
- includes/
heartbeataccess.inc, line 180 - HeartbeatAccess object is the object that takes stream configuration to create a stream of activity objects. It is the controlling organ at the pre-query, query and post-query phases.
Class
- HeartbeatAccess
- Abstract class heartbeataccess This base class has final template methods which are used by the derived concretes. The HeartbeatAccess is a state object that is given to the HeartbeatMessageBuilder to set the access to the current request.
Code
protected function resultSql($sql = '', $values = array()) {
$args = array();
//$args[] = $this->stream->sql_start . $sql . $this->stream->sql_end;
$args[] = $this->stream->language;
if ($this->stream->latest_uaid > 0) {
$args[] = $this->stream->latest_uaid;
}
else {
// Limit the query for messages older than offset_sql
$args[] = $this->stream->offset_sql;
// Limit the query for messages newer than oldest_date,
// add param delete too old messages if set
if ($this->stream->oldest_date) {
//$args[] = $_SERVER['REQUEST_TIME'] - $this->stream->oldest_date;
}
}
// Put the arguments defined in subclasses into query
$args = array_merge($args, $values);
//$args[] = 0;
//$args[] = $this->stream->num_load_max;
// The cron and maximum number limits results to a minimum
//$result = call_user_func_array('db_query_range', $args);
$result = db_query_range($this->stream->sql_start . $sql . $this->stream->sql_end, $args, 0, $this->stream->num_load_max);
$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());
$heartbeatactivity = new HeartbeatActivity($row, $template);
$results[$row->uaid] = $heartbeatactivity;
}
$stream = heartbeat_stream_load($this
->getAccess());
$this->stream->display_filters = !empty($stream['display_' . ($this->_page ? '' : 'block_') . 'filters']);
if ($this->stream->display_filters) {
$this->stream->filters = $stream['filters'];
}
return $results;
}