You are here

public function HeartbeatStream::__construct in Heartbeat 6.4

Same name and namespace in other branches
  1. 7 includes/heartbeatstream.inc \HeartbeatStream::__construct()

Constructor to load the type variable

File

includes/heartbeatstream.inc, line 110
HeartbeatStream object Parameter object that is given to a HeartbeatAccess object to form a full stream of handled activity objects.

Class

HeartbeatStream
Class HeartbeatStream

Code

public function __construct($type) {
  $this->name = drupal_strtolower($type['class']);
  $this->realname = drupal_strtolower(isset($type['realname']) ? $type['realname'] : $type['class']);
  $this->title = $type['name'];
  $this->module = $type['module'];
  $this->access = $type['access'];
  $this->display_filters = !empty($type['display_filters']) || !empty($type['display_block_filters']);
  if ($this->display_filters) {
    $this->filters = $type['filters'];
    $this->filters_cumul = $type['filters_cumul'];
  }
  if (isset($type['messages_denied'])) {
    $this->messages_denied = $type['messages_denied'];
  }
  if (isset($type['poll_messages'])) {
    $this->poll_messages = $type['poll_messages'];
  }
  if (isset($type['grouping_seconds'])) {
    $this->grouping_seconds = $type['grouping_seconds'];
  }
  else {
    $this->grouping_seconds = variable_get('heartbeat_activity_grouping_seconds', 7200);
  }
  if (isset($type['settings']) && is_array($type['settings'])) {
    foreach ($type['settings'] as $key => $val) {
      if (property_exists($this, $key)) {
        $this->{$key} = $val;
      }
      else {
        $this->variables[$key] = $val;
      }
    }
  }
}