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:6881b34cbbefc06722c58fe7f20b1c58)
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;
41 * Descriptive title of message
48 * Subject for email message.
55 * Text formatted message
62 * HTML formatted message
74 * a pseudo-FK to civicrm_option_value
83 public $workflow_name;
86 * is this the default message template for the workflow referenced by workflow_id?
93 * is this the reserved message template which we ship for the workflow referenced by workflow_id?
100 * Is this message template used for sms?
107 * a pseudo-FK to civicrm_option_value containing PDF Page Format.
111 public $pdf_format_id;
116 public function __construct() {
117 $this->__table
= 'civicrm_msg_template';
118 parent
::__construct();
122 * Returns localized title of this entity.
124 * @param bool $plural
125 * Whether to return the plural version of the title.
127 public static function getEntityTitle($plural = FALSE) {
128 return $plural ?
ts('Message Templates') : ts('Message Template');
132 * Returns all the column names of this table
136 public static function &fields() {
137 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
138 Civi
::$statics[__CLASS__
]['fields'] = [
141 'type' => CRM_Utils_Type
::T_INT
,
142 'title' => ts('Message Template ID'),
143 'description' => ts('Message Template ID'),
145 'where' => 'civicrm_msg_template.id',
146 'table_name' => 'civicrm_msg_template',
147 'entity' => 'MessageTemplate',
148 'bao' => 'CRM_Core_BAO_MessageTemplate',
153 'name' => 'msg_title',
154 'type' => CRM_Utils_Type
::T_STRING
,
155 'title' => ts('Message Template Title'),
156 'description' => ts('Descriptive title of message'),
158 'size' => CRM_Utils_Type
::HUGE
,
159 'where' => 'civicrm_msg_template.msg_title',
160 'table_name' => 'civicrm_msg_template',
161 'entity' => 'MessageTemplate',
162 'bao' => 'CRM_Core_BAO_MessageTemplate',
167 'name' => 'msg_subject',
168 'type' => CRM_Utils_Type
::T_TEXT
,
169 'title' => ts('Message Template Subject'),
170 'description' => ts('Subject for email message.'),
171 'where' => 'civicrm_msg_template.msg_subject',
172 'table_name' => 'civicrm_msg_template',
173 'entity' => 'MessageTemplate',
174 'bao' => 'CRM_Core_BAO_MessageTemplate',
179 'name' => 'msg_text',
180 'type' => CRM_Utils_Type
::T_LONGTEXT
,
181 'title' => ts('Message Template Text'),
182 'description' => ts('Text formatted message'),
183 'where' => 'civicrm_msg_template.msg_text',
184 'table_name' => 'civicrm_msg_template',
185 'entity' => 'MessageTemplate',
186 'bao' => 'CRM_Core_BAO_MessageTemplate',
189 'type' => 'TextArea',
194 'name' => 'msg_html',
195 'type' => CRM_Utils_Type
::T_LONGTEXT
,
196 'title' => ts('Message Template HTML'),
197 'description' => ts('HTML formatted message'),
198 'where' => 'civicrm_msg_template.msg_html',
199 'table_name' => 'civicrm_msg_template',
200 'entity' => 'MessageTemplate',
201 'bao' => 'CRM_Core_BAO_MessageTemplate',
204 'type' => 'RichTextEditor',
209 'name' => 'is_active',
210 'type' => CRM_Utils_Type
::T_BOOLEAN
,
211 'title' => ts('Is Active'),
212 'where' => 'civicrm_msg_template.is_active',
214 'table_name' => 'civicrm_msg_template',
215 'entity' => 'MessageTemplate',
216 'bao' => 'CRM_Core_BAO_MessageTemplate',
221 'name' => 'workflow_id',
222 'type' => CRM_Utils_Type
::T_INT
,
223 'title' => ts('Deprecated field for Message Template Workflow.'),
224 'description' => ts('a pseudo-FK to civicrm_option_value'),
225 'where' => 'civicrm_msg_template.workflow_id',
226 'table_name' => 'civicrm_msg_template',
227 'entity' => 'MessageTemplate',
228 'bao' => 'CRM_Core_BAO_MessageTemplate',
233 'name' => 'workflow_name',
234 'type' => CRM_Utils_Type
::T_STRING
,
235 'title' => ts('Message Template Workflow Name'),
237 'size' => CRM_Utils_Type
::HUGE
,
238 'where' => 'civicrm_msg_template.workflow_name',
239 'table_name' => 'civicrm_msg_template',
240 'entity' => 'MessageTemplate',
241 'bao' => 'CRM_Core_BAO_MessageTemplate',
246 'name' => 'is_default',
247 'type' => CRM_Utils_Type
::T_BOOLEAN
,
248 'title' => ts('Message Template Is Default?'),
249 'description' => ts('is this the default message template for the workflow referenced by workflow_id?'),
250 'where' => 'civicrm_msg_template.is_default',
252 'table_name' => 'civicrm_msg_template',
253 'entity' => 'MessageTemplate',
254 'bao' => 'CRM_Core_BAO_MessageTemplate',
259 'name' => 'is_reserved',
260 'type' => CRM_Utils_Type
::T_BOOLEAN
,
261 'title' => ts('Message Template Is Reserved?'),
262 'description' => ts('is this the reserved message template which we ship for the workflow referenced by workflow_id?'),
263 'where' => 'civicrm_msg_template.is_reserved',
264 'table_name' => 'civicrm_msg_template',
265 'entity' => 'MessageTemplate',
266 'bao' => 'CRM_Core_BAO_MessageTemplate',
272 'type' => CRM_Utils_Type
::T_BOOLEAN
,
273 'title' => ts('Message Template is used for SMS?'),
274 'description' => ts('Is this message template used for sms?'),
275 'where' => 'civicrm_msg_template.is_sms',
277 'table_name' => 'civicrm_msg_template',
278 'entity' => 'MessageTemplate',
279 'bao' => 'CRM_Core_BAO_MessageTemplate',
284 'name' => 'pdf_format_id',
285 'type' => CRM_Utils_Type
::T_INT
,
286 'title' => ts('Message Template Format'),
287 'description' => ts('a pseudo-FK to civicrm_option_value containing PDF Page Format.'),
288 'where' => 'civicrm_msg_template.pdf_format_id',
289 'table_name' => 'civicrm_msg_template',
290 'entity' => 'MessageTemplate',
291 'bao' => 'CRM_Core_BAO_MessageTemplate',
293 'pseudoconstant' => [
294 'optionGroupName' => 'pdf_format',
296 'optionEditPath' => 'civicrm/admin/options/pdf_format',
301 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
303 return Civi
::$statics[__CLASS__
]['fields'];
307 * Return a mapping from field-name to the corresponding key (as used in fields()).
310 * Array(string $name => string $uniqueName).
312 public static function &fieldKeys() {
313 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
314 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
316 return Civi
::$statics[__CLASS__
]['fieldKeys'];
320 * Returns the names of this table
324 public static function getTableName() {
325 return self
::$_tableName;
329 * Returns if this table needs to be logged
333 public function getLog() {
338 * Returns the list of fields that can be imported
340 * @param bool $prefix
344 public static function &import($prefix = FALSE) {
345 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'msg_template', $prefix, []);
350 * Returns the list of fields that can be exported
352 * @param bool $prefix
356 public static function &export($prefix = FALSE) {
357 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'msg_template', $prefix, []);
362 * Returns the list of indices
364 * @param bool $localize
368 public static function indices($localize = TRUE) {
370 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;