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:10bf11ca59e77fe7be9dfd775e5d5cd0)
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',
157 'name' => 'msg_title',
158 'type' => CRM_Utils_Type
::T_STRING
,
159 'title' => ts('Message Template Title'),
160 'description' => ts('Descriptive title of message'),
162 'size' => CRM_Utils_Type
::HUGE
,
163 'where' => 'civicrm_msg_template.msg_title',
164 'table_name' => 'civicrm_msg_template',
165 'entity' => 'MessageTemplate',
166 'bao' => 'CRM_Core_BAO_MessageTemplate',
171 'name' => 'msg_subject',
172 'type' => CRM_Utils_Type
::T_TEXT
,
173 'title' => ts('Message Template Subject'),
174 'description' => ts('Subject for email message.'),
175 'where' => 'civicrm_msg_template.msg_subject',
176 'table_name' => 'civicrm_msg_template',
177 'entity' => 'MessageTemplate',
178 'bao' => 'CRM_Core_BAO_MessageTemplate',
183 'name' => 'msg_text',
184 'type' => CRM_Utils_Type
::T_LONGTEXT
,
185 'title' => ts('Message Template Text'),
186 'description' => ts('Text formatted message'),
187 'where' => 'civicrm_msg_template.msg_text',
188 'table_name' => 'civicrm_msg_template',
189 'entity' => 'MessageTemplate',
190 'bao' => 'CRM_Core_BAO_MessageTemplate',
193 'type' => 'TextArea',
198 'name' => 'msg_html',
199 'type' => CRM_Utils_Type
::T_LONGTEXT
,
200 'title' => ts('Message Template HTML'),
201 'description' => ts('HTML formatted message'),
202 'where' => 'civicrm_msg_template.msg_html',
203 'table_name' => 'civicrm_msg_template',
204 'entity' => 'MessageTemplate',
205 'bao' => 'CRM_Core_BAO_MessageTemplate',
208 'type' => 'RichTextEditor',
213 'name' => 'is_active',
214 'type' => CRM_Utils_Type
::T_BOOLEAN
,
215 'title' => ts('Is Active'),
216 'where' => 'civicrm_msg_template.is_active',
218 'table_name' => 'civicrm_msg_template',
219 'entity' => 'MessageTemplate',
220 'bao' => 'CRM_Core_BAO_MessageTemplate',
225 'name' => 'workflow_id',
226 'type' => CRM_Utils_Type
::T_INT
,
227 'title' => ts('Deprecated field for Message Template Workflow.'),
228 'description' => ts('a pseudo-FK to civicrm_option_value'),
229 'where' => 'civicrm_msg_template.workflow_id',
230 'table_name' => 'civicrm_msg_template',
231 'entity' => 'MessageTemplate',
232 'bao' => 'CRM_Core_BAO_MessageTemplate',
237 'name' => 'workflow_name',
238 'type' => CRM_Utils_Type
::T_STRING
,
239 'title' => ts('Message Template Workflow Name'),
241 'size' => CRM_Utils_Type
::HUGE
,
242 'where' => 'civicrm_msg_template.workflow_name',
243 'table_name' => 'civicrm_msg_template',
244 'entity' => 'MessageTemplate',
245 'bao' => 'CRM_Core_BAO_MessageTemplate',
250 'name' => 'is_default',
251 'type' => CRM_Utils_Type
::T_BOOLEAN
,
252 'title' => ts('Message Template Is Default?'),
253 'description' => ts('is this the default message template for the workflow referenced by workflow_id?'),
254 'where' => 'civicrm_msg_template.is_default',
256 'table_name' => 'civicrm_msg_template',
257 'entity' => 'MessageTemplate',
258 'bao' => 'CRM_Core_BAO_MessageTemplate',
263 'name' => 'is_reserved',
264 'type' => CRM_Utils_Type
::T_BOOLEAN
,
265 'title' => ts('Message Template Is Reserved?'),
266 'description' => ts('is this the reserved message template which we ship for the workflow referenced by workflow_id?'),
267 'where' => 'civicrm_msg_template.is_reserved',
268 'table_name' => 'civicrm_msg_template',
269 'entity' => 'MessageTemplate',
270 'bao' => 'CRM_Core_BAO_MessageTemplate',
276 'type' => CRM_Utils_Type
::T_BOOLEAN
,
277 'title' => ts('Message Template is used for SMS?'),
278 'description' => ts('Is this message template used for sms?'),
279 'where' => 'civicrm_msg_template.is_sms',
281 'table_name' => 'civicrm_msg_template',
282 'entity' => 'MessageTemplate',
283 'bao' => 'CRM_Core_BAO_MessageTemplate',
288 'name' => 'pdf_format_id',
289 'type' => CRM_Utils_Type
::T_INT
,
290 'title' => ts('Message Template Format'),
291 'description' => ts('a pseudo-FK to civicrm_option_value containing PDF Page Format.'),
292 'where' => 'civicrm_msg_template.pdf_format_id',
293 'table_name' => 'civicrm_msg_template',
294 'entity' => 'MessageTemplate',
295 'bao' => 'CRM_Core_BAO_MessageTemplate',
297 'pseudoconstant' => [
298 'optionGroupName' => 'pdf_format',
300 'optionEditPath' => 'civicrm/admin/options/pdf_format',
305 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
307 return Civi
::$statics[__CLASS__
]['fields'];
311 * Return a mapping from field-name to the corresponding key (as used in fields()).
314 * Array(string $name => string $uniqueName).
316 public static function &fieldKeys() {
317 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
318 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
320 return Civi
::$statics[__CLASS__
]['fieldKeys'];
324 * Returns the names of this table
328 public static function getTableName() {
329 return self
::$_tableName;
333 * Returns if this table needs to be logged
337 public function getLog() {
342 * Returns the list of fields that can be imported
344 * @param bool $prefix
348 public static function &import($prefix = FALSE) {
349 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'msg_template', $prefix, []);
354 * Returns the list of fields that can be exported
356 * @param bool $prefix
360 public static function &export($prefix = FALSE) {
361 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'msg_template', $prefix, []);
366 * Returns the list of indices
368 * @param bool $localize
372 public static function indices($localize = TRUE) {
374 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;