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:a2e8de0828f836d42d4dcce19200ab27)
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.
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?
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?
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?
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'),
241 'where' => 'civicrm_msg_template.is_active',
243 'table_name' => 'civicrm_msg_template',
244 'entity' => 'MessageTemplate',
245 'bao' => 'CRM_Core_BAO_MessageTemplate',
250 'name' => 'workflow_id',
251 'type' => CRM_Utils_Type
::T_INT
,
252 'title' => ts('Deprecated field for Message Template Workflow.'),
253 'description' => ts('a pseudo-FK to civicrm_option_value'),
254 'where' => 'civicrm_msg_template.workflow_id',
255 'table_name' => 'civicrm_msg_template',
256 'entity' => 'MessageTemplate',
257 'bao' => 'CRM_Core_BAO_MessageTemplate',
262 'name' => 'workflow_name',
263 'type' => CRM_Utils_Type
::T_STRING
,
264 'title' => ts('Message Template Workflow Name'),
266 'size' => CRM_Utils_Type
::HUGE
,
267 'where' => 'civicrm_msg_template.workflow_name',
268 'table_name' => 'civicrm_msg_template',
269 'entity' => 'MessageTemplate',
270 'bao' => 'CRM_Core_BAO_MessageTemplate',
275 'name' => 'is_default',
276 'type' => CRM_Utils_Type
::T_BOOLEAN
,
277 'title' => ts('Message Template Is Default?'),
278 'description' => ts('is this the default message template for the workflow referenced by workflow_id?'),
280 'where' => 'civicrm_msg_template.is_default',
282 'table_name' => 'civicrm_msg_template',
283 'entity' => 'MessageTemplate',
284 'bao' => 'CRM_Core_BAO_MessageTemplate',
289 'name' => 'is_reserved',
290 'type' => CRM_Utils_Type
::T_BOOLEAN
,
291 'title' => ts('Message Template Is Reserved?'),
292 'description' => ts('is this the reserved message template which we ship for the workflow referenced by workflow_id?'),
294 'where' => 'civicrm_msg_template.is_reserved',
296 'table_name' => 'civicrm_msg_template',
297 'entity' => 'MessageTemplate',
298 'bao' => 'CRM_Core_BAO_MessageTemplate',
304 'type' => CRM_Utils_Type
::T_BOOLEAN
,
305 'title' => ts('Message Template is used for SMS?'),
306 'description' => ts('Is this message template used for sms?'),
308 'where' => 'civicrm_msg_template.is_sms',
310 'table_name' => 'civicrm_msg_template',
311 'entity' => 'MessageTemplate',
312 'bao' => 'CRM_Core_BAO_MessageTemplate',
317 'name' => 'pdf_format_id',
318 'type' => CRM_Utils_Type
::T_INT
,
319 'title' => ts('Message Template Format'),
320 'description' => ts('a pseudo-FK to civicrm_option_value containing PDF Page Format.'),
321 'where' => 'civicrm_msg_template.pdf_format_id',
322 'table_name' => 'civicrm_msg_template',
323 'entity' => 'MessageTemplate',
324 'bao' => 'CRM_Core_BAO_MessageTemplate',
326 'pseudoconstant' => [
327 'optionGroupName' => 'pdf_format',
329 'optionEditPath' => 'civicrm/admin/options/pdf_format',
334 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
336 return Civi
::$statics[__CLASS__
]['fields'];
340 * Return a mapping from field-name to the corresponding key (as used in fields()).
343 * Array(string $name => string $uniqueName).
345 public static function &fieldKeys() {
346 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
347 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
349 return Civi
::$statics[__CLASS__
]['fieldKeys'];
353 * Returns the names of this table
357 public static function getTableName() {
358 return self
::$_tableName;
362 * Returns if this table needs to be logged
366 public function getLog() {
371 * Returns the list of fields that can be imported
373 * @param bool $prefix
377 public static function &import($prefix = FALSE) {
378 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'msg_template', $prefix, []);
383 * Returns the list of fields that can be exported
385 * @param bool $prefix
389 public static function &export($prefix = FALSE) {
390 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'msg_template', $prefix, []);
395 * Returns the list of indices
397 * @param bool $localize
401 public static function indices($localize = TRUE) {
403 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;