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