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