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