Merge pull request #10159 from colemanw/CRM-20425
[civicrm-core.git] / CRM / Core / DAO / MailSettings.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/MailSettings.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:86515d7cb55425fbad3a71d5aa000af0)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Core_DAO_MailSettings constructor.
39 */
40 class CRM_Core_DAO_MailSettings extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_mail_settings';
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 * primary key
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * Which Domain is this match entry for
61 *
62 * @var int unsigned
63 */
64 public $domain_id;
65 /**
66 * name of this group of settings
67 *
68 * @var string
69 */
70 public $name;
71 /**
72 * whether this is the default set of settings for this domain
73 *
74 * @var boolean
75 */
76 public $is_default;
77 /**
78 * email address domain (the part after @)
79 *
80 * @var string
81 */
82 public $domain;
83 /**
84 * optional local part (like civimail+ for addresses like civimail+s.1.2@example.com)
85 *
86 * @var string
87 */
88 public $localpart;
89 /**
90 * contents of the Return-Path header
91 *
92 * @var string
93 */
94 public $return_path;
95 /**
96 * name of the protocol to use for polling (like IMAP, POP3 or Maildir)
97 *
98 * @var string
99 */
100 public $protocol;
101 /**
102 * server to use when polling
103 *
104 * @var string
105 */
106 public $server;
107 /**
108 * port to use when polling
109 *
110 * @var int unsigned
111 */
112 public $port;
113 /**
114 * username to use when polling
115 *
116 * @var string
117 */
118 public $username;
119 /**
120 * password to use when polling
121 *
122 * @var string
123 */
124 public $password;
125 /**
126 * whether to use SSL or not
127 *
128 * @var boolean
129 */
130 public $is_ssl;
131 /**
132 * folder to poll from when using IMAP, path to poll from when using Maildir, etc.
133 *
134 * @var string
135 */
136 public $source;
137 /**
138 * Name of status to use when creating email to activity.
139 *
140 * @var string
141 */
142 public $activity_status;
143 /**
144 * Class constructor.
145 */
146 function __construct() {
147 $this->__table = 'civicrm_mail_settings';
148 parent::__construct();
149 }
150 /**
151 * Returns foreign keys and entity references.
152 *
153 * @return array
154 * [CRM_Core_Reference_Interface]
155 */
156 static function getReferenceColumns() {
157 if (!isset(Civi::$statics[__CLASS__]['links'])) {
158 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
159 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
160 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
161 }
162 return Civi::$statics[__CLASS__]['links'];
163 }
164 /**
165 * Returns all the column names of this table
166 *
167 * @return array
168 */
169 static function &fields() {
170 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
171 Civi::$statics[__CLASS__]['fields'] = array(
172 'id' => array(
173 'name' => 'id',
174 'type' => CRM_Utils_Type::T_INT,
175 'title' => ts('Mail Settings ID') ,
176 'description' => 'primary key',
177 'required' => true,
178 'table_name' => 'civicrm_mail_settings',
179 'entity' => 'MailSettings',
180 'bao' => 'CRM_Core_BAO_MailSettings',
181 'localizable' => 0,
182 ) ,
183 'domain_id' => array(
184 'name' => 'domain_id',
185 'type' => CRM_Utils_Type::T_INT,
186 'title' => ts('Mail Settings Domain') ,
187 'description' => 'Which Domain is this match entry for',
188 'required' => true,
189 'table_name' => 'civicrm_mail_settings',
190 'entity' => 'MailSettings',
191 'bao' => 'CRM_Core_BAO_MailSettings',
192 'localizable' => 0,
193 'FKClassName' => 'CRM_Core_DAO_Domain',
194 'pseudoconstant' => array(
195 'table' => 'civicrm_domain',
196 'keyColumn' => 'id',
197 'labelColumn' => 'name',
198 )
199 ) ,
200 'name' => array(
201 'name' => 'name',
202 'type' => CRM_Utils_Type::T_STRING,
203 'title' => ts('Mail Settings Name') ,
204 'description' => 'name of this group of settings',
205 'maxlength' => 255,
206 'size' => CRM_Utils_Type::HUGE,
207 'table_name' => 'civicrm_mail_settings',
208 'entity' => 'MailSettings',
209 'bao' => 'CRM_Core_BAO_MailSettings',
210 'localizable' => 0,
211 ) ,
212 'is_default' => array(
213 'name' => 'is_default',
214 'type' => CRM_Utils_Type::T_BOOLEAN,
215 'title' => ts('Is Default Mail Settings?') ,
216 'description' => 'whether this is the default set of settings for this domain',
217 'table_name' => 'civicrm_mail_settings',
218 'entity' => 'MailSettings',
219 'bao' => 'CRM_Core_BAO_MailSettings',
220 'localizable' => 0,
221 ) ,
222 'domain' => array(
223 'name' => 'domain',
224 'type' => CRM_Utils_Type::T_STRING,
225 'title' => ts('email Domain') ,
226 'description' => 'email address domain (the part after @)',
227 'maxlength' => 255,
228 'size' => CRM_Utils_Type::HUGE,
229 'table_name' => 'civicrm_mail_settings',
230 'entity' => 'MailSettings',
231 'bao' => 'CRM_Core_BAO_MailSettings',
232 'localizable' => 0,
233 ) ,
234 'localpart' => array(
235 'name' => 'localpart',
236 'type' => CRM_Utils_Type::T_STRING,
237 'title' => ts('email Local Part') ,
238 'description' => 'optional local part (like civimail+ for addresses like civimail+s.1.2@example.com)',
239 'maxlength' => 255,
240 'size' => CRM_Utils_Type::HUGE,
241 'table_name' => 'civicrm_mail_settings',
242 'entity' => 'MailSettings',
243 'bao' => 'CRM_Core_BAO_MailSettings',
244 'localizable' => 0,
245 ) ,
246 'return_path' => array(
247 'name' => 'return_path',
248 'type' => CRM_Utils_Type::T_STRING,
249 'title' => ts('Return Path') ,
250 'description' => 'contents of the Return-Path header',
251 'maxlength' => 255,
252 'size' => CRM_Utils_Type::HUGE,
253 'table_name' => 'civicrm_mail_settings',
254 'entity' => 'MailSettings',
255 'bao' => 'CRM_Core_BAO_MailSettings',
256 'localizable' => 0,
257 ) ,
258 'protocol' => array(
259 'name' => 'protocol',
260 'type' => CRM_Utils_Type::T_STRING,
261 'title' => ts('Protocol') ,
262 'description' => 'name of the protocol to use for polling (like IMAP, POP3 or Maildir)',
263 'maxlength' => 255,
264 'size' => CRM_Utils_Type::HUGE,
265 'table_name' => 'civicrm_mail_settings',
266 'entity' => 'MailSettings',
267 'bao' => 'CRM_Core_BAO_MailSettings',
268 'localizable' => 0,
269 'html' => array(
270 'type' => 'Select',
271 ) ,
272 'pseudoconstant' => array(
273 'optionGroupName' => 'mail_protocol',
274 'optionEditPath' => 'civicrm/admin/options/mail_protocol',
275 )
276 ) ,
277 'server' => array(
278 'name' => 'server',
279 'type' => CRM_Utils_Type::T_STRING,
280 'title' => ts('Mail Server') ,
281 'description' => 'server to use when polling',
282 'maxlength' => 255,
283 'size' => CRM_Utils_Type::HUGE,
284 'table_name' => 'civicrm_mail_settings',
285 'entity' => 'MailSettings',
286 'bao' => 'CRM_Core_BAO_MailSettings',
287 'localizable' => 0,
288 ) ,
289 'port' => array(
290 'name' => 'port',
291 'type' => CRM_Utils_Type::T_INT,
292 'title' => ts('Mail Port') ,
293 'description' => 'port to use when polling',
294 'table_name' => 'civicrm_mail_settings',
295 'entity' => 'MailSettings',
296 'bao' => 'CRM_Core_BAO_MailSettings',
297 'localizable' => 0,
298 ) ,
299 'username' => array(
300 'name' => 'username',
301 'type' => CRM_Utils_Type::T_STRING,
302 'title' => ts('Mail Account Username') ,
303 'description' => 'username to use when polling',
304 'maxlength' => 255,
305 'size' => CRM_Utils_Type::HUGE,
306 'table_name' => 'civicrm_mail_settings',
307 'entity' => 'MailSettings',
308 'bao' => 'CRM_Core_BAO_MailSettings',
309 'localizable' => 0,
310 ) ,
311 'password' => array(
312 'name' => 'password',
313 'type' => CRM_Utils_Type::T_STRING,
314 'title' => ts('Mail Account Password') ,
315 'description' => 'password to use when polling',
316 'maxlength' => 255,
317 'size' => CRM_Utils_Type::HUGE,
318 'table_name' => 'civicrm_mail_settings',
319 'entity' => 'MailSettings',
320 'bao' => 'CRM_Core_BAO_MailSettings',
321 'localizable' => 0,
322 ) ,
323 'is_ssl' => array(
324 'name' => 'is_ssl',
325 'type' => CRM_Utils_Type::T_BOOLEAN,
326 'title' => ts('Mail Account Uses SSL') ,
327 'description' => 'whether to use SSL or not',
328 'table_name' => 'civicrm_mail_settings',
329 'entity' => 'MailSettings',
330 'bao' => 'CRM_Core_BAO_MailSettings',
331 'localizable' => 0,
332 ) ,
333 'source' => array(
334 'name' => 'source',
335 'type' => CRM_Utils_Type::T_STRING,
336 'title' => ts('Mail Folder') ,
337 'description' => 'folder to poll from when using IMAP, path to poll from when using Maildir, etc.',
338 'maxlength' => 255,
339 'size' => CRM_Utils_Type::HUGE,
340 'table_name' => 'civicrm_mail_settings',
341 'entity' => 'MailSettings',
342 'bao' => 'CRM_Core_BAO_MailSettings',
343 'localizable' => 0,
344 ) ,
345 'activity_status' => array(
346 'name' => 'activity_status',
347 'type' => CRM_Utils_Type::T_STRING,
348 'title' => ts('Activity Status') ,
349 'description' => 'Name of status to use when creating email to activity.',
350 'maxlength' => 255,
351 'size' => CRM_Utils_Type::HUGE,
352 'table_name' => 'civicrm_mail_settings',
353 'entity' => 'MailSettings',
354 'bao' => 'CRM_Core_BAO_MailSettings',
355 'localizable' => 0,
356 'html' => array(
357 'type' => 'Select',
358 ) ,
359 'pseudoconstant' => array(
360 'optionGroupName' => 'activity_status',
361 'keyColumn' => 'name',
362 'optionEditPath' => 'civicrm/admin/options/activity_status',
363 )
364 ) ,
365 );
366 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
367 }
368 return Civi::$statics[__CLASS__]['fields'];
369 }
370 /**
371 * Return a mapping from field-name to the corresponding key (as used in fields()).
372 *
373 * @return array
374 * Array(string $name => string $uniqueName).
375 */
376 static function &fieldKeys() {
377 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
378 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
379 }
380 return Civi::$statics[__CLASS__]['fieldKeys'];
381 }
382 /**
383 * Returns the names of this table
384 *
385 * @return string
386 */
387 static function getTableName() {
388 return self::$_tableName;
389 }
390 /**
391 * Returns if this table needs to be logged
392 *
393 * @return boolean
394 */
395 function getLog() {
396 return self::$_log;
397 }
398 /**
399 * Returns the list of fields that can be imported
400 *
401 * @param bool $prefix
402 *
403 * @return array
404 */
405 static function &import($prefix = false) {
406 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mail_settings', $prefix, array());
407 return $r;
408 }
409 /**
410 * Returns the list of fields that can be exported
411 *
412 * @param bool $prefix
413 *
414 * @return array
415 */
416 static function &export($prefix = false) {
417 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mail_settings', $prefix, array());
418 return $r;
419 }
420 /**
421 * Returns the list of indices
422 */
423 public static function indices($localize = TRUE) {
424 $indices = array();
425 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
426 }
427 }