ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilMailTemplate.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 protected int $template_id = 0;
24 protected string $title = '';
25 protected string $context = '';
26 protected string $lang = '';
27 protected string $subject = '';
28 protected string $message = '';
29 protected bool $is_default = false;
30
31 public function __construct(?array $data = null)
32 {
33 if ($data) {
34 $this->setTplId((int) $data['tpl_id']);
35 $this->setTitle((string) $data['title']);
36 $this->setContext((string) $data['context']);
37 $this->setLang((string) $data['lang']);
38 $this->setSubject((string) $data['m_subject']);
39 $this->setMessage((string) $data['m_message']);
40 $this->setAsDefault((bool) $data['is_default']);
41 }
42 }
43
47 public function toArray(): array
48 {
49 return [
50 'tpl_id' => $this->getTplId(),
51 'title' => $this->getTitle(),
52 'context' => $this->getContext(),
53 'lang' => $this->getLang(),
54 'm_subject' => $this->getSubject(),
55 'm_message' => $this->getMessage(),
56 'is_default' => $this->isDefault(),
57 ];
58 }
59
60 public function getTplId(): int
61 {
62 return $this->template_id;
63 }
64
65 public function setTplId(int $template_id): void
66 {
67 $this->template_id = $template_id;
68 }
69
70 public function getTitle(): string
71 {
72 return $this->title;
73 }
74
75 public function setTitle(string $title): void
76 {
77 $this->title = $title;
78 }
79
80 public function getContext(): string
81 {
82 return $this->context;
83 }
84
85 public function setContext(string $context): void
86 {
87 $this->context = $context;
88 }
89
90 public function getLang(): string
91 {
92 return $this->lang;
93 }
94
95 public function setLang(string $lang): void
96 {
97 $this->lang = $lang;
98 }
99
100 public function getSubject(): string
101 {
102 return $this->subject;
103 }
104
105 public function setSubject(string $subject): void
106 {
107 $this->subject = $subject;
108 }
109
110 public function getMessage(): string
111 {
112 return $this->message;
113 }
114
115 public function setMessage(string $message): void
116 {
117 $this->message = $message;
118 }
119
120 public function isDefault(): bool
121 {
122 return $this->is_default;
123 }
124
125 public function setAsDefault(bool $is_default): void
126 {
127 $this->is_default = $is_default;
128 }
129}
setContext(string $context)
__construct(?array $data=null)
setTitle(string $title)
setMessage(string $message)
setAsDefault(bool $is_default)
setSubject(string $subject)
setLang(string $lang)
setTplId(int $template_id)