You are here

public function user_activity::set_data in Heartbeat 6.2

Set data into members

1 call to user_activity::set_data()
user_activity::__construct in ./heartbeat.module
constructor

File

./heartbeat.module, line 47
To fully understand this, you have to be familiar with the rules module. Lots of documentation can be found on http://drupal.org/node/298480 for an introduction and tutorial, but http://drupal.org/node/298486 is a lot of handy info for developers.

Class

user_activity
Class to handle user activity data

Code

public function set_data($data) {
  foreach ($data as $key => $value) {
    if (isset($this->{$key})) {
      $this->{$key} = $value;
    }
    if (isset($this->{'m_' . $key})) {
      $this->{'m_' . $key} = $value;
    }
  }

  // Data variables are more complicated
  if (isset($data['variables'])) {
    $this->m_variables_string = $data['variables'];
  }

  // if the data variables have not been included
  // as normal members, do so now to be available when asked for
  // @see __get
  if ($this->m_variables_array == array() && $this->m_variables_string != '') {
    $this
      ->variables2array();
  }
}