Merge pull request #12056 from eileenmcnaughton/pcp
[civicrm-core.git] / CRM / Core / DAO / MessageTemplate.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
8c9251b3 5 * @copyright CiviCRM LLC (c) 2004-2018
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/MessageTemplate.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
022785d8 9 * (GenCodeChecksum:ca87344addd76f0aca31f53071a01238)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the MessageTemplate entity.
f41f0342 14 */
e501603b 15class 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'),
e501603b 126 'description' => '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'),
e501603b
TO
137 'description' => 'Descriptive title of message',
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'),
e501603b 149 'description' => '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'),
e501603b 159 'description' => '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'),
e501603b 172 'description' => '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'),
e501603b 195 'description' => '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?'),
e501603b
TO
205 'description' => 'is this the default message template for the workflow referenced by workflow_id?',
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?'),
e501603b 216 'description' => '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?'),
e501603b 226 'description' => 'Is this message template used for sms?',
522a26c9 227 'table_name' => 'civicrm_msg_template',
228 'entity' => 'MessageTemplate',
229 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 230 'localizable' => 0,
c3fc2621
CW
231 ],
232 'pdf_format_id' => [
e501603b
TO
233 'name' => 'pdf_format_id',
234 'type' => CRM_Utils_Type::T_INT,
c3fc2621 235 'title' => ts('Message Template Format'),
e501603b 236 'description' => 'a pseudo-FK to civicrm_option_value containing PDF Page Format.',
522a26c9 237 'table_name' => 'civicrm_msg_template',
238 'entity' => 'MessageTemplate',
239 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 240 'localizable' => 0,
c3fc2621 241 'pseudoconstant' => [
e501603b
TO
242 'optionGroupName' => 'pdf_format',
243 'keyColumn' => 'id',
244 'optionEditPath' => 'civicrm/admin/options/pdf_format',
c3fc2621
CW
245 ]
246 ],
247 ];
346aaaba 248 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 249 }
346aaaba 250 return Civi::$statics[__CLASS__]['fields'];
e501603b 251 }
c3fc2621 252
e501603b 253 /**
bd8e0b14 254 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
255 *
256 * @return array
bd8e0b14 257 * Array(string $name => string $uniqueName).
e501603b 258 */
c3fc2621 259 public static function &fieldKeys() {
bd8e0b14
TO
260 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
261 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 262 }
bd8e0b14 263 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 264 }
c3fc2621 265
e501603b
TO
266 /**
267 * Returns the names of this table
268 *
269 * @return string
270 */
c3fc2621 271 public static function getTableName() {
e501603b
TO
272 return self::$_tableName;
273 }
c3fc2621 274
e501603b
TO
275 /**
276 * Returns if this table needs to be logged
277 *
c3fc2621 278 * @return bool
e501603b 279 */
c3fc2621 280 public function getLog() {
e501603b
TO
281 return self::$_log;
282 }
c3fc2621 283
e501603b
TO
284 /**
285 * Returns the list of fields that can be imported
286 *
287 * @param bool $prefix
288 *
289 * @return array
290 */
c3fc2621
CW
291 public static function &import($prefix = FALSE) {
292 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'msg_template', $prefix, []);
60808919 293 return $r;
e501603b 294 }
c3fc2621 295
e501603b
TO
296 /**
297 * Returns the list of fields that can be exported
298 *
299 * @param bool $prefix
300 *
301 * @return array
302 */
c3fc2621
CW
303 public static function &export($prefix = FALSE) {
304 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'msg_template', $prefix, []);
60808919 305 return $r;
e501603b 306 }
c3fc2621 307
e7a6b91a
AS
308 /**
309 * Returns the list of indices
c3fc2621
CW
310 *
311 * @param bool $localize
312 *
313 * @return array
e7a6b91a
AS
314 */
315 public static function indices($localize = TRUE) {
c3fc2621 316 $indices = [];
e7a6b91a
AS
317 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
318 }
c3fc2621 319
e501603b 320}