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 | |
2cbbebe8 | 9 | * (GenCodeChecksum:6a15fab577959d8cea4613098356e03d) |
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 | ], | |
a9d0587b | 153 | 'add' => '1.6', |
c3fc2621 CW |
154 | ], |
155 | 'msg_title' => [ | |
e501603b TO |
156 | 'name' => 'msg_title', |
157 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 158 | 'title' => ts('Message Template Title'), |
215b423e | 159 | 'description' => ts('Descriptive title of message'), |
e501603b TO |
160 | 'maxlength' => 255, |
161 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 162 | 'where' => 'civicrm_msg_template.msg_title', |
522a26c9 | 163 | 'table_name' => 'civicrm_msg_template', |
164 | 'entity' => 'MessageTemplate', | |
165 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 166 | 'localizable' => 0, |
a9d0587b | 167 | 'add' => '1.6', |
c3fc2621 CW |
168 | ], |
169 | 'msg_subject' => [ | |
e501603b TO |
170 | 'name' => 'msg_subject', |
171 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 172 | 'title' => ts('Message Template Subject'), |
215b423e | 173 | 'description' => ts('Subject for email message.'), |
a36434b9 | 174 | 'where' => 'civicrm_msg_template.msg_subject', |
522a26c9 | 175 | 'table_name' => 'civicrm_msg_template', |
176 | 'entity' => 'MessageTemplate', | |
177 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 178 | 'localizable' => 0, |
a9d0587b | 179 | 'add' => '1.6', |
c3fc2621 CW |
180 | ], |
181 | 'msg_text' => [ | |
e501603b TO |
182 | 'name' => 'msg_text', |
183 | 'type' => CRM_Utils_Type::T_LONGTEXT, | |
c3fc2621 | 184 | 'title' => ts('Message Template Text'), |
215b423e | 185 | 'description' => ts('Text formatted message'), |
a36434b9 | 186 | 'where' => 'civicrm_msg_template.msg_text', |
522a26c9 | 187 | 'table_name' => 'civicrm_msg_template', |
188 | 'entity' => 'MessageTemplate', | |
189 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 190 | 'localizable' => 0, |
c3fc2621 | 191 | 'html' => [ |
e501603b | 192 | 'type' => 'TextArea', |
c3fc2621 | 193 | ], |
a9d0587b | 194 | 'add' => '1.6', |
c3fc2621 CW |
195 | ], |
196 | 'msg_html' => [ | |
e501603b TO |
197 | 'name' => 'msg_html', |
198 | 'type' => CRM_Utils_Type::T_LONGTEXT, | |
c3fc2621 | 199 | 'title' => ts('Message Template HTML'), |
215b423e | 200 | 'description' => ts('HTML formatted message'), |
a36434b9 | 201 | 'where' => 'civicrm_msg_template.msg_html', |
522a26c9 | 202 | 'table_name' => 'civicrm_msg_template', |
203 | 'entity' => 'MessageTemplate', | |
204 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 205 | 'localizable' => 0, |
c3fc2621 | 206 | 'html' => [ |
e501603b | 207 | 'type' => 'RichTextEditor', |
c3fc2621 | 208 | ], |
a9d0587b | 209 | 'add' => '1.6', |
c3fc2621 CW |
210 | ], |
211 | 'is_active' => [ | |
e501603b TO |
212 | 'name' => 'is_active', |
213 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 214 | 'title' => ts('Is Active'), |
a36434b9 | 215 | 'where' => 'civicrm_msg_template.is_active', |
e501603b | 216 | 'default' => '1', |
522a26c9 | 217 | 'table_name' => 'civicrm_msg_template', |
218 | 'entity' => 'MessageTemplate', | |
219 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 220 | 'localizable' => 0, |
a9d0587b | 221 | 'add' => '1.6', |
c3fc2621 CW |
222 | ], |
223 | 'workflow_id' => [ | |
e501603b TO |
224 | 'name' => 'workflow_id', |
225 | 'type' => CRM_Utils_Type::T_INT, | |
c4d7103b | 226 | 'title' => ts('Deprecated field for Message Template Workflow.'), |
215b423e | 227 | 'description' => ts('a pseudo-FK to civicrm_option_value'), |
a36434b9 | 228 | 'where' => 'civicrm_msg_template.workflow_id', |
522a26c9 | 229 | 'table_name' => 'civicrm_msg_template', |
230 | 'entity' => 'MessageTemplate', | |
231 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
c4d7103b | 232 | 'localizable' => 0, |
a9d0587b | 233 | 'add' => '3.1', |
c4d7103b | 234 | ], |
235 | 'workflow_name' => [ | |
236 | 'name' => 'workflow_name', | |
237 | 'type' => CRM_Utils_Type::T_STRING, | |
238 | 'title' => ts('Message Template Workflow Name'), | |
239 | 'maxlength' => 255, | |
240 | 'size' => CRM_Utils_Type::HUGE, | |
241 | 'where' => 'civicrm_msg_template.workflow_name', | |
242 | 'table_name' => 'civicrm_msg_template', | |
243 | 'entity' => 'MessageTemplate', | |
244 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 245 | 'localizable' => 0, |
a9d0587b | 246 | 'add' => '5.26', |
c3fc2621 CW |
247 | ], |
248 | 'is_default' => [ | |
e501603b TO |
249 | 'name' => 'is_default', |
250 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 251 | 'title' => ts('Message Template Is Default?'), |
215b423e | 252 | 'description' => ts('is this the default message template for the workflow referenced by workflow_id?'), |
a36434b9 | 253 | 'where' => 'civicrm_msg_template.is_default', |
e501603b | 254 | 'default' => '1', |
522a26c9 | 255 | 'table_name' => 'civicrm_msg_template', |
256 | 'entity' => 'MessageTemplate', | |
257 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 258 | 'localizable' => 0, |
a9d0587b | 259 | 'add' => '3.1', |
c3fc2621 CW |
260 | ], |
261 | 'is_reserved' => [ | |
e501603b TO |
262 | 'name' => 'is_reserved', |
263 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 264 | 'title' => ts('Message Template Is Reserved?'), |
215b423e | 265 | 'description' => ts('is this the reserved message template which we ship for the workflow referenced by workflow_id?'), |
a36434b9 | 266 | 'where' => 'civicrm_msg_template.is_reserved', |
522a26c9 | 267 | 'table_name' => 'civicrm_msg_template', |
268 | 'entity' => 'MessageTemplate', | |
269 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 270 | 'localizable' => 0, |
a9d0587b | 271 | 'add' => '3.1', |
c3fc2621 CW |
272 | ], |
273 | 'is_sms' => [ | |
e501603b TO |
274 | 'name' => 'is_sms', |
275 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 276 | 'title' => ts('Message Template is used for SMS?'), |
215b423e | 277 | 'description' => ts('Is this message template used for sms?'), |
a36434b9 | 278 | 'where' => 'civicrm_msg_template.is_sms', |
45a83e42 | 279 | 'default' => '0', |
522a26c9 | 280 | 'table_name' => 'civicrm_msg_template', |
281 | 'entity' => 'MessageTemplate', | |
282 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 283 | 'localizable' => 0, |
a9d0587b | 284 | 'add' => '4.5', |
c3fc2621 CW |
285 | ], |
286 | 'pdf_format_id' => [ | |
e501603b TO |
287 | 'name' => 'pdf_format_id', |
288 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 289 | 'title' => ts('Message Template Format'), |
215b423e | 290 | 'description' => ts('a pseudo-FK to civicrm_option_value containing PDF Page Format.'), |
a36434b9 | 291 | 'where' => 'civicrm_msg_template.pdf_format_id', |
522a26c9 | 292 | 'table_name' => 'civicrm_msg_template', |
293 | 'entity' => 'MessageTemplate', | |
294 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 295 | 'localizable' => 0, |
c3fc2621 | 296 | 'pseudoconstant' => [ |
e501603b TO |
297 | 'optionGroupName' => 'pdf_format', |
298 | 'keyColumn' => 'id', | |
299 | 'optionEditPath' => 'civicrm/admin/options/pdf_format', | |
e6ca0a57 | 300 | ], |
a9d0587b | 301 | 'add' => '3.4', |
c3fc2621 CW |
302 | ], |
303 | ]; | |
346aaaba | 304 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 305 | } |
346aaaba | 306 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 307 | } |
c3fc2621 | 308 | |
e501603b | 309 | /** |
bd8e0b14 | 310 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
311 | * |
312 | * @return array | |
bd8e0b14 | 313 | * Array(string $name => string $uniqueName). |
e501603b | 314 | */ |
c3fc2621 | 315 | public static function &fieldKeys() { |
bd8e0b14 TO |
316 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
317 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 318 | } |
bd8e0b14 | 319 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 320 | } |
c3fc2621 | 321 | |
e501603b TO |
322 | /** |
323 | * Returns the names of this table | |
324 | * | |
325 | * @return string | |
326 | */ | |
c3fc2621 | 327 | public static function getTableName() { |
e501603b TO |
328 | return self::$_tableName; |
329 | } | |
c3fc2621 | 330 | |
e501603b TO |
331 | /** |
332 | * Returns if this table needs to be logged | |
333 | * | |
c3fc2621 | 334 | * @return bool |
e501603b | 335 | */ |
c3fc2621 | 336 | public function getLog() { |
e501603b TO |
337 | return self::$_log; |
338 | } | |
c3fc2621 | 339 | |
e501603b TO |
340 | /** |
341 | * Returns the list of fields that can be imported | |
342 | * | |
343 | * @param bool $prefix | |
344 | * | |
345 | * @return array | |
346 | */ | |
c3fc2621 CW |
347 | public static function &import($prefix = FALSE) { |
348 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'msg_template', $prefix, []); | |
60808919 | 349 | return $r; |
e501603b | 350 | } |
c3fc2621 | 351 | |
e501603b TO |
352 | /** |
353 | * Returns the list of fields that can be exported | |
354 | * | |
355 | * @param bool $prefix | |
356 | * | |
357 | * @return array | |
358 | */ | |
c3fc2621 CW |
359 | public static function &export($prefix = FALSE) { |
360 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'msg_template', $prefix, []); | |
60808919 | 361 | return $r; |
e501603b | 362 | } |
c3fc2621 | 363 | |
e7a6b91a AS |
364 | /** |
365 | * Returns the list of indices | |
c3fc2621 CW |
366 | * |
367 | * @param bool $localize | |
368 | * | |
369 | * @return array | |
e7a6b91a AS |
370 | */ |
371 | public static function indices($localize = TRUE) { | |
c3fc2621 | 372 | $indices = []; |
e7a6b91a AS |
373 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
374 | } | |
c3fc2621 | 375 | |
e501603b | 376 | } |