You are here

function _heartbeat_group_views_messages in Heartbeat 6.3

Same name and namespace in other branches
  1. 6.4 views/heartbeat_views.module \_heartbeat_group_views_messages()

Helper function to group and merge message built by the views module

1 call to _heartbeat_group_views_messages()
_heartbeat_render_view in views/heartbeat_views.module
Helper function to (re-)render the messages coming from views

File

views/heartbeat_views.module, line 54

Code

function _heartbeat_group_views_messages($messages, $access, $heartbeat_relations, $limit) {
  global $user, $language;
  $heartbeat = HeartbeatParser::instantiate('views_gen');
  $heartbeatInfo = new HeartbeatInfo();
  $heartbeatInfo->uid = $user->uid;
  $heartbeatInfo->access = $access;
  $heartbeatInfo->limit_view = $limit;
  $heartbeatInfo->user_relations = $heartbeat_relations;
  $heartbeatInfo->language = $language->language;
  $full_timespan = variable_get('heartbeat_activity_no_duplicate_seconds', 172800) - 1;
  $heartbeatInfo->time_span = date("G", $full_timespan) . ' hours';
  $user->heartbeat_relations = $heartbeatInfo->user_relations;
  $heartbeat
    ->set_info($heartbeatInfo);
  $heartbeat
    ->set_timespan_gap(variable_get('heartbeat_activity_grouping_seconds', 720));
  $heartbeat
    ->build_sets($messages);
  $heartbeat
    ->merge_sets();
  $messages = $heartbeat
    ->get_messages($limit);
  return $messages;
}