You are here

protected function HeartbeatAccess::prepareHeartbeatInfo in Heartbeat 6.3

1 call to HeartbeatAccess::prepareHeartbeatInfo()
HeartbeatAccess::fetchMessages in includes/heartbeataccess.inc

File

includes/heartbeataccess.inc, line 68

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 prepareHeartbeatInfo() {
  global $user, $language;
  $full_timespan = variable_get('heartbeat_activity_no_duplicate_seconds', 172800) - 1;
  $heartbeatInfo = new HeartbeatInfo();
  $heartbeatInfo->uid = $this->_uid;
  $heartbeatInfo->access = $this
    ->getAccess();
  $heartbeatInfo->user_relations = $user->heartbeat_relations;
  $heartbeatInfo->limit_sql = variable_get('heartbeat_block_items_max', 250);
  $heartbeatInfo->language = $language->language;
  $heartbeatInfo->start_time = $_SERVER['REQUEST_TIME'] - (int) $full_timespan;
  $heartbeatInfo->time_span = date("G", $full_timespan) . ' hours';

  // Sql parts
  $heartbeatInfo->sql_start = "SELECT\n      hm.message AS 'message_orig', hm.message_concat AS 'message_concat_orig',\n      hm.concat_args, hm.module, hm.perms, ua.*,  1 AS 'count'\n    FROM {heartbeat_activity} ua\n    LEFT JOIN {heartbeat_messages} hm ON ua.message_id = hm.message_id\n    WHERE ua.language = '%s' ";
  $heartbeatInfo->sql_end = " AND timestamp > %d ORDER BY timestamp DESC";
  $heartbeat = HeartbeatParser::instantiate($this
    ->getAccess());
  $heartbeat
    ->set_info($heartbeatInfo);
  return $heartbeat;
}