Merge pull request #13197 from seamuslee001/lab_core_442
[civicrm-core.git] / CRM / Core / DAO / MessageTemplate.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2018
6 *
7 * Generated from xml/schema/CRM/Core/MessageTemplate.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:988d404fbe6cd84e14a175f71b3f8440)
10 */
11
12 /**
13 * Database access object for the MessageTemplate entity.
14 */
15 class CRM_Core_DAO_MessageTemplate extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 static $_tableName = 'civicrm_msg_template';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 static $_log = FALSE;
30
31 /**
32 * Message Template ID
33 *
34 * @var int unsigned
35 */
36 public $id;
37
38 /**
39 * Descriptive title of message
40 *
41 * @var string
42 */
43 public $msg_title;
44
45 /**
46 * Subject for email message.
47 *
48 * @var text
49 */
50 public $msg_subject;
51
52 /**
53 * Text formatted message
54 *
55 * @var longtext
56 */
57 public $msg_text;
58
59 /**
60 * HTML formatted message
61 *
62 * @var longtext
63 */
64 public $msg_html;
65
66 /**
67 * @var boolean
68 */
69 public $is_active;
70
71 /**
72 * a pseudo-FK to civicrm_option_value
73 *
74 * @var int unsigned
75 */
76 public $workflow_id;
77
78 /**
79 * is this the default message template for the workflow referenced by workflow_id?
80 *
81 * @var boolean
82 */
83 public $is_default;
84
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;
91
92 /**
93 * Is this message template used for sms?
94 *
95 * @var boolean
96 */
97 public $is_sms;
98
99 /**
100 * a pseudo-FK to civicrm_option_value containing PDF Page Format.
101 *
102 * @var int unsigned
103 */
104 public $pdf_format_id;
105
106 /**
107 * Class constructor.
108 */
109 public function __construct() {
110 $this->__table = 'civicrm_msg_template';
111 parent::__construct();
112 }
113
114 /**
115 * Returns all the column names of this table
116 *
117 * @return array
118 */
119 public static function &fields() {
120 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
121 Civi::$statics[__CLASS__]['fields'] = [
122 'id' => [
123 'name' => 'id',
124 'type' => CRM_Utils_Type::T_INT,
125 'title' => ts('Message Template ID'),
126 'description' => ts('Message Template ID'),
127 'required' => TRUE,
128 'table_name' => 'civicrm_msg_template',
129 'entity' => 'MessageTemplate',
130 'bao' => 'CRM_Core_BAO_MessageTemplate',
131 'localizable' => 0,
132 ],
133 'msg_title' => [
134 'name' => 'msg_title',
135 'type' => CRM_Utils_Type::T_STRING,
136 'title' => ts('Message Template Title'),
137 'description' => ts('Descriptive title of message'),
138 'maxlength' => 255,
139 'size' => CRM_Utils_Type::HUGE,
140 'table_name' => 'civicrm_msg_template',
141 'entity' => 'MessageTemplate',
142 'bao' => 'CRM_Core_BAO_MessageTemplate',
143 'localizable' => 0,
144 ],
145 'msg_subject' => [
146 'name' => 'msg_subject',
147 'type' => CRM_Utils_Type::T_TEXT,
148 'title' => ts('Message Template Subject'),
149 'description' => ts('Subject for email message.'),
150 'table_name' => 'civicrm_msg_template',
151 'entity' => 'MessageTemplate',
152 'bao' => 'CRM_Core_BAO_MessageTemplate',
153 'localizable' => 0,
154 ],
155 'msg_text' => [
156 'name' => 'msg_text',
157 'type' => CRM_Utils_Type::T_LONGTEXT,
158 'title' => ts('Message Template Text'),
159 'description' => ts('Text formatted message'),
160 'table_name' => 'civicrm_msg_template',
161 'entity' => 'MessageTemplate',
162 'bao' => 'CRM_Core_BAO_MessageTemplate',
163 'localizable' => 0,
164 'html' => [
165 'type' => 'TextArea',
166 ],
167 ],
168 'msg_html' => [
169 'name' => 'msg_html',
170 'type' => CRM_Utils_Type::T_LONGTEXT,
171 'title' => ts('Message Template HTML'),
172 'description' => ts('HTML formatted message'),
173 'table_name' => 'civicrm_msg_template',
174 'entity' => 'MessageTemplate',
175 'bao' => 'CRM_Core_BAO_MessageTemplate',
176 'localizable' => 0,
177 'html' => [
178 'type' => 'RichTextEditor',
179 ],
180 ],
181 'is_active' => [
182 'name' => 'is_active',
183 'type' => CRM_Utils_Type::T_BOOLEAN,
184 'title' => ts('Is Active'),
185 'default' => '1',
186 'table_name' => 'civicrm_msg_template',
187 'entity' => 'MessageTemplate',
188 'bao' => 'CRM_Core_BAO_MessageTemplate',
189 'localizable' => 0,
190 ],
191 'workflow_id' => [
192 'name' => 'workflow_id',
193 'type' => CRM_Utils_Type::T_INT,
194 'title' => ts('Message Template Workflow'),
195 'description' => ts('a pseudo-FK to civicrm_option_value'),
196 'table_name' => 'civicrm_msg_template',
197 'entity' => 'MessageTemplate',
198 'bao' => 'CRM_Core_BAO_MessageTemplate',
199 'localizable' => 0,
200 ],
201 'is_default' => [
202 'name' => 'is_default',
203 'type' => CRM_Utils_Type::T_BOOLEAN,
204 'title' => ts('Message Template Is Default?'),
205 'description' => ts('is this the default message template for the workflow referenced by workflow_id?'),
206 'default' => '1',
207 'table_name' => 'civicrm_msg_template',
208 'entity' => 'MessageTemplate',
209 'bao' => 'CRM_Core_BAO_MessageTemplate',
210 'localizable' => 0,
211 ],
212 'is_reserved' => [
213 'name' => 'is_reserved',
214 'type' => CRM_Utils_Type::T_BOOLEAN,
215 'title' => ts('Message Template Is Reserved?'),
216 'description' => ts('is this the reserved message template which we ship for the workflow referenced by workflow_id?'),
217 'table_name' => 'civicrm_msg_template',
218 'entity' => 'MessageTemplate',
219 'bao' => 'CRM_Core_BAO_MessageTemplate',
220 'localizable' => 0,
221 ],
222 'is_sms' => [
223 'name' => 'is_sms',
224 'type' => CRM_Utils_Type::T_BOOLEAN,
225 'title' => ts('Message Template is used for SMS?'),
226 'description' => ts('Is this message template used for sms?'),
227 'default' => '0',
228 'table_name' => 'civicrm_msg_template',
229 'entity' => 'MessageTemplate',
230 'bao' => 'CRM_Core_BAO_MessageTemplate',
231 'localizable' => 0,
232 ],
233 'pdf_format_id' => [
234 'name' => 'pdf_format_id',
235 'type' => CRM_Utils_Type::T_INT,
236 'title' => ts('Message Template Format'),
237 'description' => ts('a pseudo-FK to civicrm_option_value containing PDF Page Format.'),
238 'table_name' => 'civicrm_msg_template',
239 'entity' => 'MessageTemplate',
240 'bao' => 'CRM_Core_BAO_MessageTemplate',
241 'localizable' => 0,
242 'pseudoconstant' => [
243 'optionGroupName' => 'pdf_format',
244 'keyColumn' => 'id',
245 'optionEditPath' => 'civicrm/admin/options/pdf_format',
246 ]
247 ],
248 ];
249 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
250 }
251 return Civi::$statics[__CLASS__]['fields'];
252 }
253
254 /**
255 * Return a mapping from field-name to the corresponding key (as used in fields()).
256 *
257 * @return array
258 * Array(string $name => string $uniqueName).
259 */
260 public static function &fieldKeys() {
261 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
262 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
263 }
264 return Civi::$statics[__CLASS__]['fieldKeys'];
265 }
266
267 /**
268 * Returns the names of this table
269 *
270 * @return string
271 */
272 public static function getTableName() {
273 return self::$_tableName;
274 }
275
276 /**
277 * Returns if this table needs to be logged
278 *
279 * @return bool
280 */
281 public function getLog() {
282 return self::$_log;
283 }
284
285 /**
286 * Returns the list of fields that can be imported
287 *
288 * @param bool $prefix
289 *
290 * @return array
291 */
292 public static function &import($prefix = FALSE) {
293 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'msg_template', $prefix, []);
294 return $r;
295 }
296
297 /**
298 * Returns the list of fields that can be exported
299 *
300 * @param bool $prefix
301 *
302 * @return array
303 */
304 public static function &export($prefix = FALSE) {
305 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'msg_template', $prefix, []);
306 return $r;
307 }
308
309 /**
310 * Returns the list of indices
311 *
312 * @param bool $localize
313 *
314 * @return array
315 */
316 public static function indices($localize = TRUE) {
317 $indices = [];
318 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
319 }
320
321 }