5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/MessageTemplate.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:1fba7635baeb10d95b90c02ca4ea99c6)
13 * Database access object for the MessageTemplate entity.
15 class CRM_Core_DAO_MessageTemplate
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.6';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_msg_template';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = FALSE;
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
43 * Descriptive title of message
46 * (SQL type: varchar(255))
47 * Note that values will be retrieved from the database as a string.
52 * Subject for email message.
56 * Note that values will be retrieved from the database as a string.
61 * Text formatted message
64 * (SQL type: longtext)
65 * Note that values will be retrieved from the database as a string.
70 * HTML formatted message
73 * (SQL type: longtext)
74 * Note that values will be retrieved from the database as a string.
79 * @var bool|string|null
81 * Note that values will be retrieved from the database as a string.
86 * a pseudo-FK to civicrm_option_value
88 * @var int|string|null
89 * (SQL type: int unsigned)
90 * Note that values will be retrieved from the database as a string.
96 * (SQL type: varchar(255))
97 * Note that values will be retrieved from the database as a string.
99 public $workflow_name;
102 * is this the default message template for the workflow referenced by workflow_id?
104 * @var bool|string|null
105 * (SQL type: tinyint)
106 * Note that values will be retrieved from the database as a string.
111 * is this the reserved message template which we ship for the workflow referenced by workflow_id?
113 * @var bool|string|null
114 * (SQL type: tinyint)
115 * Note that values will be retrieved from the database as a string.
120 * Is this message template used for sms?
122 * @var bool|string|null
123 * (SQL type: tinyint)
124 * Note that values will be retrieved from the database as a string.
129 * a pseudo-FK to civicrm_option_value containing PDF Page Format.
131 * @var int|string|null
132 * (SQL type: int unsigned)
133 * Note that values will be retrieved from the database as a string.
135 public $pdf_format_id;
140 public function __construct() {
141 $this->__table
= 'civicrm_msg_template';
142 parent
::__construct();
146 * Returns localized title of this entity.
148 * @param bool $plural
149 * Whether to return the plural version of the title.
151 public static function getEntityTitle($plural = FALSE) {
152 return $plural ?
ts('Message Templates') : ts('Message Template');
156 * Returns all the column names of this table
160 public static function &fields() {
161 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
162 Civi
::$statics[__CLASS__
]['fields'] = [
165 'type' => CRM_Utils_Type
::T_INT
,
166 'title' => ts('Message Template ID'),
167 'description' => ts('Message Template ID'),
169 'where' => 'civicrm_msg_template.id',
170 'table_name' => 'civicrm_msg_template',
171 'entity' => 'MessageTemplate',
172 'bao' => 'CRM_Core_BAO_MessageTemplate',
181 'name' => 'msg_title',
182 'type' => CRM_Utils_Type
::T_STRING
,
183 'title' => ts('Message Template Title'),
184 'description' => ts('Descriptive title of message'),
186 'size' => CRM_Utils_Type
::HUGE
,
187 'where' => 'civicrm_msg_template.msg_title',
188 'table_name' => 'civicrm_msg_template',
189 'entity' => 'MessageTemplate',
190 'bao' => 'CRM_Core_BAO_MessageTemplate',
195 'name' => 'msg_subject',
196 'type' => CRM_Utils_Type
::T_TEXT
,
197 'title' => ts('Message Template Subject'),
198 'description' => ts('Subject for email message.'),
199 'where' => 'civicrm_msg_template.msg_subject',
200 'table_name' => 'civicrm_msg_template',
201 'entity' => 'MessageTemplate',
202 'bao' => 'CRM_Core_BAO_MessageTemplate',
207 'name' => 'msg_text',
208 'type' => CRM_Utils_Type
::T_LONGTEXT
,
209 'title' => ts('Message Template Text'),
210 'description' => ts('Text formatted message'),
211 'where' => 'civicrm_msg_template.msg_text',
212 'table_name' => 'civicrm_msg_template',
213 'entity' => 'MessageTemplate',
214 'bao' => 'CRM_Core_BAO_MessageTemplate',
217 'type' => 'TextArea',
222 'name' => 'msg_html',
223 'type' => CRM_Utils_Type
::T_LONGTEXT
,
224 'title' => ts('Message Template HTML'),
225 'description' => ts('HTML formatted message'),
226 'where' => 'civicrm_msg_template.msg_html',
227 'table_name' => 'civicrm_msg_template',
228 'entity' => 'MessageTemplate',
229 'bao' => 'CRM_Core_BAO_MessageTemplate',
232 'type' => 'RichTextEditor',
237 'name' => 'is_active',
238 'type' => CRM_Utils_Type
::T_BOOLEAN
,
239 'title' => ts('Is Active'),
240 'where' => 'civicrm_msg_template.is_active',
242 'table_name' => 'civicrm_msg_template',
243 'entity' => 'MessageTemplate',
244 'bao' => 'CRM_Core_BAO_MessageTemplate',
249 'name' => 'workflow_id',
250 'type' => CRM_Utils_Type
::T_INT
,
251 'title' => ts('Deprecated field for Message Template Workflow.'),
252 'description' => ts('a pseudo-FK to civicrm_option_value'),
253 'where' => 'civicrm_msg_template.workflow_id',
254 'table_name' => 'civicrm_msg_template',
255 'entity' => 'MessageTemplate',
256 'bao' => 'CRM_Core_BAO_MessageTemplate',
261 'name' => 'workflow_name',
262 'type' => CRM_Utils_Type
::T_STRING
,
263 'title' => ts('Message Template Workflow Name'),
265 'size' => CRM_Utils_Type
::HUGE
,
266 'where' => 'civicrm_msg_template.workflow_name',
267 'table_name' => 'civicrm_msg_template',
268 'entity' => 'MessageTemplate',
269 'bao' => 'CRM_Core_BAO_MessageTemplate',
274 'name' => 'is_default',
275 'type' => CRM_Utils_Type
::T_BOOLEAN
,
276 'title' => ts('Message Template Is Default?'),
277 'description' => ts('is this the default message template for the workflow referenced by workflow_id?'),
278 'where' => 'civicrm_msg_template.is_default',
280 'table_name' => 'civicrm_msg_template',
281 'entity' => 'MessageTemplate',
282 'bao' => 'CRM_Core_BAO_MessageTemplate',
287 'name' => 'is_reserved',
288 'type' => CRM_Utils_Type
::T_BOOLEAN
,
289 'title' => ts('Message Template Is Reserved?'),
290 'description' => ts('is this the reserved message template which we ship for the workflow referenced by workflow_id?'),
291 'where' => 'civicrm_msg_template.is_reserved',
293 'table_name' => 'civicrm_msg_template',
294 'entity' => 'MessageTemplate',
295 'bao' => 'CRM_Core_BAO_MessageTemplate',
301 'type' => CRM_Utils_Type
::T_BOOLEAN
,
302 'title' => ts('Message Template is used for SMS?'),
303 'description' => ts('Is this message template used for sms?'),
304 'where' => 'civicrm_msg_template.is_sms',
306 'table_name' => 'civicrm_msg_template',
307 'entity' => 'MessageTemplate',
308 'bao' => 'CRM_Core_BAO_MessageTemplate',
313 'name' => 'pdf_format_id',
314 'type' => CRM_Utils_Type
::T_INT
,
315 'title' => ts('Message Template Format'),
316 'description' => ts('a pseudo-FK to civicrm_option_value containing PDF Page Format.'),
317 'where' => 'civicrm_msg_template.pdf_format_id',
318 'table_name' => 'civicrm_msg_template',
319 'entity' => 'MessageTemplate',
320 'bao' => 'CRM_Core_BAO_MessageTemplate',
322 'pseudoconstant' => [
323 'optionGroupName' => 'pdf_format',
325 'optionEditPath' => 'civicrm/admin/options/pdf_format',
330 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
332 return Civi
::$statics[__CLASS__
]['fields'];
336 * Return a mapping from field-name to the corresponding key (as used in fields()).
339 * Array(string $name => string $uniqueName).
341 public static function &fieldKeys() {
342 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
343 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
345 return Civi
::$statics[__CLASS__
]['fieldKeys'];
349 * Returns the names of this table
353 public static function getTableName() {
354 return self
::$_tableName;
358 * Returns if this table needs to be logged
362 public function getLog() {
367 * Returns the list of fields that can be imported
369 * @param bool $prefix
373 public static function &import($prefix = FALSE) {
374 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'msg_template', $prefix, []);
379 * Returns the list of fields that can be exported
381 * @param bool $prefix
385 public static function &export($prefix = FALSE) {
386 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'msg_template', $prefix, []);
391 * Returns the list of indices
393 * @param bool $localize
397 public static function indices($localize = TRUE) {
399 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;