Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
6b83d5bd | 5 | * @copyright CiviCRM LLC (c) 2004-2019 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Core/MessageTemplate.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e6ca0a57 | 9 | * (GenCodeChecksum:334135bbbd8614a2501e1cf56715eb46) |
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 { |
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 | |
e501603b TO |
78 | /** |
79 | * is this the default message template for the workflow referenced by workflow_id? | |
80 | * | |
e6ca0a57 | 81 | * @var bool |
e501603b TO |
82 | */ |
83 | public $is_default; | |
c3fc2621 | 84 | |
e501603b TO |
85 | /** |
86 | * is this the reserved message template which we ship for the workflow referenced by workflow_id? | |
87 | * | |
e6ca0a57 | 88 | * @var bool |
e501603b TO |
89 | */ |
90 | public $is_reserved; | |
c3fc2621 | 91 | |
e501603b TO |
92 | /** |
93 | * Is this message template used for sms? | |
94 | * | |
e6ca0a57 | 95 | * @var bool |
e501603b TO |
96 | */ |
97 | public $is_sms; | |
c3fc2621 | 98 | |
e501603b TO |
99 | /** |
100 | * a pseudo-FK to civicrm_option_value containing PDF Page Format. | |
101 | * | |
e6ca0a57 | 102 | * @var int |
e501603b TO |
103 | */ |
104 | public $pdf_format_id; | |
c3fc2621 | 105 | |
e501603b | 106 | /** |
f41f0342 | 107 | * Class constructor. |
e501603b | 108 | */ |
c3fc2621 | 109 | public function __construct() { |
e501603b TO |
110 | $this->__table = 'civicrm_msg_template'; |
111 | parent::__construct(); | |
112 | } | |
c3fc2621 | 113 | |
e501603b TO |
114 | /** |
115 | * Returns all the column names of this table | |
116 | * | |
117 | * @return array | |
118 | */ | |
c3fc2621 | 119 | public static function &fields() { |
346aaaba | 120 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
121 | Civi::$statics[__CLASS__]['fields'] = [ |
122 | 'id' => [ | |
e501603b TO |
123 | 'name' => 'id', |
124 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 125 | 'title' => ts('Message Template ID'), |
215b423e | 126 | 'description' => ts('Message Template ID'), |
c3fc2621 | 127 | 'required' => TRUE, |
a36434b9 | 128 | 'where' => 'civicrm_msg_template.id', |
522a26c9 | 129 | 'table_name' => 'civicrm_msg_template', |
130 | 'entity' => 'MessageTemplate', | |
131 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 132 | 'localizable' => 0, |
c3fc2621 CW |
133 | ], |
134 | 'msg_title' => [ | |
e501603b TO |
135 | 'name' => 'msg_title', |
136 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 137 | 'title' => ts('Message Template Title'), |
215b423e | 138 | 'description' => ts('Descriptive title of message'), |
e501603b TO |
139 | 'maxlength' => 255, |
140 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 141 | 'where' => 'civicrm_msg_template.msg_title', |
522a26c9 | 142 | 'table_name' => 'civicrm_msg_template', |
143 | 'entity' => 'MessageTemplate', | |
144 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 145 | 'localizable' => 0, |
c3fc2621 CW |
146 | ], |
147 | 'msg_subject' => [ | |
e501603b TO |
148 | 'name' => 'msg_subject', |
149 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 150 | 'title' => ts('Message Template Subject'), |
215b423e | 151 | 'description' => ts('Subject for email message.'), |
a36434b9 | 152 | 'where' => 'civicrm_msg_template.msg_subject', |
522a26c9 | 153 | 'table_name' => 'civicrm_msg_template', |
154 | 'entity' => 'MessageTemplate', | |
155 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 156 | 'localizable' => 0, |
c3fc2621 CW |
157 | ], |
158 | 'msg_text' => [ | |
e501603b TO |
159 | 'name' => 'msg_text', |
160 | 'type' => CRM_Utils_Type::T_LONGTEXT, | |
c3fc2621 | 161 | 'title' => ts('Message Template Text'), |
215b423e | 162 | 'description' => ts('Text formatted message'), |
a36434b9 | 163 | 'where' => 'civicrm_msg_template.msg_text', |
522a26c9 | 164 | 'table_name' => 'civicrm_msg_template', |
165 | 'entity' => 'MessageTemplate', | |
166 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 167 | 'localizable' => 0, |
c3fc2621 | 168 | 'html' => [ |
e501603b | 169 | 'type' => 'TextArea', |
c3fc2621 CW |
170 | ], |
171 | ], | |
172 | 'msg_html' => [ | |
e501603b TO |
173 | 'name' => 'msg_html', |
174 | 'type' => CRM_Utils_Type::T_LONGTEXT, | |
c3fc2621 | 175 | 'title' => ts('Message Template HTML'), |
215b423e | 176 | 'description' => ts('HTML formatted message'), |
a36434b9 | 177 | 'where' => 'civicrm_msg_template.msg_html', |
522a26c9 | 178 | 'table_name' => 'civicrm_msg_template', |
179 | 'entity' => 'MessageTemplate', | |
180 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 181 | 'localizable' => 0, |
c3fc2621 | 182 | 'html' => [ |
e501603b | 183 | 'type' => 'RichTextEditor', |
c3fc2621 CW |
184 | ], |
185 | ], | |
186 | 'is_active' => [ | |
e501603b TO |
187 | 'name' => 'is_active', |
188 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 189 | 'title' => ts('Is Active'), |
a36434b9 | 190 | 'where' => 'civicrm_msg_template.is_active', |
e501603b | 191 | 'default' => '1', |
522a26c9 | 192 | 'table_name' => 'civicrm_msg_template', |
193 | 'entity' => 'MessageTemplate', | |
194 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 195 | 'localizable' => 0, |
c3fc2621 CW |
196 | ], |
197 | 'workflow_id' => [ | |
e501603b TO |
198 | 'name' => 'workflow_id', |
199 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 200 | 'title' => ts('Message Template Workflow'), |
215b423e | 201 | 'description' => ts('a pseudo-FK to civicrm_option_value'), |
a36434b9 | 202 | 'where' => 'civicrm_msg_template.workflow_id', |
522a26c9 | 203 | 'table_name' => 'civicrm_msg_template', |
204 | 'entity' => 'MessageTemplate', | |
205 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 206 | 'localizable' => 0, |
c3fc2621 CW |
207 | ], |
208 | 'is_default' => [ | |
e501603b TO |
209 | 'name' => 'is_default', |
210 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 211 | 'title' => ts('Message Template Is Default?'), |
215b423e | 212 | 'description' => ts('is this the default message template for the workflow referenced by workflow_id?'), |
a36434b9 | 213 | 'where' => 'civicrm_msg_template.is_default', |
e501603b | 214 | 'default' => '1', |
522a26c9 | 215 | 'table_name' => 'civicrm_msg_template', |
216 | 'entity' => 'MessageTemplate', | |
217 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 218 | 'localizable' => 0, |
c3fc2621 CW |
219 | ], |
220 | 'is_reserved' => [ | |
e501603b TO |
221 | 'name' => 'is_reserved', |
222 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 223 | 'title' => ts('Message Template Is Reserved?'), |
215b423e | 224 | 'description' => ts('is this the reserved message template which we ship for the workflow referenced by workflow_id?'), |
a36434b9 | 225 | 'where' => 'civicrm_msg_template.is_reserved', |
522a26c9 | 226 | 'table_name' => 'civicrm_msg_template', |
227 | 'entity' => 'MessageTemplate', | |
228 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 229 | 'localizable' => 0, |
c3fc2621 CW |
230 | ], |
231 | 'is_sms' => [ | |
e501603b TO |
232 | 'name' => 'is_sms', |
233 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 234 | 'title' => ts('Message Template is used for SMS?'), |
215b423e | 235 | 'description' => ts('Is this message template used for sms?'), |
a36434b9 | 236 | 'where' => 'civicrm_msg_template.is_sms', |
45a83e42 | 237 | 'default' => '0', |
522a26c9 | 238 | 'table_name' => 'civicrm_msg_template', |
239 | 'entity' => 'MessageTemplate', | |
240 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 241 | 'localizable' => 0, |
c3fc2621 CW |
242 | ], |
243 | 'pdf_format_id' => [ | |
e501603b TO |
244 | 'name' => 'pdf_format_id', |
245 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 246 | 'title' => ts('Message Template Format'), |
215b423e | 247 | 'description' => ts('a pseudo-FK to civicrm_option_value containing PDF Page Format.'), |
a36434b9 | 248 | 'where' => 'civicrm_msg_template.pdf_format_id', |
522a26c9 | 249 | 'table_name' => 'civicrm_msg_template', |
250 | 'entity' => 'MessageTemplate', | |
251 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 252 | 'localizable' => 0, |
c3fc2621 | 253 | 'pseudoconstant' => [ |
e501603b TO |
254 | 'optionGroupName' => 'pdf_format', |
255 | 'keyColumn' => 'id', | |
256 | 'optionEditPath' => 'civicrm/admin/options/pdf_format', | |
e6ca0a57 | 257 | ], |
c3fc2621 CW |
258 | ], |
259 | ]; | |
346aaaba | 260 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 261 | } |
346aaaba | 262 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 263 | } |
c3fc2621 | 264 | |
e501603b | 265 | /** |
bd8e0b14 | 266 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
267 | * |
268 | * @return array | |
bd8e0b14 | 269 | * Array(string $name => string $uniqueName). |
e501603b | 270 | */ |
c3fc2621 | 271 | public static function &fieldKeys() { |
bd8e0b14 TO |
272 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
273 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 274 | } |
bd8e0b14 | 275 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 276 | } |
c3fc2621 | 277 | |
e501603b TO |
278 | /** |
279 | * Returns the names of this table | |
280 | * | |
281 | * @return string | |
282 | */ | |
c3fc2621 | 283 | public static function getTableName() { |
e501603b TO |
284 | return self::$_tableName; |
285 | } | |
c3fc2621 | 286 | |
e501603b TO |
287 | /** |
288 | * Returns if this table needs to be logged | |
289 | * | |
c3fc2621 | 290 | * @return bool |
e501603b | 291 | */ |
c3fc2621 | 292 | public function getLog() { |
e501603b TO |
293 | return self::$_log; |
294 | } | |
c3fc2621 | 295 | |
e501603b TO |
296 | /** |
297 | * Returns the list of fields that can be imported | |
298 | * | |
299 | * @param bool $prefix | |
300 | * | |
301 | * @return array | |
302 | */ | |
c3fc2621 CW |
303 | public static function &import($prefix = FALSE) { |
304 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'msg_template', $prefix, []); | |
60808919 | 305 | return $r; |
e501603b | 306 | } |
c3fc2621 | 307 | |
e501603b TO |
308 | /** |
309 | * Returns the list of fields that can be exported | |
310 | * | |
311 | * @param bool $prefix | |
312 | * | |
313 | * @return array | |
314 | */ | |
c3fc2621 CW |
315 | public static function &export($prefix = FALSE) { |
316 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'msg_template', $prefix, []); | |
60808919 | 317 | return $r; |
e501603b | 318 | } |
c3fc2621 | 319 | |
e7a6b91a AS |
320 | /** |
321 | * Returns the list of indices | |
c3fc2621 CW |
322 | * |
323 | * @param bool $localize | |
324 | * | |
325 | * @return array | |
e7a6b91a AS |
326 | */ |
327 | public static function indices($localize = TRUE) { | |
c3fc2621 | 328 | $indices = []; |
e7a6b91a AS |
329 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
330 | } | |
c3fc2621 | 331 | |
e501603b | 332 | } |