You are here

public function heartbeatParser::build_sets in Heartbeat 7

Same name and namespace in other branches
  1. 6.4 includes/heartbeatparser.inc \heartbeatParser::build_sets()
  2. 6.3 includes/heartbeatparser.inc \heartbeatParser::build_sets()

build sets of messages

File

includes/heartbeatparser.inc, line 348
HeartbeatParser object Parses database messages into a well formed stream of activity messages.

Class

heartbeatParser
Class heartbeatParser

Code

public function build_sets($messages_param) {

  // The start is the end of the current day
  $renewal_time = $_SERVER['REQUEST_TIME'] - (3600 * date("H") + 60 * date("i") + date("s")) + 24 * 3600;

  // Retrieve variables to put on the object
  $show_time = variable_get('heartbeat_show_message_times', 1);
  $time_info_grouped = variable_get('heartbeat_show_time_grouped_items', 1);
  $messages = array();
  foreach ($messages_param as $key => $message) {

    // Set basic properties for all messages
    $message->show_time = $show_time;
    $message->time_info_grouped = $time_info_grouped;

    // if the time with the gap exceeds the starttime
    if ($renewal_time >= $message->timestamp) {

      // reset the start time of the set
      $renewal_time = $message->timestamp - $this->_timespan_gap;
    }
    $this->_sets[$renewal_time][$key] = $message;
  }
}