You are here

public function HeartbeatActivity::setAccess in Heartbeat 7

setAccess().

1 call to HeartbeatActivity::setAccess()
HeartbeatActivity::__construct in includes/heartbeatactivity.inc
constructor

File

includes/heartbeatactivity.inc, line 184
HeartbeatActivity object Defines one heartbeat activity object.

Class

HeartbeatActivity
Class defines an activity message object

Code

public function setAccess($raw_data) {

  // By default, we always use the logged "access".
  $this->access = HEARTBEAT_PUBLIC_TO_ALL;

  // In most cases (hopefully), the property at the  time the activity
  // occurred will be set and gets priority. This value is calculated
  // from template access, user profile privacy or custom access.
  if (isset($raw_data['access'])) {
    $this->access = (int) $raw_data['access'];
  }

  // If the actor of the message has set this type of message, inherit.
  if (isset($raw_data['access_status']) && $raw_data['access_status'] <= $this->access) {
    $this->access = (int) $raw_data['access_status'];
  }

  // If for some reason what so ever, the template restriction had been changed
  // into some lower permission than calculated, lower down the access.
  if ((int) $this->template->perms < $this->access) {
    $this->access = (int) $this->template->perms;
  }
}