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 | |
e380ee3b | 9 | * (GenCodeChecksum:988d404fbe6cd84e14a175f71b3f8440) |
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 | */ | |
22 | 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 | */ |
c3fc2621 CW |
29 | static $_log = FALSE; |
30 | ||
e501603b TO |
31 | /** |
32 | * Message Template ID | |
33 | * | |
34 | * @var int unsigned | |
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 | /** |
e501603b TO |
67 | * @var boolean |
68 | */ | |
69 | public $is_active; | |
c3fc2621 | 70 | |
e501603b TO |
71 | /** |
72 | * a pseudo-FK to civicrm_option_value | |
73 | * | |
74 | * @var int unsigned | |
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 | * | |
81 | * @var boolean | |
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 | * | |
88 | * @var boolean | |
89 | */ | |
90 | public $is_reserved; | |
c3fc2621 | 91 | |
e501603b TO |
92 | /** |
93 | * Is this message template used for sms? | |
94 | * | |
95 | * @var boolean | |
96 | */ | |
97 | public $is_sms; | |
c3fc2621 | 98 | |
e501603b TO |
99 | /** |
100 | * a pseudo-FK to civicrm_option_value containing PDF Page Format. | |
101 | * | |
102 | * @var int unsigned | |
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, |
522a26c9 | 128 | 'table_name' => 'civicrm_msg_template', |
129 | 'entity' => 'MessageTemplate', | |
130 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 131 | 'localizable' => 0, |
c3fc2621 CW |
132 | ], |
133 | 'msg_title' => [ | |
e501603b TO |
134 | 'name' => 'msg_title', |
135 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 136 | 'title' => ts('Message Template Title'), |
215b423e | 137 | 'description' => ts('Descriptive title of message'), |
e501603b TO |
138 | 'maxlength' => 255, |
139 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 140 | 'table_name' => 'civicrm_msg_template', |
141 | 'entity' => 'MessageTemplate', | |
142 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 143 | 'localizable' => 0, |
c3fc2621 CW |
144 | ], |
145 | 'msg_subject' => [ | |
e501603b TO |
146 | 'name' => 'msg_subject', |
147 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 148 | 'title' => ts('Message Template Subject'), |
215b423e | 149 | 'description' => ts('Subject for email message.'), |
522a26c9 | 150 | 'table_name' => 'civicrm_msg_template', |
151 | 'entity' => 'MessageTemplate', | |
152 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 153 | 'localizable' => 0, |
c3fc2621 CW |
154 | ], |
155 | 'msg_text' => [ | |
e501603b TO |
156 | 'name' => 'msg_text', |
157 | 'type' => CRM_Utils_Type::T_LONGTEXT, | |
c3fc2621 | 158 | 'title' => ts('Message Template Text'), |
215b423e | 159 | 'description' => ts('Text formatted message'), |
522a26c9 | 160 | 'table_name' => 'civicrm_msg_template', |
161 | 'entity' => 'MessageTemplate', | |
162 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 163 | 'localizable' => 0, |
c3fc2621 | 164 | 'html' => [ |
e501603b | 165 | 'type' => 'TextArea', |
c3fc2621 CW |
166 | ], |
167 | ], | |
168 | 'msg_html' => [ | |
e501603b TO |
169 | 'name' => 'msg_html', |
170 | 'type' => CRM_Utils_Type::T_LONGTEXT, | |
c3fc2621 | 171 | 'title' => ts('Message Template HTML'), |
215b423e | 172 | 'description' => ts('HTML formatted message'), |
522a26c9 | 173 | 'table_name' => 'civicrm_msg_template', |
174 | 'entity' => 'MessageTemplate', | |
175 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 176 | 'localizable' => 0, |
c3fc2621 | 177 | 'html' => [ |
e501603b | 178 | 'type' => 'RichTextEditor', |
c3fc2621 CW |
179 | ], |
180 | ], | |
181 | 'is_active' => [ | |
e501603b TO |
182 | 'name' => 'is_active', |
183 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 184 | 'title' => ts('Is Active'), |
e501603b | 185 | 'default' => '1', |
522a26c9 | 186 | 'table_name' => 'civicrm_msg_template', |
187 | 'entity' => 'MessageTemplate', | |
188 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 189 | 'localizable' => 0, |
c3fc2621 CW |
190 | ], |
191 | 'workflow_id' => [ | |
e501603b TO |
192 | 'name' => 'workflow_id', |
193 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 194 | 'title' => ts('Message Template Workflow'), |
215b423e | 195 | 'description' => ts('a pseudo-FK to civicrm_option_value'), |
522a26c9 | 196 | 'table_name' => 'civicrm_msg_template', |
197 | 'entity' => 'MessageTemplate', | |
198 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 199 | 'localizable' => 0, |
c3fc2621 CW |
200 | ], |
201 | 'is_default' => [ | |
e501603b TO |
202 | 'name' => 'is_default', |
203 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 204 | 'title' => ts('Message Template Is Default?'), |
215b423e | 205 | 'description' => ts('is this the default message template for the workflow referenced by workflow_id?'), |
e501603b | 206 | 'default' => '1', |
522a26c9 | 207 | 'table_name' => 'civicrm_msg_template', |
208 | 'entity' => 'MessageTemplate', | |
209 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 210 | 'localizable' => 0, |
c3fc2621 CW |
211 | ], |
212 | 'is_reserved' => [ | |
e501603b TO |
213 | 'name' => 'is_reserved', |
214 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 215 | 'title' => ts('Message Template Is Reserved?'), |
215b423e | 216 | 'description' => ts('is this the reserved message template which we ship for the workflow referenced by workflow_id?'), |
522a26c9 | 217 | 'table_name' => 'civicrm_msg_template', |
218 | 'entity' => 'MessageTemplate', | |
219 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 220 | 'localizable' => 0, |
c3fc2621 CW |
221 | ], |
222 | 'is_sms' => [ | |
e501603b TO |
223 | 'name' => 'is_sms', |
224 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 225 | 'title' => ts('Message Template is used for SMS?'), |
215b423e | 226 | 'description' => ts('Is this message template used for sms?'), |
45a83e42 | 227 | 'default' => '0', |
522a26c9 | 228 | 'table_name' => 'civicrm_msg_template', |
229 | 'entity' => 'MessageTemplate', | |
230 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 231 | 'localizable' => 0, |
c3fc2621 CW |
232 | ], |
233 | 'pdf_format_id' => [ | |
e501603b TO |
234 | 'name' => 'pdf_format_id', |
235 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 236 | 'title' => ts('Message Template Format'), |
215b423e | 237 | 'description' => ts('a pseudo-FK to civicrm_option_value containing PDF Page Format.'), |
522a26c9 | 238 | 'table_name' => 'civicrm_msg_template', |
239 | 'entity' => 'MessageTemplate', | |
240 | 'bao' => 'CRM_Core_BAO_MessageTemplate', | |
6a7e5e5d | 241 | 'localizable' => 0, |
c3fc2621 | 242 | 'pseudoconstant' => [ |
e501603b TO |
243 | 'optionGroupName' => 'pdf_format', |
244 | 'keyColumn' => 'id', | |
245 | 'optionEditPath' => 'civicrm/admin/options/pdf_format', | |
c3fc2621 CW |
246 | ] |
247 | ], | |
248 | ]; | |
346aaaba | 249 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 250 | } |
346aaaba | 251 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 252 | } |
c3fc2621 | 253 | |
e501603b | 254 | /** |
bd8e0b14 | 255 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
256 | * |
257 | * @return array | |
bd8e0b14 | 258 | * Array(string $name => string $uniqueName). |
e501603b | 259 | */ |
c3fc2621 | 260 | public static function &fieldKeys() { |
bd8e0b14 TO |
261 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
262 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 263 | } |
bd8e0b14 | 264 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 265 | } |
c3fc2621 | 266 | |
e501603b TO |
267 | /** |
268 | * Returns the names of this table | |
269 | * | |
270 | * @return string | |
271 | */ | |
c3fc2621 | 272 | public static function getTableName() { |
e501603b TO |
273 | return self::$_tableName; |
274 | } | |
c3fc2621 | 275 | |
e501603b TO |
276 | /** |
277 | * Returns if this table needs to be logged | |
278 | * | |
c3fc2621 | 279 | * @return bool |
e501603b | 280 | */ |
c3fc2621 | 281 | public function getLog() { |
e501603b TO |
282 | return self::$_log; |
283 | } | |
c3fc2621 | 284 | |
e501603b TO |
285 | /** |
286 | * Returns the list of fields that can be imported | |
287 | * | |
288 | * @param bool $prefix | |
289 | * | |
290 | * @return array | |
291 | */ | |
c3fc2621 CW |
292 | public static function &import($prefix = FALSE) { |
293 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'msg_template', $prefix, []); | |
60808919 | 294 | return $r; |
e501603b | 295 | } |
c3fc2621 | 296 | |
e501603b TO |
297 | /** |
298 | * Returns the list of fields that can be exported | |
299 | * | |
300 | * @param bool $prefix | |
301 | * | |
302 | * @return array | |
303 | */ | |
c3fc2621 CW |
304 | public static function &export($prefix = FALSE) { |
305 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'msg_template', $prefix, []); | |
60808919 | 306 | return $r; |
e501603b | 307 | } |
c3fc2621 | 308 | |
e7a6b91a AS |
309 | /** |
310 | * Returns the list of indices | |
c3fc2621 CW |
311 | * |
312 | * @param bool $localize | |
313 | * | |
314 | * @return array | |
e7a6b91a AS |
315 | */ |
316 | public static function indices($localize = TRUE) { | |
c3fc2621 | 317 | $indices = []; |
e7a6b91a AS |
318 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
319 | } | |
c3fc2621 | 320 | |
e501603b | 321 | } |