You are here

public function HeartbeatMessageTemplate::set_roles in Heartbeat 6.4

Sets the roles

File

includes/heartbeatmessagetemplate.inc, line 86
HeartbeatMessageTemplate Template object that holds configuration for a message template. A HeartbeatActivity object will be able to have the template as composite.

Class

HeartbeatMessageTemplate
Class HeartbeatMessageTemplate

Code

public function set_roles($roles = array()) {

  // Filter the roles out of the arguments
  if (!empty($roles) && is_array($roles)) {
    foreach ($roles as $rid) {
      if ($rid != 0) {
        $this->roles[$rid] = $rid;

        //$this->roles[$rid] = db_result(db_query('SELECT r.name FROM {role} r WHERE r.rid=%d LIMIT 1', $rid));
      }
    }
  }

  // if no roles have been set, no role-based restrictions
  if ($this->roles == array()) {
    $this->roles[DRUPAL_ANONYMOUS_RID] = DRUPAL_ANONYMOUS_RID;
  }
}