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