Merge pull request #10549 from jitendrapurohit/CRM-20761
[civicrm-core.git] / CRM / Core / DAO / MessageTemplate.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
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
29 * @copyright CiviCRM LLC (c) 2004-2017
30 *
31 * Generated from xml/schema/CRM/Core/MessageTemplate.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:ca87344addd76f0aca31f53071a01238)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Core_DAO_MessageTemplate constructor.
39 */
40 class CRM_Core_DAO_MessageTemplate extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_msg_template';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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 /**
119 * Class constructor.
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() {
131 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
132 Civi::$statics[__CLASS__]['fields'] = array(
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,
139 'table_name' => 'civicrm_msg_template',
140 'entity' => 'MessageTemplate',
141 'bao' => 'CRM_Core_BAO_MessageTemplate',
142 'localizable' => 0,
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,
151 'table_name' => 'civicrm_msg_template',
152 'entity' => 'MessageTemplate',
153 'bao' => 'CRM_Core_BAO_MessageTemplate',
154 'localizable' => 0,
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.',
161 'table_name' => 'civicrm_msg_template',
162 'entity' => 'MessageTemplate',
163 'bao' => 'CRM_Core_BAO_MessageTemplate',
164 'localizable' => 0,
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',
171 'table_name' => 'civicrm_msg_template',
172 'entity' => 'MessageTemplate',
173 'bao' => 'CRM_Core_BAO_MessageTemplate',
174 'localizable' => 0,
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',
184 'table_name' => 'civicrm_msg_template',
185 'entity' => 'MessageTemplate',
186 'bao' => 'CRM_Core_BAO_MessageTemplate',
187 'localizable' => 0,
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',
197 'table_name' => 'civicrm_msg_template',
198 'entity' => 'MessageTemplate',
199 'bao' => 'CRM_Core_BAO_MessageTemplate',
200 'localizable' => 0,
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',
207 'table_name' => 'civicrm_msg_template',
208 'entity' => 'MessageTemplate',
209 'bao' => 'CRM_Core_BAO_MessageTemplate',
210 'localizable' => 0,
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',
218 'table_name' => 'civicrm_msg_template',
219 'entity' => 'MessageTemplate',
220 'bao' => 'CRM_Core_BAO_MessageTemplate',
221 'localizable' => 0,
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?',
228 'table_name' => 'civicrm_msg_template',
229 'entity' => 'MessageTemplate',
230 'bao' => 'CRM_Core_BAO_MessageTemplate',
231 'localizable' => 0,
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?',
238 'table_name' => 'civicrm_msg_template',
239 'entity' => 'MessageTemplate',
240 'bao' => 'CRM_Core_BAO_MessageTemplate',
241 'localizable' => 0,
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.',
248 'table_name' => 'civicrm_msg_template',
249 'entity' => 'MessageTemplate',
250 'bao' => 'CRM_Core_BAO_MessageTemplate',
251 'localizable' => 0,
252 'pseudoconstant' => array(
253 'optionGroupName' => 'pdf_format',
254 'keyColumn' => 'id',
255 'optionEditPath' => 'civicrm/admin/options/pdf_format',
256 )
257 ) ,
258 );
259 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
260 }
261 return Civi::$statics[__CLASS__]['fields'];
262 }
263 /**
264 * Return a mapping from field-name to the corresponding key (as used in fields()).
265 *
266 * @return array
267 * Array(string $name => string $uniqueName).
268 */
269 static function &fieldKeys() {
270 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
271 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
272 }
273 return Civi::$statics[__CLASS__]['fieldKeys'];
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) {
299 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'msg_template', $prefix, array());
300 return $r;
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) {
310 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'msg_template', $prefix, array());
311 return $r;
312 }
313 /**
314 * Returns the list of indices
315 */
316 public static function indices($localize = TRUE) {
317 $indices = array();
318 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
319 }
320 }