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