API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[civicrm-core.git] / CRM / Core / DAO / MessageTemplate.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/MessageTemplate.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:542e52d6f757c9e8adfa2a5ed07b6475)
10 */
11
12 /**
13 * Database access object for the MessageTemplate entity.
14 */
15 class CRM_Core_DAO_MessageTemplate extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_msg_template';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 public static $_log = FALSE;
30
31 /**
32 * Message Template ID
33 *
34 * @var int
35 */
36 public $id;
37
38 /**
39 * Descriptive title of message
40 *
41 * @var string
42 */
43 public $msg_title;
44
45 /**
46 * Subject for email message.
47 *
48 * @var text
49 */
50 public $msg_subject;
51
52 /**
53 * Text formatted message
54 *
55 * @var longtext
56 */
57 public $msg_text;
58
59 /**
60 * HTML formatted message
61 *
62 * @var longtext
63 */
64 public $msg_html;
65
66 /**
67 * @var bool
68 */
69 public $is_active;
70
71 /**
72 * a pseudo-FK to civicrm_option_value
73 *
74 * @var int
75 */
76 public $workflow_id;
77
78 /**
79 * @var string
80 */
81 public $workflow_name;
82
83 /**
84 * is this the default message template for the workflow referenced by workflow_id?
85 *
86 * @var bool
87 */
88 public $is_default;
89
90 /**
91 * is this the reserved message template which we ship for the workflow referenced by workflow_id?
92 *
93 * @var bool
94 */
95 public $is_reserved;
96
97 /**
98 * Is this message template used for sms?
99 *
100 * @var bool
101 */
102 public $is_sms;
103
104 /**
105 * a pseudo-FK to civicrm_option_value containing PDF Page Format.
106 *
107 * @var int
108 */
109 public $pdf_format_id;
110
111 /**
112 * Class constructor.
113 */
114 public function __construct() {
115 $this->__table = 'civicrm_msg_template';
116 parent::__construct();
117 }
118
119 /**
120 * Returns localized title of this entity.
121 */
122 public static function getEntityTitle() {
123 return ts('Message Templates');
124 }
125
126 /**
127 * Returns all the column names of this table
128 *
129 * @return array
130 */
131 public static function &fields() {
132 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
133 Civi::$statics[__CLASS__]['fields'] = [
134 'id' => [
135 'name' => 'id',
136 'type' => CRM_Utils_Type::T_INT,
137 'title' => ts('Message Template ID'),
138 'description' => ts('Message Template ID'),
139 'required' => TRUE,
140 'where' => 'civicrm_msg_template.id',
141 'table_name' => 'civicrm_msg_template',
142 'entity' => 'MessageTemplate',
143 'bao' => 'CRM_Core_BAO_MessageTemplate',
144 'localizable' => 0,
145 'add' => '1.6',
146 ],
147 'msg_title' => [
148 'name' => 'msg_title',
149 'type' => CRM_Utils_Type::T_STRING,
150 'title' => ts('Message Template Title'),
151 'description' => ts('Descriptive title of message'),
152 'maxlength' => 255,
153 'size' => CRM_Utils_Type::HUGE,
154 'where' => 'civicrm_msg_template.msg_title',
155 'table_name' => 'civicrm_msg_template',
156 'entity' => 'MessageTemplate',
157 'bao' => 'CRM_Core_BAO_MessageTemplate',
158 'localizable' => 0,
159 'add' => '1.6',
160 ],
161 'msg_subject' => [
162 'name' => 'msg_subject',
163 'type' => CRM_Utils_Type::T_TEXT,
164 'title' => ts('Message Template Subject'),
165 'description' => ts('Subject for email message.'),
166 'where' => 'civicrm_msg_template.msg_subject',
167 'table_name' => 'civicrm_msg_template',
168 'entity' => 'MessageTemplate',
169 'bao' => 'CRM_Core_BAO_MessageTemplate',
170 'localizable' => 0,
171 'add' => '1.6',
172 ],
173 'msg_text' => [
174 'name' => 'msg_text',
175 'type' => CRM_Utils_Type::T_LONGTEXT,
176 'title' => ts('Message Template Text'),
177 'description' => ts('Text formatted message'),
178 'where' => 'civicrm_msg_template.msg_text',
179 'table_name' => 'civicrm_msg_template',
180 'entity' => 'MessageTemplate',
181 'bao' => 'CRM_Core_BAO_MessageTemplate',
182 'localizable' => 0,
183 'html' => [
184 'type' => 'TextArea',
185 ],
186 'add' => '1.6',
187 ],
188 'msg_html' => [
189 'name' => 'msg_html',
190 'type' => CRM_Utils_Type::T_LONGTEXT,
191 'title' => ts('Message Template HTML'),
192 'description' => ts('HTML formatted message'),
193 'where' => 'civicrm_msg_template.msg_html',
194 'table_name' => 'civicrm_msg_template',
195 'entity' => 'MessageTemplate',
196 'bao' => 'CRM_Core_BAO_MessageTemplate',
197 'localizable' => 0,
198 'html' => [
199 'type' => 'RichTextEditor',
200 ],
201 'add' => '1.6',
202 ],
203 'is_active' => [
204 'name' => 'is_active',
205 'type' => CRM_Utils_Type::T_BOOLEAN,
206 'title' => ts('Is Active'),
207 'where' => 'civicrm_msg_template.is_active',
208 'default' => '1',
209 'table_name' => 'civicrm_msg_template',
210 'entity' => 'MessageTemplate',
211 'bao' => 'CRM_Core_BAO_MessageTemplate',
212 'localizable' => 0,
213 'add' => '1.6',
214 ],
215 'workflow_id' => [
216 'name' => 'workflow_id',
217 'type' => CRM_Utils_Type::T_INT,
218 'title' => ts('Deprecated field for Message Template Workflow.'),
219 'description' => ts('a pseudo-FK to civicrm_option_value'),
220 'where' => 'civicrm_msg_template.workflow_id',
221 'table_name' => 'civicrm_msg_template',
222 'entity' => 'MessageTemplate',
223 'bao' => 'CRM_Core_BAO_MessageTemplate',
224 'localizable' => 0,
225 'add' => '3.1',
226 ],
227 'workflow_name' => [
228 'name' => 'workflow_name',
229 'type' => CRM_Utils_Type::T_STRING,
230 'title' => ts('Message Template Workflow Name'),
231 'maxlength' => 255,
232 'size' => CRM_Utils_Type::HUGE,
233 'where' => 'civicrm_msg_template.workflow_name',
234 'table_name' => 'civicrm_msg_template',
235 'entity' => 'MessageTemplate',
236 'bao' => 'CRM_Core_BAO_MessageTemplate',
237 'localizable' => 0,
238 'add' => '5.26',
239 ],
240 'is_default' => [
241 'name' => 'is_default',
242 'type' => CRM_Utils_Type::T_BOOLEAN,
243 'title' => ts('Message Template Is Default?'),
244 'description' => ts('is this the default message template for the workflow referenced by workflow_id?'),
245 'where' => 'civicrm_msg_template.is_default',
246 'default' => '1',
247 'table_name' => 'civicrm_msg_template',
248 'entity' => 'MessageTemplate',
249 'bao' => 'CRM_Core_BAO_MessageTemplate',
250 'localizable' => 0,
251 'add' => '3.1',
252 ],
253 'is_reserved' => [
254 'name' => 'is_reserved',
255 'type' => CRM_Utils_Type::T_BOOLEAN,
256 'title' => ts('Message Template Is Reserved?'),
257 'description' => ts('is this the reserved message template which we ship for the workflow referenced by workflow_id?'),
258 'where' => 'civicrm_msg_template.is_reserved',
259 'table_name' => 'civicrm_msg_template',
260 'entity' => 'MessageTemplate',
261 'bao' => 'CRM_Core_BAO_MessageTemplate',
262 'localizable' => 0,
263 'add' => '3.1',
264 ],
265 'is_sms' => [
266 'name' => 'is_sms',
267 'type' => CRM_Utils_Type::T_BOOLEAN,
268 'title' => ts('Message Template is used for SMS?'),
269 'description' => ts('Is this message template used for sms?'),
270 'where' => 'civicrm_msg_template.is_sms',
271 'default' => '0',
272 'table_name' => 'civicrm_msg_template',
273 'entity' => 'MessageTemplate',
274 'bao' => 'CRM_Core_BAO_MessageTemplate',
275 'localizable' => 0,
276 'add' => '4.5',
277 ],
278 'pdf_format_id' => [
279 'name' => 'pdf_format_id',
280 'type' => CRM_Utils_Type::T_INT,
281 'title' => ts('Message Template Format'),
282 'description' => ts('a pseudo-FK to civicrm_option_value containing PDF Page Format.'),
283 'where' => 'civicrm_msg_template.pdf_format_id',
284 'table_name' => 'civicrm_msg_template',
285 'entity' => 'MessageTemplate',
286 'bao' => 'CRM_Core_BAO_MessageTemplate',
287 'localizable' => 0,
288 'pseudoconstant' => [
289 'optionGroupName' => 'pdf_format',
290 'keyColumn' => 'id',
291 'optionEditPath' => 'civicrm/admin/options/pdf_format',
292 ],
293 'add' => '3.4',
294 ],
295 ];
296 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
297 }
298 return Civi::$statics[__CLASS__]['fields'];
299 }
300
301 /**
302 * Return a mapping from field-name to the corresponding key (as used in fields()).
303 *
304 * @return array
305 * Array(string $name => string $uniqueName).
306 */
307 public static function &fieldKeys() {
308 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
309 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
310 }
311 return Civi::$statics[__CLASS__]['fieldKeys'];
312 }
313
314 /**
315 * Returns the names of this table
316 *
317 * @return string
318 */
319 public static function getTableName() {
320 return self::$_tableName;
321 }
322
323 /**
324 * Returns if this table needs to be logged
325 *
326 * @return bool
327 */
328 public function getLog() {
329 return self::$_log;
330 }
331
332 /**
333 * Returns the list of fields that can be imported
334 *
335 * @param bool $prefix
336 *
337 * @return array
338 */
339 public static function &import($prefix = FALSE) {
340 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'msg_template', $prefix, []);
341 return $r;
342 }
343
344 /**
345 * Returns the list of fields that can be exported
346 *
347 * @param bool $prefix
348 *
349 * @return array
350 */
351 public static function &export($prefix = FALSE) {
352 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'msg_template', $prefix, []);
353 return $r;
354 }
355
356 /**
357 * Returns the list of indices
358 *
359 * @param bool $localize
360 *
361 * @return array
362 */
363 public static function indices($localize = TRUE) {
364 $indices = [];
365 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
366 }
367
368 }