public function HeartbeatMessageTemplate::init in Heartbeat 7
init().
Function to initialize the template from a db_fetch_object.
File
- includes/
heartbeatmessagetemplate.inc, line 48 - 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 init($row) {
if (is_array($row)) {
$row = (object) $row;
}
if (isset($row->hid)) {
$this->hid = $row->hid;
}
$this->message_id = $row->message_id;
$this->perms = (int) $row->perms;
$this->description = $row->description;
if (isset($row->message_orig)) {
$this->message = $row->message_orig;
}
else {
$this->message = $row->message;
}
if (isset($row->message_concat_orig)) {
$this->message_concat = $row->message_concat_orig;
}
else {
$this->message_concat = isset($row->message_concat) ? $row->message_concat : '';
}
$this
->setArguments($row->concat_args);
if (isset($row->variables_orig)) {
$this
->setVariables($row->variables_orig);
}
elseif (isset($row->variables)) {
$this
->setVariables($row->variables);
}
if (isset($row->attachments)) {
$this
->setAttachments($row->attachments);
}
$this
->setRoles(isset($this->concat_args['roles']) ? $this->concat_args['roles'] : array());
}