CRM-20312 Add indices to DAO classes
[civicrm-core.git] / CRM / Core / DAO / MessageTemplate.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
0f03f337 6| Copyright CiviCRM LLC (c) 2004-2017 |
e501603b
TO
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
10| CiviCRM is free software; you can copy, modify, and distribute it |
11| under the terms of the GNU Affero General Public License |
12| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13| |
14| CiviCRM is distributed in the hope that it will be useful, but |
15| WITHOUT ANY WARRANTY; without even the implied warranty of |
16| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17| See the GNU Affero General Public License for more details. |
18| |
19| You should have received a copy of the GNU Affero General Public |
20| License and the CiviCRM Licensing Exception along |
21| with this program; if not, contact CiviCRM LLC |
22| at info[AT]civicrm[DOT]org. If you have questions about the |
23| GNU Affero General Public License or the licensing of CiviCRM, |
24| see the CiviCRM license FAQ at http://civicrm.org/licensing |
25+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
0f03f337 29 * @copyright CiviCRM LLC (c) 2004-2017
e501603b
TO
30 *
31 * Generated from xml/schema/CRM/Core/MessageTemplate.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
022785d8 33 * (GenCodeChecksum:ca87344addd76f0aca31f53071a01238)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_Core_DAO_MessageTemplate constructor.
39 */
e501603b
TO
40class CRM_Core_DAO_MessageTemplate extends CRM_Core_DAO {
41 /**
f41f0342 42 * Static instance to hold the table name.
e501603b
TO
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_msg_template';
e501603b 47 /**
f41f0342 48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b
TO
49 *
50 * @var boolean
51 */
52 static $_log = false;
53 /**
54 * Message Template ID
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * Descriptive title of message
61 *
62 * @var string
63 */
64 public $msg_title;
65 /**
66 * Subject for email message.
67 *
68 * @var text
69 */
70 public $msg_subject;
71 /**
72 * Text formatted message
73 *
74 * @var longtext
75 */
76 public $msg_text;
77 /**
78 * HTML formatted message
79 *
80 * @var longtext
81 */
82 public $msg_html;
83 /**
84 *
85 * @var boolean
86 */
87 public $is_active;
88 /**
89 * a pseudo-FK to civicrm_option_value
90 *
91 * @var int unsigned
92 */
93 public $workflow_id;
94 /**
95 * is this the default message template for the workflow referenced by workflow_id?
96 *
97 * @var boolean
98 */
99 public $is_default;
100 /**
101 * is this the reserved message template which we ship for the workflow referenced by workflow_id?
102 *
103 * @var boolean
104 */
105 public $is_reserved;
106 /**
107 * Is this message template used for sms?
108 *
109 * @var boolean
110 */
111 public $is_sms;
112 /**
113 * a pseudo-FK to civicrm_option_value containing PDF Page Format.
114 *
115 * @var int unsigned
116 */
117 public $pdf_format_id;
118 /**
f41f0342 119 * Class constructor.
e501603b
TO
120 */
121 function __construct() {
122 $this->__table = 'civicrm_msg_template';
123 parent::__construct();
124 }
125 /**
126 * Returns all the column names of this table
127 *
128 * @return array
129 */
130 static function &fields() {
346aaaba
TO
131 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
132 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
133 'id' => array(
134 'name' => 'id',
135 'type' => CRM_Utils_Type::T_INT,
136 'title' => ts('Message Template ID') ,
137 'description' => 'Message Template ID',
138 'required' => true,
522a26c9 139 'table_name' => 'civicrm_msg_template',
140 'entity' => 'MessageTemplate',
141 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 142 'localizable' => 0,
e501603b
TO
143 ) ,
144 'msg_title' => array(
145 'name' => 'msg_title',
146 'type' => CRM_Utils_Type::T_STRING,
147 'title' => ts('Message Template Title') ,
148 'description' => 'Descriptive title of message',
149 'maxlength' => 255,
150 'size' => CRM_Utils_Type::HUGE,
522a26c9 151 'table_name' => 'civicrm_msg_template',
152 'entity' => 'MessageTemplate',
153 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 154 'localizable' => 0,
e501603b
TO
155 ) ,
156 'msg_subject' => array(
157 'name' => 'msg_subject',
158 'type' => CRM_Utils_Type::T_TEXT,
159 'title' => ts('Message Template Subject') ,
160 'description' => 'Subject for email message.',
522a26c9 161 'table_name' => 'civicrm_msg_template',
162 'entity' => 'MessageTemplate',
163 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 164 'localizable' => 0,
e501603b
TO
165 ) ,
166 'msg_text' => array(
167 'name' => 'msg_text',
168 'type' => CRM_Utils_Type::T_LONGTEXT,
169 'title' => ts('Message Template Text') ,
170 'description' => 'Text formatted message',
522a26c9 171 'table_name' => 'civicrm_msg_template',
172 'entity' => 'MessageTemplate',
173 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 174 'localizable' => 0,
e501603b
TO
175 'html' => array(
176 'type' => 'TextArea',
177 ) ,
178 ) ,
179 'msg_html' => array(
180 'name' => 'msg_html',
181 'type' => CRM_Utils_Type::T_LONGTEXT,
182 'title' => ts('Message Template HTML') ,
183 'description' => 'HTML formatted message',
522a26c9 184 'table_name' => 'civicrm_msg_template',
185 'entity' => 'MessageTemplate',
186 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 187 'localizable' => 0,
e501603b
TO
188 'html' => array(
189 'type' => 'RichTextEditor',
190 ) ,
191 ) ,
192 'is_active' => array(
193 'name' => 'is_active',
194 'type' => CRM_Utils_Type::T_BOOLEAN,
195 'title' => ts('Is Active') ,
196 'default' => '1',
522a26c9 197 'table_name' => 'civicrm_msg_template',
198 'entity' => 'MessageTemplate',
199 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 200 'localizable' => 0,
e501603b
TO
201 ) ,
202 'workflow_id' => array(
203 'name' => 'workflow_id',
204 'type' => CRM_Utils_Type::T_INT,
205 'title' => ts('Message Template Workflow') ,
206 'description' => 'a pseudo-FK to civicrm_option_value',
522a26c9 207 'table_name' => 'civicrm_msg_template',
208 'entity' => 'MessageTemplate',
209 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 210 'localizable' => 0,
e501603b
TO
211 ) ,
212 'is_default' => array(
213 'name' => 'is_default',
214 'type' => CRM_Utils_Type::T_BOOLEAN,
215 'title' => ts('Message Template Is Default?') ,
216 'description' => 'is this the default message template for the workflow referenced by workflow_id?',
217 'default' => '1',
522a26c9 218 'table_name' => 'civicrm_msg_template',
219 'entity' => 'MessageTemplate',
220 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 221 'localizable' => 0,
e501603b
TO
222 ) ,
223 'is_reserved' => array(
224 'name' => 'is_reserved',
225 'type' => CRM_Utils_Type::T_BOOLEAN,
226 'title' => ts('Message Template Is Reserved?') ,
227 'description' => 'is this the reserved message template which we ship for the workflow referenced by workflow_id?',
522a26c9 228 'table_name' => 'civicrm_msg_template',
229 'entity' => 'MessageTemplate',
230 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 231 'localizable' => 0,
e501603b
TO
232 ) ,
233 'is_sms' => array(
234 'name' => 'is_sms',
235 'type' => CRM_Utils_Type::T_BOOLEAN,
236 'title' => ts('Message Template is used for SMS?') ,
237 'description' => 'Is this message template used for sms?',
522a26c9 238 'table_name' => 'civicrm_msg_template',
239 'entity' => 'MessageTemplate',
240 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 241 'localizable' => 0,
e501603b
TO
242 ) ,
243 'pdf_format_id' => array(
244 'name' => 'pdf_format_id',
245 'type' => CRM_Utils_Type::T_INT,
246 'title' => ts('Message Template Format') ,
247 'description' => 'a pseudo-FK to civicrm_option_value containing PDF Page Format.',
522a26c9 248 'table_name' => 'civicrm_msg_template',
249 'entity' => 'MessageTemplate',
250 'bao' => 'CRM_Core_BAO_MessageTemplate',
6a7e5e5d 251 'localizable' => 0,
e501603b
TO
252 'pseudoconstant' => array(
253 'optionGroupName' => 'pdf_format',
254 'keyColumn' => 'id',
255 'optionEditPath' => 'civicrm/admin/options/pdf_format',
256 )
257 ) ,
258 );
346aaaba 259 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 260 }
346aaaba 261 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
262 }
263 /**
bd8e0b14 264 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
265 *
266 * @return array
bd8e0b14 267 * Array(string $name => string $uniqueName).
e501603b
TO
268 */
269 static function &fieldKeys() {
bd8e0b14
TO
270 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
271 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 272 }
bd8e0b14 273 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
274 }
275 /**
276 * Returns the names of this table
277 *
278 * @return string
279 */
280 static function getTableName() {
281 return self::$_tableName;
282 }
283 /**
284 * Returns if this table needs to be logged
285 *
286 * @return boolean
287 */
288 function getLog() {
289 return self::$_log;
290 }
291 /**
292 * Returns the list of fields that can be imported
293 *
294 * @param bool $prefix
295 *
296 * @return array
297 */
298 static function &import($prefix = false) {
60808919
TO
299 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'msg_template', $prefix, array());
300 return $r;
e501603b
TO
301 }
302 /**
303 * Returns the list of fields that can be exported
304 *
305 * @param bool $prefix
306 *
307 * @return array
308 */
309 static function &export($prefix = false) {
60808919
TO
310 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'msg_template', $prefix, array());
311 return $r;
e501603b
TO
312 }
313}