public function HeartbeatMessageBuilder::group in Heartbeat 6.4
Same name and namespace in other branches
- 6.3 includes/heartbeatmessagebuilder.inc \HeartbeatMessageBuilder::group()
See also
1 call to HeartbeatMessageBuilder::group()
- HeartbeatMessageBuilder::execute in includes/
heartbeatmessagebuilder.inc - Executes a query, putting the result into a wellformed stream of heartbeat activity objects
File
- includes/
heartbeatmessagebuilder.inc, line 327 - Strategy with access behaviour
Class
- HeartbeatMessageBuilder
- Class HeartbeatMessageBuilder Message builder that fetches and customizes users activity on the site. The builder takes a heartbeataccess object to handle the request to fetch the messages.
Code
public function group(HeartbeatParser $heartbeat) {
$heartbeat
->set_timespan_gap($this->_heartbeatState->stream->grouping_seconds);
$heartbeat
->build_sets($heartbeat->raw_messages);
$heartbeat
->merge_sets();
$messages = $heartbeat
->get_messages();
// $messages = $heartbeat->remove_broken_messages();
$num_total_messages = count($messages);
$start = 0;
$end = $this->_heartbeatState->stream->limit_sql;
// if ($this->_heartbeatState->getOffsetSql() < $_SERVER['REQUEST_TIME']) {
// $start = $this->_heartbeatState->stream->limit_sql;
// $end = $this->_heartbeatState->stream->limit_sql + $start;
// }
// From here we know the number of messages actualy loaded (and allowed)
$messages = array_slice($messages, $start, $end);
// Set the possibility of a pager appearence
if ($num_total_messages > $this->_heartbeatState->stream->limit_sql) {
$this->_heartbeatState->stream->pager = TRUE;
}
return $messages;
}