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