Merge pull request #8916 from cividesk/CRM-19256-4.7
[civicrm-core.git] / CRM / Core / DAO / MailSettings.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/MailSettings.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:16f3698a9997d082948fd562d6782962)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_Core_DAO_MailSettings constructor.
39 */
e501603b
TO
40class CRM_Core_DAO_MailSettings 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_mail_settings';
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 * 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 /**
f41f0342 138 * Class constructor.
e501603b
TO
139 */
140 function __construct() {
141 $this->__table = 'civicrm_mail_settings';
142 parent::__construct();
143 }
144 /**
f41f0342 145 * Returns foreign keys and entity references.
e501603b
TO
146 *
147 * @return array
148 * [CRM_Core_Reference_Interface]
149 */
150 static function getReferenceColumns() {
346aaaba
TO
151 if (!isset(Civi::$statics[__CLASS__]['links'])) {
152 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
153 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
154 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 155 }
346aaaba 156 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
157 }
158 /**
159 * Returns all the column names of this table
160 *
161 * @return array
162 */
163 static function &fields() {
346aaaba
TO
164 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
165 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
166 'id' => array(
167 'name' => 'id',
168 'type' => CRM_Utils_Type::T_INT,
169 'title' => ts('Mail Settings ID') ,
170 'description' => 'primary key',
171 'required' => true,
172 ) ,
173 'domain_id' => array(
174 'name' => 'domain_id',
175 'type' => CRM_Utils_Type::T_INT,
176 'title' => ts('Mail Settings Domain') ,
177 'description' => 'Which Domain is this match entry for',
178 'required' => true,
179 'FKClassName' => 'CRM_Core_DAO_Domain',
180 'pseudoconstant' => array(
181 'table' => 'civicrm_domain',
182 'keyColumn' => 'id',
183 'labelColumn' => 'name',
184 )
185 ) ,
186 'name' => array(
187 'name' => 'name',
188 'type' => CRM_Utils_Type::T_STRING,
189 'title' => ts('Mail Settings Name') ,
190 'description' => 'name of this group of settings',
191 'maxlength' => 255,
192 'size' => CRM_Utils_Type::HUGE,
193 ) ,
194 'is_default' => array(
195 'name' => 'is_default',
196 'type' => CRM_Utils_Type::T_BOOLEAN,
197 'title' => ts('Is Default Mail Settings?') ,
198 'description' => 'whether this is the default set of settings for this domain',
199 ) ,
200 'domain' => array(
201 'name' => 'domain',
202 'type' => CRM_Utils_Type::T_STRING,
203 'title' => ts('email Domain') ,
204 'description' => 'email address domain (the part after @)',
205 'maxlength' => 255,
206 'size' => CRM_Utils_Type::HUGE,
207 ) ,
208 'localpart' => array(
209 'name' => 'localpart',
210 'type' => CRM_Utils_Type::T_STRING,
211 'title' => ts('email Local Part') ,
212 'description' => 'optional local part (like civimail+ for addresses like civimail+s.1.2@example.com)',
213 'maxlength' => 255,
214 'size' => CRM_Utils_Type::HUGE,
215 ) ,
216 'return_path' => array(
217 'name' => 'return_path',
218 'type' => CRM_Utils_Type::T_STRING,
219 'title' => ts('Return Path') ,
220 'description' => 'contents of the Return-Path header',
221 'maxlength' => 255,
222 'size' => CRM_Utils_Type::HUGE,
223 ) ,
224 'protocol' => array(
225 'name' => 'protocol',
226 'type' => CRM_Utils_Type::T_STRING,
227 'title' => ts('Protocol') ,
228 'description' => 'name of the protocol to use for polling (like IMAP, POP3 or Maildir)',
229 'maxlength' => 255,
230 'size' => CRM_Utils_Type::HUGE,
231 'html' => array(
232 'type' => 'Select',
233 ) ,
234 'pseudoconstant' => array(
235 'optionGroupName' => 'mail_protocol',
236 'optionEditPath' => 'civicrm/admin/options/mail_protocol',
237 )
238 ) ,
239 'server' => array(
240 'name' => 'server',
241 'type' => CRM_Utils_Type::T_STRING,
242 'title' => ts('Mail Server') ,
243 'description' => 'server to use when polling',
244 'maxlength' => 255,
245 'size' => CRM_Utils_Type::HUGE,
246 ) ,
247 'port' => array(
248 'name' => 'port',
249 'type' => CRM_Utils_Type::T_INT,
250 'title' => ts('Mail Port') ,
251 'description' => 'port to use when polling',
252 ) ,
253 'username' => array(
254 'name' => 'username',
255 'type' => CRM_Utils_Type::T_STRING,
256 'title' => ts('Mail Account Username') ,
257 'description' => 'username to use when polling',
258 'maxlength' => 255,
259 'size' => CRM_Utils_Type::HUGE,
260 ) ,
261 'password' => array(
262 'name' => 'password',
263 'type' => CRM_Utils_Type::T_STRING,
264 'title' => ts('Mail Account Password') ,
265 'description' => 'password to use when polling',
266 'maxlength' => 255,
267 'size' => CRM_Utils_Type::HUGE,
268 ) ,
269 'is_ssl' => array(
270 'name' => 'is_ssl',
271 'type' => CRM_Utils_Type::T_BOOLEAN,
272 'title' => ts('Mail Account Uses SSL') ,
273 'description' => 'whether to use SSL or not',
274 ) ,
275 'source' => array(
276 'name' => 'source',
277 'type' => CRM_Utils_Type::T_STRING,
278 'title' => ts('Mail Folder') ,
279 'description' => 'folder to poll from when using IMAP, path to poll from when using Maildir, etc.',
280 'maxlength' => 255,
281 'size' => CRM_Utils_Type::HUGE,
282 ) ,
283 );
346aaaba 284 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 285 }
346aaaba 286 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
287 }
288 /**
bd8e0b14 289 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
290 *
291 * @return array
bd8e0b14 292 * Array(string $name => string $uniqueName).
e501603b
TO
293 */
294 static function &fieldKeys() {
bd8e0b14
TO
295 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
296 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 297 }
bd8e0b14 298 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
299 }
300 /**
301 * Returns the names of this table
302 *
303 * @return string
304 */
305 static function getTableName() {
306 return self::$_tableName;
307 }
308 /**
309 * Returns if this table needs to be logged
310 *
311 * @return boolean
312 */
313 function getLog() {
314 return self::$_log;
315 }
316 /**
317 * Returns the list of fields that can be imported
318 *
319 * @param bool $prefix
320 *
321 * @return array
322 */
323 static function &import($prefix = false) {
60808919
TO
324 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mail_settings', $prefix, array());
325 return $r;
e501603b
TO
326 }
327 /**
328 * Returns the list of fields that can be exported
329 *
330 * @param bool $prefix
331 *
332 * @return array
333 */
334 static function &export($prefix = false) {
60808919
TO
335 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mail_settings', $prefix, array());
336 return $r;
e501603b
TO
337 }
338}