public function __get($var)
{
switch ($var) {
case 'user':
$this->user = false;
if ($this->user_id > 0) {
try {
$this->user = erLhcoreClassModelUser::fetch($this->user_id);
} catch (Exception $e) {
$this->user = false;
}
}
return $this->user;
break;
case 'department':
$this->department = false;
if ($this->department_id > 0) {
try {
$this->department = erLhcoreClassModelDepartament::fetch($this->department_id, true);
} catch (Exception $e) {
$this->department = false;
}
}
return $this->department;
break;
case 'msg_to_user':
$this->msg_to_user = str_replace(array_keys($this->replaceData), array_values($this->replaceData), $this->msg);
// If not all variables were replaced fallback to fallback message
if (preg_match('/\\{[a-zA-Z0-9_]+\\}/i', $this->msg_to_user)) {
$this->msg_to_user = str_replace(array_keys($this->replaceData), array_values($this->replaceData), $this->fallback_msg);
}
return $this->msg_to_user;
break;
case 'message_title':
if ($this->title != '') {
$this->message_title = $this->title;
} else {
$this->message_title = $this->msg_to_user;
}
return $this->message_title;
break;
default:
break;
}
}